From 2fddc277815b8e09ef80279d94578735481ec435 Mon Sep 17 00:00:00 2001 From: typebrook Date: Tue, 12 Mar 2019 17:47:06 +0800 Subject: update --- alias | 1 + tigrc | 2 +- vimrc | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/alias b/alias index c667730..af563a1 100644 --- a/alias +++ b/alias @@ -71,6 +71,7 @@ alias tg='tig grep' alias tr='tig refs' alias tl='tig log' alias ty='tig stash' +alias rl='git reflog --pretty=raw | tig --pretty=raw' # Android alias debug='./gradlew app:installDebug && adb shell am start -n adb shell am start -n com.geothings.geobingan/.MainActivity_' diff --git a/tigrc b/tigrc index 42919a2..fcdc1e0 100644 --- a/tigrc +++ b/tigrc @@ -49,7 +49,7 @@ set blame-view-line-number = yes,interval=5 # status view bind status s ?git stash bind status S @git stash save "%(prompt Enter stash name: )" -bind status p ?git stash pop +bind status p !git checkout --patch -- %(file) bind status D ?rm %(file) bind status a ?git commit --amend bind status j :/^[MADRU?] diff --git a/vimrc b/vimrc index 78ce6ac..8d7a82a 100644 --- a/vimrc +++ b/vimrc @@ -13,9 +13,42 @@ set siso=999 let g:vim_markdown_conceal = 0 nmap :q -nnoremap r :.w !bash +nnoremap t :.w !bash nnoremap tt :TableFormat +let g:vim_markdown_folding_disabled = 1 +source ~/.vim_runtime/vimrcs/redir.vim + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" => Redirect the output of a Vim or external command into a scratch buffer +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Copy from : https://gist.github.com/romainl/eae0a260ab9c135390c30cd370c20cd7 +" Usage: +" :Redir hi ............. show the full output of command ':hi' in a scratch window +" :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window +" +function! Redir(cmd) + for win in range(1, winnr('$')) + if getwinvar(win, 'scratch') + execute win . 'windo close' + endif + endfor + if a:cmd =~ '^!' + let output = system(matchstr(a:cmd, '^!\zs.*')) + else + redir => output + execute a:cmd + redir END + endif + vnew + let w:scratch = 1 + setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile + call setline(1, split(output, "\n")) +endfunction + +command! -nargs=1 -complete=command Redir silent call Redir() +nnoremap r :Redir + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => Make Alt key works on Gnome terminal -- cgit v1.2.3-70-g09d2