vimrc: add new mappings
This commit is contained in:
parent
570c8fe897
commit
7fba3d8bc8
50
vimrc
50
vimrc
|
@ -135,15 +135,49 @@ nnoremap <silent> <leader>1 :set relativenumber!<cr>
|
|||
nnoremap <leader>m :marks<cr>
|
||||
nnoremap <leader>v :vsplit<cr>
|
||||
nnoremap <leader>s :split<cr>
|
||||
" <leader>a* currently conflicts with LspCodeAction
|
||||
|
||||
" Git mappings
|
||||
"
|
||||
" Copy Git permalink to clipboard for either current line or range
|
||||
function! CopyGitURLToLineOrRange() range
|
||||
if a:firstline == a:lastline
|
||||
execute ".GBrowse!"
|
||||
else
|
||||
execute a:firstline . "," . a:lastline . "GBrowse!"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! OpenGitURLToLineOrRange() range
|
||||
if a:firstline == a:lastline
|
||||
execute ".GBrowse"
|
||||
else
|
||||
execute a:firstline . "," . a:lastline . "GBrowse"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <leader>ab :Gblame<cr>
|
||||
nnoremap <leader>as :Gstatus<cr>
|
||||
nnoremap <leader>ac :Commits<cr>
|
||||
nnoremap <leader>ah :GitGutterLineHighlightsToggle<cr>
|
||||
nnoremap <leader>ay :call CopyGitURLToLineOrRange()<cr>
|
||||
nnoremap <leader>ao :call OpenGitURLToLineOrRange()<cr>
|
||||
|
||||
" yank filename of current buffer:
|
||||
nmap <leader>f :let @" = expand("%")<cr>
|
||||
function! CopyToDefaultRegister()
|
||||
let @" = expand("%:p")
|
||||
echom expand("%:p")
|
||||
endfunction
|
||||
nmap <leader>fy :call CopyToDefaultRegister()<cr>
|
||||
" and into + register:
|
||||
nmap <leader>F :let @+ = expand("%")<cr>
|
||||
function! CopyToSystemClipboard()
|
||||
let @* = expand("%:p")
|
||||
let @+ = expand("%:p")
|
||||
echom expand("%:p")
|
||||
endfunction
|
||||
nmap <leader>fY :call CopyToSystemClipboard()<cr>
|
||||
|
||||
" ctrl-v to paste from system clipboard in insert mode:
|
||||
inoremap <c-v> <esc>"*Pa
|
||||
|
||||
function! ToggleQuickFix()
|
||||
if empty(filter(getwininfo(), 'v:val.quickfix'))
|
||||
|
@ -246,16 +280,6 @@ xmap ah <Plug>(GitGutterTextObjectOuterVisual)
|
|||
" vim-fugitive
|
||||
packadd! vim-fugitive " https://github.com/tpope/vim-fugitive.git
|
||||
|
||||
" Copy Git permalink to clipboard for either current line or range
|
||||
function! CopyGitURLToLineOrRange() range
|
||||
if a:firstline == a:lastline
|
||||
execute ".GBrowse!"
|
||||
else
|
||||
execute a:firstline . "," . a:lastline . "GBrowse!"
|
||||
endif
|
||||
endfunction
|
||||
map <leader>u :call CopyGitURLToLineOrRange()<cr>
|
||||
|
||||
" vim-go
|
||||
" Doesn't work in after/ftplugin/go.vim:
|
||||
let g:go_def_mapping_enabled = 0
|
||||
|
|
Loading…
Reference in New Issue