call plug#begin() Plug 'tpope/vim-fugitive' Plug 'simnalamburt/vim-mundo' Plug 'easymotion/vim-easymotion' Plug 'vim-scripts/Align' Plug 'neomake/neomake' | Plug 'dojoteef/neomake-autolint' Plug 'Shougo/neosnippet.vim' | Plug 'Shougo/neosnippet-snippets' Plug 'Shougo/deoplete.nvim' Plug 'Shougo/denite.nvim' | Plug 'Shougo/neoyank.vim' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' Plug 'junegunn/vim-easy-align' Plug 'dietsche/vim-lastplace' Plug 'itchyny/lightline.vim' Plug 'jacoborus/tender.vim' Plug 'ciaranm/inkpot' Plug 'twerth/ir_black' Plug 'rodjek/vim-puppet' Plug 'vim-ruby/vim-ruby' Plug 'kchmck/vim-coffee-script' call plug#end() " Because. noremap : let mapleader = "," nnoremap :MundoToggle " +(s)earch, (w)ord for jumping "noremap fs :w "noremap qq :q "noremap qa :qa "noremap ff :Files "noremap pf :GFiles "noremap bb :Buffers noremap f :Files noremap F :Files %:p:h noremap v :GFiles " TODO I'd like to merge the history / buffers list noremap b :Buffers noremap h :History noremap gc :Commits noremap gb :BCommits noremap c :ChangeDir "noremap u :FufRenewCache "noremap w :bdelete noremap :Helptags " Edit a file in the same directory as the current buffer noremap e :e %:p:h/ " --column: Show column number " --line-number: Show line number " --no-heading: Do not show file headings in results " --fixed-strings: Search term as a literal string " --ignore-case: Case insensitive search " --no-ignore: Do not respect .gitignore, etc... " --hidden: Search hidden files and folders " --follow: Follow symlinks " --glob: Additional conditions for search (in this case ignore everything in the .git/ folder) " --color: Search color options command! -bang -nargs=* Rg call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "always" '.shellescape(), 1, 0) noremap / :Rg "noremap / :Rg function s:get_buffer_git_root(...) let root = fugitive#repo().tree(expand('%:p:h')) if empty(root) return s:warn('Not in git repo') endif return fzf#run('bfiles', { \ 'source': 'git ls-files', \ 'dir': root, \ 'options': '-m --prompt "GitFiles> "' \}, a:000) endfunction command! -bar -bang BFiles \ call s:get_buffer_git_root(0) function! s:changedir(...) return s:fzf('changedir', { \ 'source': 'find ~ -type d -print', \ 'options': '-m --prompt "Dir> "' \}, a:000) endfunction command! -bar -bang ChangeDir \ call fzf#run(fzf#wrap('changedir', { \ 'dir': '~', \ 'source': 'find . -type d', \ 'sink': 'cd' \ }, 0)) " 24-bit blue/orange theme colorscheme tender let g:lightline = { \ 'colorscheme': 'tenderplus', \ 'component': { \ 'lineinfo': '0x%02B:%03l:%-2v' \ }, \ 'separator': { 'left': '', 'right': '' }, \ 'subseparator': { 'left': '', 'right': '' } \ } noremap tn :color tender noremap ip :color inkpot noremap ir :color ir_black noremap fed :e ~/.config/nvim/init.vim " TODO quickfix for ripgrep results " TODO quickfix for autolint and rake stuff " Only lint when leaving insert or changing text in command mode let g:neomake_autolint_events = { \ 'InsertLeave': {'delay': 0}, \ 'TextChanged': {}, \ } let g:deoplete#enable_at_startup = 1 " Start interactive EasyAlign in visual mode (e.g. vipga) xmap ga (EasyAlign) " Undo files in undodir=~/.local/share/nvim/undo/ " Backup files in backupdir=~/.local/share/nvim/backup/ set undofile " Allow unwritten buffers to be hidden set hidden " Enable live preview of replace set inccommand=split " Copy between instances let g:neoyank#file = $HOME.'/.local/share/nvim/yankring.txt' nmap :Denite neoyank "vmap y :'<,'>! cat \| tee ~/.local/share/nvim/yank.txt "nmap p o:.!cat ~/.local/share/nvim/yank.txt " ^n Show number and fold columns in windows {{{2 if has("eval") function! FoldNumbers() " If we're in a wide window, enable line numbers. "if winwidth(0) >= 76 " 72 + 4, or should I use tw? " Add folds, or cycle through number schemes if &foldlevel < 99 && &foldenable && &foldcolumn == 0 setlocal foldcolumn=1 elseif (&foldlevel == 99 || ! &foldenable) && &foldcolumn != 0 setlocal foldcolumn=0 elseif ! &rnu && ! &nu setlocal relativenumber elseif &rnu setlocal number setlocal norelativenumber elseif &nu setlocal nonumber endif "else " setlocal norelativenumber " setlocal nonumber " setlocal foldcolumn=0 "endif endfun "autocmd WinEnter,BufWinEnter,BufNew * :call FoldNumbers() noremap :call FoldNumbers() endif " Case insensitivity for searching set ignorecase set infercase " Indentation set expandtab set tabstop=2 set shiftwidth=2 set smartindent " More sane directory completion set wildmode=longest,list,full set wildignorecase " C-c and are not entirely the same, but I want them to be inoremap " Scrolling with arrows controls the window noremap noremap " Movement between windows with ^hjkl nmap h nmap h nmap j nmap k nmap l " Insert pry line noremap pry orequire'pry';binding.pry noremap PRY Orequire'pry';binding.pry " Clear search highlights nnoremap :noh " Show tabs and trailing whitespace visually {{{2 set list listchars=tab:»·,trail:·,extends:…,nbsp:‗