vim:keys: Add fugitive version of <leader>gcd

Add a fugitive version of the `<leader>gcd` mapping to jump to the root
of the repo.
This commit is contained in:
2022-05-13 18:37:36 +02:00
parent 9e18f6db16
commit 58daf17e79

View File

@@ -126,8 +126,11 @@ nmap <leader>gu :!git checkout -- %<CR>
if exists('g:loaded_fugitive') if exists('g:loaded_fugitive')
" Using fugitive.vim, start a commit and open the message in a new split " Using fugitive.vim, start a commit and open the message in a new split
nmap <leader>gc :G commit<CR> nmap <leader>gc :G commit<CR>
" Move to root of directory
nmap <leader>gcd :Gcd<CR>
else else
" only works if a file is already opened " Move to root of directory
" NOTE: only works if a file is already opened
nnoremap <leader>gcd :cd %:h <Bar> cd `git rev-parse --show-toplevel`<CR> nnoremap <leader>gcd :cd %:h <Bar> cd `git rev-parse --show-toplevel`<CR>
endif endif