call plug#begin('~/.local/share/vim/plugged') Plug 'bling/vim-airline' Plug 'ctrlpvim/ctrlp.vim' Plug 'edkolev/tmuxline.vim' " Plug 'ervandew/supertab' Plug 'mhinz/vim-janah' Plug 'mhinz/vim-signify' Plug 'preservim/nerdcommenter' Plug 'preservim/nerdtree' Plug 'dense-analysis/ale' Plug 'tpope/vim-fugitive' Plug 'unblevable/quick-scope' Plug 'vim-airline/vim-airline-themes' if executable('ansible') Plug 'chase/vim-ansible-yaml' endif if executable('terraform') Plug 'hashivim/vim-terraform' endif if executable('python') || executable('python3') Plug 'davidhalter/jedi-vim' " YCM handles completion (async); keep jedi-vim for goto/rename only let g:jedi#completions_enabled = 0 endif if has('python') || has('python3') let g:ycm_install_command = './install.py --clang-completer' if executable('node') && executable('npm') let g:ycm_install_command .= ' --ts-completer' endif if executable('go') let g:ycm_install_command .= ' --go-completer' endif if executable('rustc') let g:ycm_install_command .= ' --rust-completer' endif Plug 'ycm-core/YouCompleteMe', {'do': g:ycm_install_command} endif if has('nvim') Plug 'nvim-lua/plenary.nvim' Plug 'greggh/claude-code.nvim' endif call plug#end() """ DEFAULT VIM SETTINGS " Reload vimrc on save augroup reload_vimrc " { autocmd! autocmd BufWritePost $MYVIMRC source $MYVIMRC augroup END " } let mapleader=" " syntax on filetype plugin indent on " Expand :git to fugitive's :Git, but only as a whole command cnoreabbrev git (getcmdtype() ==# ':' && getcmdline() ==# 'git') ? 'Git' : 'git' " Some vim settings set number set relativenumber set list set modeline set background=dark set foldmethod=indent set listchars=trail:·,tab:▸\ ,eol:¬ set scrolloff=1 set backspace=indent,eol,start set cursorline set hidden set wildmenu " Faster gutter updates (signify) and snappier in terminal vim set updatetime=100 set ttimeoutlen=10 " Persistent undo across sessions if !isdirectory(expand('~/.local/share/vim/undo')) call mkdir(expand('~/.local/share/vim/undo'), 'p', 0700) endif set undofile set undodir=~/.local/share/vim/undo " Set colorscheme when the terminal has 256 color support try if (&t_Co == 256) && match($TERM, "256color") >= 0 " autocmd ColorScheme janah highlight Normal ctermbg=235 colorscheme janah else throw "nocolor" endif catch colorscheme desert endtry " Search-related things set hlsearch "highlight search result set incsearch " incremental search set ignorecase set smartcase " capital letters = case sensitive " Disable ex mode nnoremap Q " Save as sudo (abbreviation, so a plain :w never stalls on timeoutlen) " Note: doesn't work in neovim (sudo can't prompt for a password there); " use a suda.vim-style plugin if needed. cnoreabbrev w!! (getcmdtype() ==# ':' && getcmdline() ==# 'w!!') \ ? 'w !sudo tee > /dev/null %' : 'w!!' " Remove trailing spaces on save, preserving cursor and search pattern function! StripTrailingWhitespace() if index(['markdown', 'diff'], &filetype) >= 0 return endif let l:view = winsaveview() keeppatterns %s/\s\+$//e call winrestview(l:view) endfunction augroup strip_whitespace autocmd! autocmd BufWritePre * call StripTrailingWhitespace() augroup END " Switch windows with nnoremap j nnoremap k nnoremap h nnoremap l " Never use the arrow keys inoremap inoremap inoremap inoremap noremap noremap noremap noremap " Append modeline when pressing ml function! AppendModeline() let l:modeline = printf(" vim: set ts=%d sw=%d tw=%d %set :", \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') let l:modeline = substitute(&commentstring, "%s", l:modeline, "") call append(line("$"), l:modeline) endfunction nnoremap ml :call AppendModeline() " NeoVIM specifics if has('nvim') nnoremap h " tnoremap augroup nvim_term autocmd! autocmd TermOpen * setlocal nolist augroup END lua require('claude-code').setup({ window = { position = 'vertical botright' } }) endif """ PLUGIN SPECIFIC SETTINGS if exists("g:plug_home") " NERDTree: " Open NERDTree when no file is specified; quit when it's the last window augroup nerdtree_auto autocmd! autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif autocmd BufEnter * if winnr('$') == 1 && &filetype ==# 'nerdtree' | quit | endif augroup END " CtrlP: " Use ripgrep for listing files (fast, respects .gitignore) if executable('rg') let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""' let g:ctrlp_use_caching = 0 endif " NERDCommenter: " Pretty comments let g:NERDSpaceDelims = 1 let g:NERDCompactSexyComs = 1 let g:NERDDefaultAlign = 'left' let g:NERDCommentEmptyLines = 1 let g:NERDTrimTrailingWhitespace = 1 " Airline: " On arch linux install the following: " otf-powerline-symbols-git " powerline-fonts-git let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 if !exists('g:airline_symbols') let g:airline_symbols = {} endif let g:airline_symbols.space = "\ua0" set laststatus=2 if exists('g:ycm_install_command') let g:ycm_autoclose_preview_window_after_completion = 1 let g:ycm_autoclose_preview_window_after_insertion = 1 endif endif " vim: set ts=8 sw=4 tw=0 et :