2020-12-06 02:29:15 +01:00
|
|
|
|
"""" Leader shortcuts
|
|
|
|
|
let mapleader = ","
|
|
|
|
|
" also use space as leader
|
2021-04-11 18:50:02 +02:00
|
|
|
|
map <Space> <leader>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
|
|
|
|
nmap <leader>w :w!<CR>
|
|
|
|
|
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
|
|
|
|
|
" nmap <leader>W :w!<CR>
|
|
|
|
|
|
|
|
|
|
"Reload vimrc on config change
|
|
|
|
|
map <leader>e :e! ~/.vimrc<CR>
|
2021-03-14 15:50:16 +01:00
|
|
|
|
map <leader>ef :e! $DOTFILES/vim/functions.vim<CR>
|
|
|
|
|
map <leader>ec :e! $DOTFILES/vim/plugins_config.vim<CR>
|
|
|
|
|
map <leader>es :e! $DOTFILES/vim/shortcuts.vim<CR>
|
2021-03-15 10:30:39 +01:00
|
|
|
|
map <leader>ep :e! $DOTFILES/vim/plugs.vim<CR>
|
2021-03-14 15:50:16 +01:00
|
|
|
|
|
2020-12-06 02:29:15 +01:00
|
|
|
|
autocmd! bufwritepost ~/.vimrc source ~/.vimrc
|
2020-12-07 13:12:20 +01:00
|
|
|
|
autocmd! bufwritepost $DOTFILES/vim/* source ~/.vimrc
|
2021-03-15 10:30:39 +01:00
|
|
|
|
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugInstall
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
|
|
|
|
" Quickly open a markdown buffer for scribble
|
|
|
|
|
map <leader>x :e ~/buffer.md<CR>
|
|
|
|
|
" Toggle paste mode on and off
|
|
|
|
|
nmap <leader>pp :setlocal paste!<CR>
|
|
|
|
|
|
2020-12-06 22:21:13 +01:00
|
|
|
|
" Re-select the text block just pasted
|
|
|
|
|
nnoremap <Leader>vv V`]
|
|
|
|
|
|
2021-09-26 16:02:21 +02:00
|
|
|
|
" Easy tab navigation with <leader>T
|
|
|
|
|
nmap <leader>Tn :tabnext<CR>
|
|
|
|
|
nmap <leader>TN :tabnew<CR>
|
|
|
|
|
nmap <leader>Tp :tabprev<CR>
|
|
|
|
|
nmap <leader>Tc :tabclose<CR>
|
2021-03-14 17:12:41 +01:00
|
|
|
|
|
2020-12-06 02:29:15 +01:00
|
|
|
|
" open quickfix
|
|
|
|
|
nmap <leader>cc :botright cope<CR>
|
2021-03-15 10:35:35 +01:00
|
|
|
|
" open loclist
|
|
|
|
|
nmap <leader>ll :botright lope<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
" close quickfix (also see <leader>C below)
|
|
|
|
|
nmap <leader>cx :hide<CR>
|
|
|
|
|
nmap <leader>co ggVGy:tabnew<CR>:set syntax=qf<CR>pgg
|
|
|
|
|
" next cope error
|
|
|
|
|
map <leader>cn :cn<CR>
|
|
|
|
|
" previous cope error
|
|
|
|
|
map <leader>cp :cp<CR>
|
|
|
|
|
|
2020-12-28 12:16:19 +01:00
|
|
|
|
"disable highlighting for current word
|
|
|
|
|
map <silent> <leader><CR> :noh<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
map <leader>ss :setlocal spell!<CR>
|
|
|
|
|
|
2021-04-11 13:26:50 +02:00
|
|
|
|
nnoremap <leader>m :bel copen<bar>silent make <bar>redraw!<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
nnoremap <leader>wz :call WinZoomToggle()<CR>
|
|
|
|
|
|
|
|
|
|
nnoremap <leader>C :close<CR>
|
|
|
|
|
nnoremap <leader>B :Bclose<CR>
|
2021-09-30 12:41:07 +02:00
|
|
|
|
nnoremap <leader>k :Rg<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
|
|
|
|
"" Fugitive
|
2021-03-14 16:32:19 +01:00
|
|
|
|
nnoremap <leader>/ :0Git<CR>
|
2021-10-01 10:59:30 +02:00
|
|
|
|
nnoremap <leader>g :Git<Space>
|
|
|
|
|
nnoremap <leader>Gd :Gvdiffsplit<CR>
|
|
|
|
|
nnoremap <leader>Gb :Git blame<CR>
|
|
|
|
|
nnoremap <leader>Gp :Git push<CR>
|
|
|
|
|
nnoremap <leader>Gl :vert Git log<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
nnoremap <leader>M :Git commit<CR>
|
2021-10-01 10:59:30 +02:00
|
|
|
|
nnoremap <leader>Gpf :Git push --force-with-lease<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
|
|
|
|
"" Gitutter
|
|
|
|
|
nnoremap <leader>u :GitGutterBufferToggle<CR>
|
|
|
|
|
nnoremap <leader>L :GitGutterLineHighlightsToggle<CR>
|
2020-12-10 01:24:40 +01:00
|
|
|
|
nnoremap <leader>hn :GitGutterNextHunk<CR>
|
|
|
|
|
nnoremap <leader>hp :GitGutterPrevHunk<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
2021-02-19 13:29:15 +01:00
|
|
|
|
"" Coverage Highlight
|
|
|
|
|
nnoremap <leader>H :HighlightCoverageForAll<CR>
|
|
|
|
|
|
|
|
|
|
" Ale
|
2020-12-06 02:29:15 +01:00
|
|
|
|
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
|
|
|
|
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
2021-03-14 15:52:03 +01:00
|
|
|
|
nmap <leader>R :ALERepeatSelection<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
nmap <leader>sv :ALEGoToDefinition -vsplit<CR>
|
|
|
|
|
nmap <leader>sh :ALEGoToDefinition -split<CR>
|
|
|
|
|
nmap <leader>st :ALEGoToDefinition -tab<CR>
|
|
|
|
|
nmap <leader>A :ALEGoToDefinition<CR>
|
2021-03-14 15:52:03 +01:00
|
|
|
|
nmap <leader>n :ALEFindReferences -relative<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
nmap <leader>h :ALEHover<CR>
|
|
|
|
|
nmap <leader>r :ALERename<CR>
|
2021-03-13 15:28:50 +01:00
|
|
|
|
nmap <leader>` :ALELint<CR>
|
2021-09-30 12:41:07 +02:00
|
|
|
|
nmap <leader>F :ALEFix<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
|
|
|
|
map <leader>nn :NERDTreeToggle<CR>
|
|
|
|
|
|
2021-09-30 12:41:07 +02:00
|
|
|
|
"" fzf.vim
|
2020-12-06 02:29:15 +01:00
|
|
|
|
" Quickly find and open a recently opened file
|
2021-09-30 12:41:07 +02:00
|
|
|
|
map <leader>o :Buffers<CR>
|
|
|
|
|
map <leader>j :GFiles<CR>
|
|
|
|
|
map <leader>J :Files<CR>
|
|
|
|
|
|
|
|
|
|
map <leader>f :History<CR>
|
|
|
|
|
map <leader>T :BTags<CR>
|
|
|
|
|
map <leader>t :Tags<CR>
|
|
|
|
|
map <leader>l :Lines<CR>
|
2021-01-15 00:12:13 +01:00
|
|
|
|
map <leader>c :CtrlPQuickfix<CR>
|
2021-09-30 12:41:07 +02:00
|
|
|
|
map <leader>s :Snippets<CR>
|
|
|
|
|
map <leader>; :Commands<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
2021-03-15 10:38:49 +01:00
|
|
|
|
"" CSV
|
|
|
|
|
" highlight current column
|
|
|
|
|
map <leader>hc :HiColumn<CR>
|
|
|
|
|
|
2021-01-07 16:14:41 +01:00
|
|
|
|
"" Indent Guides
|
|
|
|
|
map <leader>I :IndentGuidesToggle<CR>
|
|
|
|
|
|
2021-04-11 13:24:17 +02:00
|
|
|
|
"" Goyo
|
2021-01-09 23:46:30 +01:00
|
|
|
|
nmap <leader>za :Goyo 80%x85%<CR>
|
|
|
|
|
nmap <leader>zz :Goyo<CR>
|
|
|
|
|
|
|
|
|
|
""Misc stuff
|
2021-09-26 17:32:11 +02:00
|
|
|
|
if g:uname == "Darwin"
|
2021-03-13 16:27:09 +01:00
|
|
|
|
"" Mac specific stuff
|
2021-09-26 17:32:11 +02:00
|
|
|
|
elseif g:uname == "Linux"
|
2021-03-13 16:27:09 +01:00
|
|
|
|
"" 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
|
|
|
|
|
|
2021-04-11 18:50:02 +02:00
|
|
|
|
map "+p :<C-U>let @"=substitute(system('wl-paste --no-newline'), '<C-v><C-m>', '', 'g') \| exec 'normal! ' . v:count1 . 'p'<cr>
|
|
|
|
|
map "+P :<C-U>let @"=substitute(system('wl-paste --no-newline'), '<C-v><C-m>', '', 'g') \| exec 'normal! ' . v:count1 . 'P'<cr>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
else
|
2021-03-13 16:27:09 +01:00
|
|
|
|
"" Unknown platform
|
2020-12-06 02:29:15 +01:00
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
" Add shortcuts to yank/paste to unnamed/unnamedplus clipboards
|
2021-05-19 10:39:12 +02:00
|
|
|
|
map <Leader>y "+y
|
|
|
|
|
map <Leader>p "+P
|
|
|
|
|
map <Leader>Y "+y
|
|
|
|
|
map <Leader>P "+P
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
2021-04-11 13:24:17 +02:00
|
|
|
|
" Insert a python breakpoint
|
|
|
|
|
let @b = 'ibreakpoint()
<1B><>a'
|
2020-12-09 00:59:20 +01:00
|
|
|
|
|
|
|
|
|
" visual mode mappings
|
2021-09-26 16:09:47 +02:00
|
|
|
|
vnoremap <silent> <leader>k :call VisualSelection('LAck', '')<CR>
|
2020-12-09 00:59:20 +01:00
|
|
|
|
vnoremap <silent> <leader>gs :call GitShowVisual()<CR>
|
|
|
|
|
vnoremap <silent> <leader>r :call VisualSelection('replace', '')<CR>
|