2020-12-06 02:29:15 +01:00
|
|
|
|
"""" Leader shortcuts
|
2023-01-19 17:33:11 +01:00
|
|
|
|
let mapleader = ','
|
2020-12-06 02:29:15 +01:00
|
|
|
|
" 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>
|
|
|
|
|
|
2024-06-19 12:08:25 +02:00
|
|
|
|
" config editing
|
|
|
|
|
map <leader>e :vsplit ~/.vimrc<CR>
|
|
|
|
|
map <leader>ef :vsplit $DOTFILES/vim/functions.vim<CR>
|
|
|
|
|
map <leader>ec :vsplit $DOTFILES/vim/plugins_config.vim<CR>
|
|
|
|
|
map <leader>es :vsplit $DOTFILES/vim/shortcuts.vim<CR>
|
|
|
|
|
map <leader>ep :vsplit $DOTFILES/vim/plugs.vim<CR>
|
2021-03-14 15:50:16 +01:00
|
|
|
|
|
2020-12-06 02:29:15 +01:00
|
|
|
|
" Quickly open a markdown buffer for scribble
|
|
|
|
|
map <leader>x :e ~/buffer.md<CR>
|
2022-02-07 21:08:04 +01:00
|
|
|
|
map <leader>xx :e ~/projects/work/buffer.md<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
" 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-12-08 23:53:46 +01:00
|
|
|
|
nmap <C-W>n :tabnext<CR>
|
|
|
|
|
nmap <C-W>p :tabprev<CR>
|
|
|
|
|
nmap <C-W>N :tabnew<CR>
|
2021-03-14 17:12:41 +01:00
|
|
|
|
|
2023-12-28 16:23:18 +01:00
|
|
|
|
" move betweween functions/methods/classes definition,
|
|
|
|
|
" [m moves to the start of the previous method, ]m to the start of the next
|
|
|
|
|
" zz centers the result
|
2023-11-22 12:52:22 +01:00
|
|
|
|
map <Leader>] ]mzz
|
|
|
|
|
map <Leader>[ [mzz
|
|
|
|
|
|
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
|
2024-01-16 11:52:42 +01:00
|
|
|
|
map <leader>N :cnext<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
" previous cope error
|
2024-01-16 11:52:42 +01:00
|
|
|
|
map <leader>P :cprevious<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
2024-06-08 18:27:40 +02:00
|
|
|
|
"disable highlighting current search word
|
2020-12-28 12:16:19 +01:00
|
|
|
|
map <silent> <leader><CR> :noh<CR>
|
2022-11-26 00:52:01 +01:00
|
|
|
|
map <leader>S :setlocal spell!<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
2021-12-13 00:41:03 +01: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>
|
|
|
|
|
|
2022-03-26 16:36:26 +01:00
|
|
|
|
nnoremap <leader>q :close<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
nnoremap <leader>B :Bclose<CR>
|
2023-09-14 23:00:44 +02:00
|
|
|
|
nnoremap <leader>Q :close!<CR>
|
2021-09-30 12:41:07 +02:00
|
|
|
|
nnoremap <leader>k :Rg<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
|
|
|
|
"" Fugitive
|
2022-11-26 00:52:01 +01:00
|
|
|
|
nnoremap <leader>/ :vert Git<CR>
|
2021-12-09 10:43:05 +01:00
|
|
|
|
nnoremap <leader>\ :0Git<CR>
|
2022-02-07 21:08:04 +01:00
|
|
|
|
nnoremap <leader>d :Gvdiffsplit<CR>
|
|
|
|
|
nnoremap <leader>b :Git blame<CR>
|
2022-08-12 15:52:55 +02:00
|
|
|
|
nnoremap <leader>gp :Git push<CR>
|
2022-12-21 13:54:02 +01:00
|
|
|
|
nnoremap <leader>gl :Commits<CR>
|
|
|
|
|
nnoremap <leader>gL :BCommits<CR>
|
2022-08-12 15:52:55 +02:00
|
|
|
|
nnoremap <leader>gc :Git commit<CR>
|
|
|
|
|
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>
|
2021-12-09 10:43:05 +01:00
|
|
|
|
nnoremap <leader>gp :GitGutterPrevHunk<CR>
|
|
|
|
|
nnoremap <leader>gn :GitGutterNextHunk<CR>
|
2022-08-12 15:52:55 +02:00
|
|
|
|
nnoremap <leader>gs :GitGutterStageHunk<CR>
|
|
|
|
|
nnoremap <leader>gu :GitGutterUndoHunk<CR>
|
2021-12-09 10:43:05 +01:00
|
|
|
|
|
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>
|
2022-03-31 19:30:11 +02:00
|
|
|
|
nmap <leader>n :ALEFindReferences -quickfix <bar> copen<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>
|
2023-01-17 13:57:14 +01:00
|
|
|
|
nmap <leader>D :ALEToggle<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>
|
2022-08-12 15:52:55 +02:00
|
|
|
|
map <leader>l :Lines<CR>
|
2022-02-07 21:08:04 +01:00
|
|
|
|
" FIXME: Not using CtrlP anymore, replace this with fzf
|
|
|
|
|
""map <leader>c :CtrlPQuickfix<CR>
|
2021-09-30 12:41:07 +02:00
|
|
|
|
map <leader>s :Snippets<CR>
|
|
|
|
|
map <leader>; :Commands<CR>
|
2021-12-13 00:41:03 +01:00
|
|
|
|
map <leader>m :Maps<CR>
|
2020-12-06 02:29:15 +01:00
|
|
|
|
|
2021-01-07 16:14:41 +01:00
|
|
|
|
"" Indent Guides
|
|
|
|
|
map <leader>I :IndentGuidesToggle<CR>
|
2021-12-09 10:19:36 +01:00
|
|
|
|
map <leader>i :set cursorcolumn!<CR>
|
2021-01-07 16:14:41 +01:00
|
|
|
|
|
2021-04-11 13:24:17 +02:00
|
|
|
|
"" Goyo
|
2021-01-09 23:46:30 +01:00
|
|
|
|
nmap <leader>zz :Goyo<CR>
|
|
|
|
|
|
2022-12-23 12:12:25 +01:00
|
|
|
|
""" Tagbar
|
|
|
|
|
nmap <F8> :TagbarToggle<CR>
|
|
|
|
|
|
2021-01-09 23:46:30 +01:00
|
|
|
|
""Misc stuff
|
2023-01-19 17:33:11 +01:00
|
|
|
|
if g:uname ==? 'Darwin'
|
2021-03-13 16:27:09 +01:00
|
|
|
|
"" Mac specific stuff
|
2023-01-19 17:33:11 +01:00
|
|
|
|
elseif g:uname ==? 'Linux'
|
2021-03-13 16:27:09 +01:00
|
|
|
|
"" Linux specific stuff
|
2023-09-14 13:07:36 +02:00
|
|
|
|
xnoremap "+y y:call system("wl-copy", @")<cr>
|
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>
|
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
|
2024-03-21 14:55:06 +01:00
|
|
|
|
map <Leader>p "+p
|
2021-11-16 14:34:46 +01:00
|
|
|
|
map <Leader>yp <Plug>yankstack_substitute_older_paste
|
|
|
|
|
map <leader>yn <Plug>yankstack_substitute_newer_paste
|
|
|
|
|
|
2021-04-11 13:24:17 +02:00
|
|
|
|
" Insert a python breakpoint
|
2021-11-16 14:36:26 +01:00
|
|
|
|
let @b = 'obreakpoint(<28>kr<1B><>a0j'
|
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>
|
2022-01-25 10:52:22 +01:00
|
|
|
|
|
|
|
|
|
nnoremap K :exe "Rg " . expand("<cword>")<cr>
|
2022-03-31 19:30:31 +02:00
|
|
|
|
nnoremap GL :exe "Git log -L:" . expand("<cword>") . ":" . expand("%")<cr>
|
2022-02-07 21:08:04 +01:00
|
|
|
|
autocmd FileType python nnoremap T :Pytest function --pdb<CR>
|
2022-01-25 10:55:42 +01:00
|
|
|
|
|
|
|
|
|
" Ultisnips
|
|
|
|
|
map <Leader>ue :UltiSnipsEdit<cr>
|
2023-09-14 23:06:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nmap <F5> <ESC>:Gradle assembleDebug<CR>
|
|
|
|
|
nmap <F6> <ESC>:AndroidInstall debug<CR>
|
|
|
|
|
nmap <F7> <ESC>:AndroidLaunch debug<CR>
|