" General Settings filetype plugin on " Enable default plugins set nocompatible " Disable vi-compatible set wildmenu " Enable autocomple menu set incsearch " Show search results as typing string set hlsearch " Highlight matches to previos search string set expandtab " In Insert mode: Use the appropriate number of spaces to insert . set tabstop=4 "Number of spaces that a counts for set shiftwidth=0 " Make shiftwidth value the same as tabstop set relativenumber " Use relative numbers in the side bar set nowrap " Turn off text wrapping long lines set history=1000 " Set number of ':' commands set wildmode=list:full " wildmenu show list complete to first result set splitright " New windows split to the right of current one set splitbelow " New windows split below the current one set completeopt-=preview " Hide the preview/scratch window " Custom status line set statusline= set statusline+=%1*\ %02c\ " Color set statusline+=%2*\ » " RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK set statusline+=%3*\ %<%F\ " File+path set statusline+=%2*\« " LEFT-POINTING DOUBLE ANGLE QUOTATION MARK set statusline+=%2*\ %=\ %l/%L\ (%02p%%)\ " Rownumber/total (%) " Set spacing of filetypes autocmd FileType sh,python setlocal tabstop=4 autocmd FileType make setlocal tabstop=4 noexpandtab autocmd FileType ledger setlocal tabstop=2 autocmd FileType vim setlocal tabstop=2 " Setup colorscheme syntax enable colorscheme gruvbox " Set the colorscheme set background=dark " Use dark colorscheme " Set vimdiff colors, make it easier to read highlight DiffAdd cterm=BOLD ctermfg=NONE ctermbg=22 highlight DiffDelete cterm=BOLD ctermfg=NONE ctermbg=52 highlight DiffChange cterm=BOLD ctermfg=NONE ctermbg=23 highlight DiffText cterm=BOLD ctermfg=NONE ctermbg=23 " Highlight lines at 80 mark/120 mark highlight ColorColumn ctermbg=cyan autocmd FileType python call matchadd('ColorColumn', '\%81v', 100) autocmd FileType python call matchadd('Error', '\%121v', 100) " Neovim (Docker) vs Vim if has('nvim') let $HOME='/root/.vimcache' let $EditorDir='/root/.config/nvim/' let $SessionDir='.vimcache' silent! execute '!mkdir -p .vimcache/backup' else let $EditorDir=$HOME.'/.vim/' let $SessionDir='.' endif " My Shorcuts let mapleader="\" " type jj to get out of insert mode inoremap jj " Ctags for python project command! MakeTagsPython !ctags --languages=python --python-kinds=-i -R . " Command for figuring out highlight group map hi :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#") " Turn off syntax highlighting nnoremap :noh " New tab nnoremap t :tabnew " Visually select pasted text nnoremap gp `[v`] " Vimdiff commands nnoremap du :diffupdate nnoremap dd :diffget nnoremap df :diffput nnoremap _ [c nnoremap = ]c " Visually select line without ending nnoremap v ^v$h " Some very useful shortcuts for editing Ledger entries " Copy the last entry nnoremap ll G{jV}y}p10l " Copy the current entry to the bottom, copy date from last entry nnoremap lb {jV}yGp10l{{jvEy}jvEpl " Copy the current entry to the next position nnoremap ln {jV}y}p10l " Jump down from line to replace dollar ammount nnoremap ld j^f$lC " After searching pull entry to current position nnoremap ly vapyp{{jvEy}jvEpl " Accept current autocomplete suggestion inoremap pumvisible() ? "\" : "\" "----------------------------------------------------------------------------------------------------------------------- " Ack Searching "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/ack.vim/plugin/ack.vim')) nnoremap / :call AckSearch() noremap ea :Ack function! AckSearch() call inputsave() let term = input('Search: ') call inputrestore() if !empty(term) execute "Ack! " . term endif endfunction " Setting better default settings let g:ackprg = \ "ack -s -H --nocolor --nogroup --column --ignore-dir=.venv/ --ignore-dir=.vimcache/ --ignore-dir=migrations/ --ignore-dir=.mypy_cache/ --ignore-file=is:tags --nojs --nocss --nosass" endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " Argwrap "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-argwrap/plugin/argwrap.vim')) nnoremap ew :ArgWrap endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " Fugitive "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-fugitive/plugin/fugitive.vim')) " Command for toggling git status function! ToggleGStatus() if buflisted(bufname('.git/index')) bd .git/index else Gstatus endif endfunction command ToggleGStatus :call ToggleGStatus() nnoremap gs :ToggleGStatus nnoremap gc :Gcommit --verbose nnoremap gd :Gdiff endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " fzf.vim "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/fzf.vim/plugin/fzf.vim')) nnoremap ff :Files nnoremap fb :Buffers nnoremap ft :Tags nnoremap fm :Marks nnoremap fc :Commits nnoremap fg :GFiles? endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " Indent Guides "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-indent-guides/plugin/indent_guides.vim')) let g:indent_guides_enable_on_vim_startup = 1 let g:indent_guides_auto_colors = 0 let g:indent_guides_exclude_filetypes =['help', 'nerdtree'] let g:indent_guides_start_level = 2 let g:indent_guides_guide_size = 1 autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=235 autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=237 autocmd FileType python :IndentGuidesEnable autocmd FileType html :IndentGuidesEnable autocmd FileType jinja :IndentGuidesEnable endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " Taboo "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/taboo.vim/plugin/taboo.vim')) function! RenameTab() call inputsave() let term = input('Tabname: ') call inputrestore() if !empty(term) execute ":TabooRename " . term endif endfunction nnoremap er :call RenameTab() endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " Ale "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/ale/autoload/ale.vim')) let g:ale_lint_on_enter = 0 let g:ale_sign_column_always = 1 let g:ale_lint_on_text_changed = 'never' let g:ale_python_mypy_options='--ignore-missing-imports' let g:ale_history_enabled = 0 highlight clear ALEErrorSign highlight clear ALEWarningSign " Change gutter color highlight SignColumn cterm=NONE ctermfg=0 ctermbg=None endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " RainbowParentheses "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/rainbow_parentheses.vim/plugin/rainbow_parentheses.vim')) au VimEnter * RainbowParenthesesToggle au Syntax * RainbowParenthesesLoadRound au Syntax * RainbowParenthesesLoadSquare au Syntax * RainbowParenthesesLoadBraces let g:rbpt_colorpairs = [ \ ['brown', 'RoyalBlue3'], \ ['darkblue', 'DarkOrchid3'], \ ['red', 'firebrick3'], \ ['magenta', 'SeaGreen3'], \ ['yellow', 'SeaGreen3'], \ ['blue', 'DarkOrchid3'], \ ['gray', 'firebrick3'], \ ['cyan', 'DarkOrchid3'], \ ['darkred', 'firebrick3'], \ ['brown', 'RoyalBlue3'], \ ['gray', 'firebrick3'], \ ['darkgreen', 'RoyalBlue3'], \ ['red', 'SeaGreen3'], \ ['darkcyan', 'DarkOrchid3'], \ ['green', 'RoyalBlue3'], \ ] endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " Pymode "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/python-mode/plugin/pymode.vim')) let g:pymode_run = 1 let g:pymode_indent = 1 let g:pymode_motion = 1 let g:pymode_options_colorcolumn = 0 let g:pymode_lint = 0 let g:pymode_rope = 0 let g:pymode_doc = 0 let g:pymode_breakpoint = 0 let g:pymode_lint = 0 let g:pymode_folding = 0 let g:pymode_motion = 0 " Disable error when using fzf to switch files endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " Ranger Intergration "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/ranger.vim/plugin/ranger.vim')) let g:ranger_map_keys = 0 nnoremap n :Ranger let g:ranger_replace_netrw = 1 " open ranger when vim open a directory endif "----------------------------------------------------------------------------------------------------------------------- "----------------------------------------------------------------------------------------------------------------------- " Jinja Highlighting "----------------------------------------------------------------------------------------------------------------------- if !empty(glob($EditorDir.'plugged/vim-jinja2-syntax/indent/jinja.vim')) au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm set ft=jinja endif "-----------------------------------------------------------------------------------------------------------------------