From 1144673bb7d5fb6317e1333a7cf5ecfc2539b5b1 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Fri, 18 Nov 2016 19:34:08 +0100 Subject: [PATCH] tig integration --- vim/.vim/findgitroot.sh | 9 +++++++++ vim/.vimrc | 6 ++++++ 2 files changed, 15 insertions(+) create mode 100755 vim/.vim/findgitroot.sh 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