dotfiles/vim/vimrc
2023-08-24 16:47:01 -06:00

119 lines
3.1 KiB
VimL

" tavo custom vimrc file
set clipboard=unnamedplus
set shellcmdflag=-ic
set encoding=utf-8
set relativenumber
set shiftwidth=4
set cursorline
set ignorecase
set smartcase
set expandtab
set tabstop=4
set autoread
set wildmenu
set hlsearch
set swapfile
set undofile
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 <buffer> <silent> <F9> :!zathura --fork %:r.pdf<CR> & disown
autocmd FileType groff noremap <buffer> <C-s> :w<CR> :!groff-compiler % > %:r.pdf<CR><CR>
au BufNewFile,BufRead *.ms set filetype=groff
" LaTeX
autocmd FileType tex noremap <buffer> <F9> :w<CR> :!latex %<CR> :!pdflatex %<CR>
autocmd FileType bib noremap <buffer> <F9> :w<CR> :!bibtex %<CR>
" Python
autocmd FileType python noremap <buffer> <F9> :w<CR> :!python %<CR>
" NERDTree
nnoremap <C-t> :NERDTreeToggle<CR>
" Global keybindings
noremap gc :!git commit -m ""<Left>
noremap gp :!git push<CR>
noremap gl :!git pull<CR>
noremap <F5> :setlocal spell! spelllang=en<CR>
noremap <F6> :setlocal spell! spelllang=es<CR>
noremap exec !!$SHELL<CR>
noremap <tab> :bn<CR>
noremap <C-c> :bd<CR>
noremap <C-s> :w<CR>
noremap <Space> za
noremap N /@@@<CR>
" 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//,.
" Plugins
if empty(glob('~/.config/vim/autoload/plug.vim'))
silent !curl -fLo ~/.config/vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source '~/.config/vim/vimrc'
endif
call plug#begin()
Plug 'vim-airline/vim-airline-themes'
Plug 'vim-airline/vim-airline'
Plug 'jiangmiao/auto-pairs'
Plug 'Yggdroot/indentLine'
Plug 'preservim/nerdtree'
Plug 'junegunn/goyo.vim'
Plug 'mhinz/vim-signify'
Plug 'ibhagwan/fzf-lua' " Neovim exclusive
Plug 'morhetz/gruvbox'
"Plug 'dracula/vim'
call plug#end()
" Theme
let g:gruvbox_contrast_hard=1
let g:gruvbox_italic=1
set background=dark
colorscheme gruvbox
" Airline
let g:airline#extensions#tabline#buffer_min_count = 2
let g:airline#extensions#tabline#enabled = 1
set ttimeout ttimeoutlen=0
set laststatus=2
set noshowmode
" Goyo
map gy :Goyo<CR>
autocmd! User GoyoLeave highlight Normal ctermbg=NONE
" IndentLine
let g:indentLine_enabled = 1
let g:indentLine_char = '|'
" fzf-lua
noremap <A-b> :FzfLua git_branches<CR>
noremap <A-c> :FzfLua git_commits<CR>
noremap <A-s> :FzfLua git_status<CR>
noremap <A-f> :FzfLua files<CR>
" Signify
let g:signify_disable_by_default = 1
highlight SignColumn ctermbg=NONE
noremap df :SignifyToggle<CR>