diff options
author | Yigit Sever | 2021-10-06 02:28:19 +0300 |
---|---|---|
committer | Yigit Sever | 2021-10-06 02:28:19 +0300 |
commit | ec67aaa4606e2c8f982e624eb309a0d89abda902 (patch) | |
tree | ccc196b80cbf838f76e979737c9d9350a3f6266d | |
parent | 476eaf27a53a1d95b0af7c97f960718c32429b43 (diff) | |
download | dotfiles-ec67aaa4606e2c8f982e624eb309a0d89abda902.tar.gz dotfiles-ec67aaa4606e2c8f982e624eb309a0d89abda902.tar.bz2 dotfiles-ec67aaa4606e2c8f982e624eb309a0d89abda902.zip |
nvim: cleanup
-rwxr-xr-x | .config/nvim/init.vim | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index c673870..ad9f90a 100755 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim | |||
@@ -166,8 +166,6 @@ call plug#end() | |||
166 | " Remove any trailing whitespace that is in the file | 166 | " Remove any trailing whitespace that is in the file |
167 | autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif | 167 | autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif |
168 | 168 | ||
169 | " Close vim if the only window left open is NERDTree | ||
170 | autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | ||
171 | " Close vim if the only window left open is a quickfix window | 169 | " Close vim if the only window left open is a quickfix window |
172 | autocmd WinEnter * if winnr("$") == 1 && &buftype == "quickfix" | q | endif | 170 | autocmd WinEnter * if winnr("$") == 1 && &buftype == "quickfix" | q | endif |
173 | " winnr("$") how many windows left? | 171 | " winnr("$") how many windows left? |
@@ -179,6 +177,7 @@ autocmd VimResized * :wincmd = | |||
179 | " Set spell for prose | 177 | " Set spell for prose |
180 | autocmd FileType markdown,tex setlocal spell | 178 | autocmd FileType markdown,tex setlocal spell |
181 | 179 | ||
180 | " Dispatch.vim plugin to use cargo run for rust projects | ||
182 | autocmd FileType rust let b:dispatch = 'cargo run' | 181 | autocmd FileType rust let b:dispatch = 'cargo run' |
183 | 182 | ||
184 | " these files are formatted not with textwidth but into sentences | 183 | " these files are formatted not with textwidth but into sentences |
@@ -260,17 +259,18 @@ set tabstop=8 | |||
260 | set spell spelllang=en_gb | 259 | set spell spelllang=en_gb |
261 | set nospell | 260 | set nospell |
262 | 261 | ||
263 | " Cool tab completion stuff | 262 | " Tab completion, zsh style |
264 | set wildmode=list:longest,full | 263 | set wildmode=full |
265 | set wildignore=*.o,*.obj,*.class,*.aux,*.lof,*.log,*.lot,*.fls,*.toc,*.fmt,*.fot,*.cb,*.cb2,.*.lb,.dvi,*.xdv,*.bbl,*.bcf,*.blg,*-blx.aux,*-blx.bib,*.run.xml,*.fdb_latexmk,*.synctex,*.synctex(busy),*.synctex.gz,*.synctex.gz(busy),*.pdfsync | 264 | set wildignore=*.o,*.obj,*.class,*.aux,*.lof,*.log,*.lot,*.fls,*.toc,*.fmt,*.fot,*.cb,*.cb2,.*.lb,.dvi,*.xdv,*.bbl,*.bcf,*.blg,*-blx.aux,*-blx.bib,*.run.xml,*.fdb_latexmk,*.synctex,*.synctex(busy),*.synctex.gz,*.synctex.gz(busy),*.pdfsync |
266 | let g:NERDTreeRespectWildIgnore = 1 | 265 | |
266 | " Put one space while joining (not two) | ||
267 | set nojoinspaces | 267 | set nojoinspaces |
268 | 268 | ||
269 | " Keep n lines above/below cursor while scrolling | 269 | " Keep n lines above/below cursor while scrolling |
270 | set scrolloff=4 | 270 | set scrolloff=4 |
271 | " line numbers | 271 | " line numbers |
272 | set number | 272 | set number |
273 | " fold manually, when i place markers | 273 | " fold manually, when I place markers |
274 | set foldmethod=marker | 274 | set foldmethod=marker |
275 | " set terminal title | 275 | " set terminal title |
276 | set title | 276 | set title |
@@ -358,12 +358,6 @@ nnoremap S :%s//g<Left><Left> | |||
358 | " use esc in :term as well | 358 | " use esc in :term as well |
359 | tnoremap <Esc> <C-\><C-n> | 359 | tnoremap <Esc> <C-\><C-n> |
360 | 360 | ||
361 | " move between windows in :term | ||
362 | tnoremap <C-h> <C-\><C-n><C-w>h | ||
363 | tnoremap <C-j> <C-\><C-n><C-w>j | ||
364 | tnoremap <C-k> <C-\><C-n><C-w>k | ||
365 | tnoremap <C-l> <C-\><C-n><C-w>l | ||
366 | |||
367 | " call CreatePaper on word below cursor | 361 | " call CreatePaper on word below cursor |
368 | nnoremap <leader>np gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand('<cword>'))<CR> | 362 | nnoremap <leader>np gewi[[/papers/<ESC>Ea]]<ESC>bb:call CreatePaper(expand('<cword>'))<CR> |
369 | 363 | ||
@@ -382,8 +376,6 @@ map Y y$ | |||
382 | 376 | ||
383 | " Open the TagBar Plugin <F3> | 377 | " Open the TagBar Plugin <F3> |
384 | nnoremap <silent> <F3> :TagbarToggle<CR> | 378 | nnoremap <silent> <F3> :TagbarToggle<CR> |
385 | " Open NERDTree <F4> | ||
386 | nnoremap <silent> <F4> :NERDTreeToggle<CR> | ||
387 | " Fix whole buffer via ALE | 379 | " Fix whole buffer via ALE |
388 | nmap <F9> <Plug>(ale_fix) | 380 | nmap <F9> <Plug>(ale_fix) |
389 | 381 | ||
@@ -405,12 +397,6 @@ nnoremap <silent> j gj | |||
405 | inoremap <silent> <Up> <Esc>gka | 397 | inoremap <silent> <Up> <Esc>gka |
406 | inoremap <silent> <Down> <Esc>gja | 398 | inoremap <silent> <Down> <Esc>gja |
407 | 399 | ||
408 | " quicker window movement | ||
409 | nnoremap <C-j> <C-w>j | ||
410 | nnoremap <C-k> <C-w>k | ||
411 | nnoremap <C-h> <C-w>h | ||
412 | nnoremap <C-l> <C-w>l | ||
413 | |||
414 | " Disable highlight when <leader><cr> is pressed | 400 | " Disable highlight when <leader><cr> is pressed |
415 | nnoremap <silent> <leader><cr> :noh<cr> | 401 | nnoremap <silent> <leader><cr> :noh<cr> |
416 | " Space used to toggle folds, now it's x (because x is d) | 402 | " Space used to toggle folds, now it's x (because x is d) |