summaryrefslogtreecommitdiff
path: root/nvim/init.vim
blob: 6582d6a3ac0d5412d05b72b6a25ba3abb90c0e00 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
set nu
set ff=unix
set colorcolumn=80
set list
set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol,precedes:«,extends:»
if has('win32')
	source $VIMRUNTIME/mswin.vim
endif
"let g:python3_host_prog='D:/Progams/Python/python.exe'

call plug#begin('~/.vim/plugged')

"Formatting and navigation
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/nerdcommenter'
Plug 'godlygeek/tabular'

"Git
Plug 'xuyuanp/nerdtree-git-plugin'
Plug 'tpope/vim-fugitive'

"Fuzzy file search
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }

"tab completion
Plug 'Shougo/denite.nvim'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/echodoc.vim'
Plug 'deoplete-plugins/deoplete-jedi'

Plug 'xolox/vim-misc'
Plug 'xolox/vim-lua-ftplugin'
Plug 'VaiN474/vim-etlua'
Plug 'leafo/moonscript-vim'
Plug 'teal-language/vim-teal'

Plug 'whonore/Coqtail'

"Color schemes
Plug 'mhartington/oceanic-next'
Plug 'vim-scripts/Wombat'
Plug 'zeis/vim-kolor'
Plug 'alessandroyorba/despacio'
Plug 'alessandroyorba/alduin'
Plug 'tomasr/molokai'
Plug 'sainnhe/vim-color-forest-night'
Plug 'sts10/vim-pink-moon'
Plug 'severij/vadelma'
Plug 'kkpmw/sacredforest-vim'
Plug 'jsit/toast.vim'
Plug 'henrynewcomer/vim-theme-papaya'
Plug 'sainnhe/edge'
Plug 'kjssad/quantum.vim'
Plug 'kyoz/purify'
Plug 'sainnhe/vim-color-atlantis'
Plug 'jonathanfilip/vim-lucius'
Plug 'joshdick/onedark.vim'
Plug 'cocopon/iceberg.vim'
Plug 'wolf-dog/sceaduhelm.vim'
Plug 'danilo-augusto/vim-afterglow'
Plug 'kamwitsta/mythos'
Plug 'softmotions/vim-dark-frost-theme'
Plug 'sainnhe/vim-color-grimoire'
Plug 'ghifarit53/tokyonight-vim'
call plug#end()

colorscheme onedark

"deoplete
let g:deoplete#enable_at_startup = 1
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"

"python
let g:deoplete#sources#jedi#python_path='python3'
let g:deoplete#sources#jedi#show_docstring=1

"lua
let g:lua_compiler_name='luajit'
"let g:lua_compiler_name='lua'
let g:lua_complete_dynamic=1
au BufReadPost *.busted set syntax=lua
au BufReadPost *.spec set syntax=lua
au BufReadPost *.etlua set syntax=html
"Overwrite xolox:ftplugin's "Help" with shift-k
au BufReadPost *.lua nunmap <buffer> K
let g:echodoc#enable_at_startup=1

"NERDTree config
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
	\ quit | endif

nnoremap <C-\> :NERDTreeToggle<Cr>
nnoremap <C-r> :NERDTreeFind<Cr>
let NERDTreeMapHelp='y'
let NERDTreeMapJumpLastChild='y'
let NERDTreeMapJumpFirstChild='y'

"Fuzzy file search
let g:fzf_layout = { 'window': {'width': 0.9, 'height': 0.6} }
noremap <A-p> :call fzf#run(fzf#wrap({'sink': 'tabe', 'left': '20%', 'source': 'git ls-files'}))<Cr>
noremap <C-p> :call fzf#run(fzf#wrap({'sink': 'vsplit', 'left': '50%', 'source': 'git ls-files'}))<Cr>

"ctrl+s saves
nmap <C-s> :w<Cr>

"For some reason this is different between linux and windows
if has('win32')
	vmap <C-/> <leader>c<Space>
else
	vmap <C-_> <leader>c<Space>
endif

"Move around quickly
nnoremap J 5j
nnoremap K 5k
nnoremap H 5h
nnoremap L 5l

"Navigate splits
tnoremap <A-h> <C-\><C-n><C-w>h
tnoremap <A-j> <C-\><C-n><C-w>j
tnoremap <A-k> <C-\><C-n><C-w>k
tnoremap <A-l> <C-\><C-n><C-w>l

nnoremap <A-h> <C-\><C-n><C-w>h
nnoremap <A-j> <C-\><C-n><C-w>j
nnoremap <A-k> <C-\><C-n><C-w>k
nnoremap <A-l> <C-\><C-n><C-w>l

"Resize splits
"noremap <C-h> :vertical resize -5<Cr>
"noremap <C-l> :vertical resize +5<Cr>
"noremap <C-j> :res +5<Cr>
"noremap <C-k> :res -5<Cr>

function! s:HasNeighbor(direction)
	return winnr() != winnr(a:direction)
endfunction

function! s:PushResize(direction, amount)
	if a:direction == 'l' || a:direction == 'h'
		let l:cmd = 'vertical resize'
	else
		let l:cmd = 'resize'
	endif

	if s:HasNeighbor(a:direction)
		let l:amount = '+'.a:amount
	else
		let l:amount = '-'.a:amount
	endif

	echo l:cmd . ' ' . l:amount
	execute l:cmd . ' ' . l:amount
endfunction

nnoremap <C-h> :call <SID>PushResize('h',5)<CR>
nnoremap <C-j> :call <SID>PushResize('j',5)<CR>
nnoremap <C-k> :call <SID>PushResize('k',5)<CR>
nnoremap <C-l> :call <SID>PushResize('l',5)<CR>

"Navigate tabs
noremap <A-]> gt
noremap <A-[> gT

"Add a semicolon at the end of the line
vnoremap <C-;> :'<,'>s/\([^;]\)$/\1;/g<Cr>

"Build in a vertical split
noremap <C-b> :vsplit<CR>:terminal make<CR>


filetype plugin indent on
syntax enable