From 58daf17e796790db8c7dde7862d1bc007d4c2677 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Fri, 13 May 2022 18:37:36 +0200 Subject: [PATCH] vim:keys: Add fugitive version of `gcd` Add a fugitive version of the `gcd` mapping to jump to the root of the repo. --- .config/vim/vimrc.d/40-keys.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index 4aa57b5..6cd0a02 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -126,8 +126,11 @@ nmap gu :!git checkout -- % if exists('g:loaded_fugitive') " Using fugitive.vim, start a commit and open the message in a new split nmap gc :G commit + " Move to root of directory + nmap gcd :Gcd else - " only works if a file is already opened + " Move to root of directory + " NOTE: only works if a file is already opened nnoremap gcd :cd %:h cd `git rev-parse --show-toplevel` endif