"""" Leader shortcuts let mapleader = "," " also use space as leader map nmap w :w! command! W execute 'w !sudo tee % > /dev/null' edit! " nmap W :w! "Reload vimrc on config change map e :e! ~/.vimrc map ef :e! $DOTFILES/vim/functions.vim map ec :e! $DOTFILES/vim/plugins_config.vim map es :e! $DOTFILES/vim/shortcuts.vim map ep :e! $DOTFILES/vim/plugs.vim autocmd! bufwritepost ~/.vimrc source ~/.vimrc autocmd! bufwritepost $DOTFILES/vim/* source ~/.vimrc autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugInstall " Quickly open a markdown buffer for scribble map x :e ~/buffer.md " Toggle paste mode on and off nmap pp :setlocal paste! " Re-select the text block just pasted nnoremap vv V`] " Easy tab navigation with T nmap Tn :tabnext nmap TN :tabnew nmap Tp :tabprev nmap Tc :tabclose " open quickfix nmap cc :botright cope " open loclist nmap ll :botright lope " close quickfix (also see C below) nmap cx :hide nmap co ggVGy:tabnew:set syntax=qfpgg " next cope error map cn :cn " previous cope error map cp :cp "disable highlighting for current word map :noh map ss :setlocal spell! nnoremap m :bel copensilent make redraw! nnoremap wz :call WinZoomToggle() nnoremap C :close nnoremap B :Bclose nnoremap k :LAck "" Fugitive nnoremap / :0Git nnoremap G :Git nnoremap gd :Git vdiffsplit nnoremap gb :Git blame nnoremap gp :Git push nnoremap gl :vert Git log nnoremap M :Git commit nnoremap gpf :Git push --force-with-lease "" Gitutter nnoremap u :GitGutterBufferToggle nnoremap L :GitGutterLineHighlightsToggle nnoremap hn :GitGutterNextHunk nnoremap hp :GitGutterPrevHunk "" Coverage Highlight nnoremap H :HighlightCoverageForAll " Ale nmap (ale_previous_wrap) nmap (ale_next_wrap) nmap R :ALERepeatSelection nmap sv :ALEGoToDefinition -vsplit nmap sh :ALEGoToDefinition -split nmap st :ALEGoToDefinition -tab nmap A :ALEGoToDefinition nmap n :ALEFindReferences -relative nmap h :ALEHover nmap r :ALERename nmap ` :ALELint map nn :NERDTreeToggle "" CtrlP " Quickly find and open a recently opened file map o :CtrlPBuffer map j :call fzf#run({'sink': 'edit', 'options': '--preview="BAT_STYLE=header,changes bat --color=always {}"', 'down': '40%'}) map f :CtrlPMRUFiles map T :CtrlPBufTag map t :CtrlPTag map l :CtrlPLine map c :CtrlPQuickfix "" CSV " highlight current column map hc :HiColumn "" Indent Guides map I :IndentGuidesToggle "" Goyo nmap za :Goyo 80%x85% nmap zz :Goyo ""Misc stuff if g:uname == "Darwin" "" Mac specific stuff elseif g:uname == "Linux" "" Linux specific stuff function! s:WaylandYank() if v:event['regname'] == '+' || (v:event['regname'] == 'w' && s:plus_to_w) call system('wl-copy', getreg(v:event['regname'])) endif endfunction " run s:WaylandYank() after every time text is yanked augroup waylandyank autocmd! autocmd TextYankPost * call s:WaylandYank() augroup END map "+p :let @"=substitute(system('wl-paste --no-newline'), '', '', 'g') \| exec 'normal! ' . v:count1 . 'p' map "+P :let @"=substitute(system('wl-paste --no-newline'), '', '', 'g') \| exec 'normal! ' . v:count1 . 'P' else "" Unknown platform endif " Add shortcuts to yank/paste to unnamed/unnamedplus clipboards map y "+y map p "+P map Y "+y map P "+P " Insert a python breakpoint let @b = 'ibreakpoint() €ưa' " visual mode mappings vnoremap k :call VisualSelection('LAck', '') vnoremap gs :call GitShowVisual() vnoremap r :call VisualSelection('replace', '')