diff --git a/vim/.vim/findgitroot.sh b/vim/.vim/findgitroot.sh new file mode 100755 index 0000000..834b591 --- /dev/null +++ b/vim/.vim/findgitroot.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +while true; do + [[ "$(pwd)" == "/" ]] && exit 1 + [[ -d "./.git" ]] && break + cd .. +done + +exec $@ diff --git a/vim/.vimrc b/vim/.vimrc index 9073041..62cf95c 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -129,6 +129,11 @@ function! IsModified() endif return '' endfunction + +function! s:tig_status() + !~/.vim/findgitroot.sh "tig status" +endfunction +command! TigStatus call s:tig_status() " }}} " --- ModeColor {{{ @@ -184,6 +189,7 @@ nnoremap rr :call RunCmdVimux() nnoremap rq :call VimuxCloseRunner() nnoremap ; :call AddSemicolon() nnoremap t :g/TODO/ +nnoremap :TigStatus " 0 should find first non blank nmap 0 ^ " Easy buffer switching