" 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 set relativenumber filetype plugin on set shiftwidth=4 set nocompatible 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 syntax on " Global keybindings noremap :setlocal spell! spelllang=en noremap :setlocal spell! spelllang=es noremap !!$SHELL noremap :bn noremap :bd noremap :w noremap 5< noremap 5> noremap H :nohl noremap za noremap N /@@@ " calcurse autocmd BufNewFile,BufRead /tmp/calcurse* set filetype=markdown " groff autocmd FileType groff noremap :!zathura --fork %:r.pdf & disown autocmd FileType groff noremap :w :!groffc % 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 " Wiki autocmd FileType vimwiki noremap :w :VimwikiAll2HTML autocmd FileType vimwiki noremap :!/bin/surf "file://$HOME/.local/share/vimwiki/html/index.html" & " 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() " Custom commands command SourceVimrc :source ~/.config/vim/vimrc " 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-scripts/AutoComplPop' Plug 'vim-airline/vim-airline' Plug 'jiangmiao/auto-pairs' Plug 'tpope/vim-commentary' Plug 'Yggdroot/indentLine' Plug 'preservim/nerdtree' Plug 'junegunn/goyo.vim' Plug 'mhinz/vim-signify' Plug 'ibhagwan/fzf-lua' Plug 'morhetz/gruvbox' Plug 'instant-markdown/vim-instant-markdown' "Plug 'dracula/vim' call plug#end() " Theme let g:gruvbox_contrast_hard=1 let g:gruvbox_italic=1 set background=dark colorscheme gruvbox " AutoComplPop inoremap pumvisible() ? "" : "" set completeopt=menuone,longest set complete+=kspell " 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 " NERDTree nnoremap :NERDTreeToggle " Goyo map gy :Goyo autocmd! User GoyoLeave highlight Normal ctermbg=NONE " IndentLine let g:indentLine_enabled = 1 let g:indentLine_char = '|' " fzf-lua noremap :FzfLua git_branches noremap :FzfLua git_commits noremap :FzfLua git_status noremap :FzfLua files noremap gb :FzfLua git_branches noremap gs :FzfLua git_status noremap gf :FzfLua files " Signify let g:signify_disable_by_default = 1 highlight SignColumn ctermbg=NONE noremap gd :SignifyToggle " Vimwiki let g:vimwiki_list = [{'path': '~/Documents/', 'path_html': '~/.local/share/vimwiki/html/'}] " Instant Markdown let g:instant_markdown_autostart = 0 autocmd FileType markdown noremap :InstantMarkdownPreview let g:instant_markdown_browser = "firefox --new-window" let g:instant_markdown_mathjax = 1 let g:instant_markdown_mermaid = 1