summaryrefslogtreecommitdiff
path: root/init.vim
blob: 005cf9342a0bbe0dfe54ad38a7e46f0ba6f5fd58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
syntax match roffmac /^\..*$/
source ~/.config/nvim/latex.vim
source ~/.config/nvim/roff.vim

" global options
set number
set relativenumber
set nohlsearch
set incsearch
set showcmd
set scrolloff=10
set nowrap

" custom keys
let mapleader = "\<Space>"
nnoremap <Leader>m :make<Return> 
nnoremap <Leader>l $
nnoremap <Leader>h ^
nnoremap <Leader>j 10j
nnoremap <Leader>k 10k
nnoremap <Leader>zz :wqa<Return>
nnoremap <Leader>m :make<Return>
nnoremap <Leader>y "+y
nnoremap <Leader>d "+d
nnoremap <Leader>p "+p 
nnoremap <Leader>t :tab term<Return>
nnoremap <Leader>n :tabNext<Return>
nnoremap c zz
tnoremap <Esc> <C-\><C-n>

" language specific settings
autocmd FileType tex call Latexsetup() " latex
autocmd FileType nroff call Roffsetup() " roff 

" plugins
call plug#begin('~/.local/share/nvim/plugged')
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'kepano/flexoki-neovim'
call plug#end()

colorscheme flexoki-dark


" lsp client things
lua << EOF

local capabilities = require("cmp_nvim_lsp").default_capabilities()

local lspconfig = require('lspconfig')

-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'clangd', 'hls', 'texlab' }
for _, lsp in ipairs(servers) do
	lspconfig[lsp].setup {
		capabilities = capabilities,
	}
	end

	-- nvim-cmp setup
	local cmp = require 'cmp'
	cmp.setup {
		mapping = cmp.mapping.preset.insert({
		['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
		['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
		-- C-b (back) C-f (forward) for snippet placeholder navigation.
		['<C-Space>'] = cmp.mapping.complete(),
		['<CR>'] = cmp.mapping.confirm {
			behavior = cmp.ConfirmBehavior.Replace,
			select = true,
		},
		['<Tab>'] = cmp.mapping(function(fallback)
		if cmp.visible() then
			cmp.select_next_item()
		else
			fallback()
			end
			end, { 'i', 's' }),
			['<S-Tab>'] = cmp.mapping(function(fallback)
			if cmp.visible() then
				cmp.select_prev_item()
			else
				fallback()
				end
				end, { 'i', 's' }),
		}),
		sources = {
			{ name = 'nvim_lsp' },
			},
		}