" 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//,. " Preferences let mapleader = "\" set list listchars=tab:⎸\ ,trail:~ set clipboard=unnamedplus set gp=git\ grep\ -n 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 autoread set wildmenu set hlsearch set swapfile set undofile set mouse=a set showcmd set number syntax on if (empty($TMUX) && getenv('TERM_PROGRAM') != 'Apple_Terminal') if (has("nvim")) let $NVIM_TUI_ENABLE_TRUE_COLOR=1 endif if (has("termguicolors")) set termguicolors endif endif " Keybinds noremap :setlocal spell! spelllang=en noremap :setlocal spell! spelllang=es noremap :TagbarToggle noremap !!$SHELL noremap :bn noremap :bd noremap :w noremap 5< noremap 5- noremap 5+ noremap 5> noremap H :nohl noremap za autocmd BufWinLeave *.* mkview autocmd BufWinEnter *.* silent loadview " QuickFix autocmd QuickFixCmdPost [^l]* nested cwindow autocmd QuickFixCmdPost l* nested lwindow autocmd QuickFixCmdPost * if &ft ==# 'qf' | wincmd J | endif function! WrapQuickfixNext() try execute 'cnext' catch /^Vim\%((\a\+)\)\=:E553/ cfirst endtry endfunction function! WrapQuickfixPrev() try execute 'cprevious' catch /^Vim\%((\a\+)\)\=:E553/ clast endtry endfunction nnoremap n :call WrapQuickfixNext() nnoremap p :call WrapQuickfixPrev() nnoremap m :make nnoremap :make " c/c++ autocmd FileType c :compiler gcc | setlocal makeprg=gcc\ -Wall\ -c\ % autocmd FileType cpp :compiler gcc | setlocal makeprg=g++\ -Wall\ -c\ % " Go autocmd FileType go setlocal tabstop=8 shiftwidth=8 noexpandtab " groff autocmd FileType troff noremap :!zathura --fork %:r.pdf & disown autocmd FileType troff noremap :w :!grofftex % " Python autocmd FileType python noremap :!python % function! SetMakeprg() if filereadable('Makefile') set makeprg=make else endif endfunction autocmd VimEnter * call SetMakeprg() " Functions "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 "bot sp term://bash" execute "resize -8" 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')) 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 'norcalli/nvim-colorizer.lua' Plug 'vim-scripts/AutoComplPop' Plug 'vim-airline/vim-airline' Plug 'ryanoasis/vim-devicons' Plug 'airblade/vim-gitgutter' Plug 'rhysd/vim-clang-format' Plug 'jiangmiao/auto-pairs' Plug 'tpope/vim-commentary' Plug 'Yggdroot/indentLine' Plug 'preservim/nerdtree' Plug 'godlygeek/tabular' Plug 'Gavinok/vim-troff' Plug 'ibhagwan/fzf-lua' Plug 'preservim/tagbar' " Plug 'morhetz/gruvbox' Plug 'sainnhe/gruvbox-material' Plug 'jceb/vim-orgmode' Plug 'mikelue/vim-maven-plugin' call plug#end() " gruvbox-material set background=dark let g:gruvbox_material_background = 'hard' colorscheme gruvbox-material " AutoComplPop inoremap pumvisible() ? "" : "" set completeopt=menuone,longest set complete+=kspell " Airline let g:airline#extensions#tabline#buffer_min_count = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline_powerline_fonts = 1 set ttimeout ttimeoutlen=0 set laststatus=2 set noshowmode " NERDTree nnoremap :NERDTreeToggle " 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 " git-gutter highlight GitGutterChange guifg=#7daea3 ctermfg=3 highlight GitGutterDelete guifg=#ea6962 ctermfg=1 highlight GitGutterAdd guifg=#a9b665 ctermfg=2 highlight SignColumn guibg=NONE ctermbg=NONE let g:gitgutter_set_sign_backgrounds = 1 noremap gd :GitGutterToggle set signcolumn=yes set updatetime=100 " vim-clang-format let g:clang_format#code_style = 'llvm'