diff --git a/vim/vimrc b/vim/vimrc index 51c848e..6fb2abd 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -1,3 +1,15 @@ +" XDG Specifications +let rtp=&runtimepath +set runtimepath=~/.config/vim +let &runtimepath.=','.rtp.',~/.config/vim/after' +set directory=~/.config/vim/swap//,.,~/tmp,/var/tmp,/tmp +set backupdir=~/.config/vim/backup//,.,~/tmp,~/ +set spellfile=~/.config/vim/spell/en.utf-8.add +set viminfo+=n~/.config/vim/viminfo +set viewdir=~/.config/vim/view/ +set undodir=~/.config/vim/undo//,. + +" Basic preferences set clipboard=unnamedplus set shellcmdflag=-c set encoding=utf-8 @@ -17,21 +29,6 @@ set mouse=a set showcmd set number -" notes -autocmd BufWritePost note-*.md execute '! git -C ~/Documents/notes/ add ~/Documents/notes/% ; git commit -m "Auto-commit: saved %"' - -" groff -autocmd FileType groff noremap :!zathura --fork %:r.pdf & disown -autocmd FileType groff noremap :w :!groff-compiler % > %:r.pdf -au BufNewFile,BufRead *.ms set filetype=groff - -" LaTeX -autocmd FileType tex noremap :w :!latex % :!pdflatex % -autocmd FileType bib noremap :w :!bibtex % - -" Python -autocmd FileType python noremap :w :!python % - " Global keybindings noremap gc :!git commit -m "" noremap gp :!git push @@ -47,22 +44,56 @@ noremap 5< noremap za noremap N /@@@ +" notes +autocmd BufWritePost note-*.md execute '! git -C ~/Documents/notes/ add ~/Documents/notes/% ; git commit -m "Auto-commit: saved %"' + +" groff +autocmd FileType groff noremap :!zathura --fork %:r.pdf & disown +autocmd FileType groff noremap :w :!groff-compiler % > %:r.pdf +au BufNewFile,BufRead *.ms set filetype=groff + +" LaTeX +autocmd FileType tex noremap :w :!latex % :!pdflatex % +autocmd FileType bib noremap :w :!bibtex % + +" Python +autocmd FileType python noremap :w :!python % + " Folds autocmd BufWinLeave bibliography zM | mkview autocmd BufWinEnter bibliography silent loadview autocmd BufWinLeave bookmarks zM | mkview autocmd BufWinEnter bookmarks silent loadview -" Enabling .config -let rtp=&runtimepath -set runtimepath=~/.config/vim -let &runtimepath.=','.rtp.',~/.config/vim/after' -set directory=~/.config/vim/swap//,.,~/tmp,/var/tmp,/tmp -set backupdir=~/.config/vim/backup//,.,~/tmp,~/ -set spellfile=~/.config/vim/spell/en.utf-8.add -set viminfo+=n~/.config/vim/viminfo -set viewdir=~/.config/vim/view/ -set undodir=~/.config/vim/undo//,. +" Neovim exclusive (I think) +" Open a shell on a vertical split +set splitright +function OpenTerminal() + execute "normal \" + execute "normal \" + execute "normal \" + execute "normal \" + + let bufNum = bufnr("%") + let bufType = getbufvar(bufNum, "&buftype", "not found") + + if bufType == "terminal" + execute "q" + else + execute "vsp term://bash" + execute "set nonu" + execute "set nornu" + silent au BufLeave stopinsert! + silent au BufWinEnter,WinEnter startinsert! + execute "tnoremap " + execute "tnoremap :q" + execute "tnoremap " + execute "IndentLinesDisable" + + startinsert! + endif +endfunction +nnoremap :call OpenTerminal() " Plugins if empty(glob('~/.config/vim/autoload/plug.vim')) @@ -121,33 +152,3 @@ noremap gf :FzfLua files let g:signify_disable_by_default = 1 highlight SignColumn ctermbg=NONE noremap gd :SignifyToggle - -" Neovim exclusive (I think) -" Open a shell on a vertical split -set splitright -function OpenTerminal() - execute "normal \" - execute "normal \" - execute "normal \" - execute "normal \" - - let bufNum = bufnr("%") - let bufType = getbufvar(bufNum, "&buftype", "not found") - - if bufType == "terminal" - execute "q" - else - execute "vsp term://bash" - execute "set nonu" - execute "set nornu" - silent au BufLeave stopinsert! - silent au BufWinEnter,WinEnter startinsert! - execute "tnoremap " - execute "tnoremap :q" - execute "tnoremap " - execute "IndentLinesDisable" - - startinsert! - endif -endfunction -nnoremap :call OpenTerminal()