diff --git a/.vim/startup/map_vimrc b/.vim/startup/map_vimrc index 2ad0c31..da5d1af 100644 --- a/.vim/startup/map_vimrc +++ b/.vim/startup/map_vimrc @@ -72,3 +72,6 @@ map xml :call Xml() " Normal mode F2 to call NERDTree nmap :NERDTreeToggle + +nnoremap i :PlugInstall +nnoremap u :PlugUpdate diff --git a/.vim/startup/vundle_vimrc b/.vim/startup/vundle_vimrc index 637d470..04fe9ee 100644 --- a/.vim/startup/vundle_vimrc +++ b/.vim/startup/vundle_vimrc @@ -31,6 +31,8 @@ Plug 'godlygeek/tabular' Plug 'plasticboy/vim-markdown' Plug 'scrooloose/nerdtree' Plug 'scrooloose/nerdcommenter' +" 目录树美化 +Plug 'tiagofumo/vim-nerdtree-syntax-highlight' Plug 'davidhalter/jedi-vim' Plug 'ervandew/supertab' Plug 'Raimondi/delimitMate' @@ -68,6 +70,7 @@ Plug 'ntpeters/vim-better-whitespace' Plug '907th/vim-auto-save' Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': '.install -all'} Plug 'junegunn/fzf.vim' +Plug 'Valloric/YouCompleteMe', { 'do': './install.py' } " Git plugin not hosted on GitHub Plug 'git://git.wincent.com/command-t.git' diff --git a/.zshrc b/.zshrc index 3d09f13..2af5482 100644 --- a/.zshrc +++ b/.zshrc @@ -269,7 +269,7 @@ alias df="df -h" alias free="free -m" alias grep="grep --color=auto" alias open="xdg-open" - +alias ag="ag -i" #transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi #tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } @@ -373,7 +373,7 @@ fh() { # fkill - kill process fkill() { local pid - pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') + pid=$(ps -ef |grep -v ^root | sed 1d | fzf -m | awk '{print $2}') if [ "x$pid" != "x" ] then @@ -411,3 +411,24 @@ z() { #alias lp="lpass show -c --password $(lpass ls | fzf | awk '{print $(NF)}' | sed 's/\]//g')" +gcbr() { + result=$(git branch -a --color=always | grep -v '/HEAD\s' | sort | + fzf --height 50% --border --ansi --tac --preview-window right:70% \ + --preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1) | head -'$LINES | + sed 's/^..//' | cut -d' ' -f1) + + if [[ $result != "" ]]; then + if [[ $result == remotes/* ]]; then + git checkout --track $(echo $result | sed 's#remotes/##') + else + git checkout "$result" + fi + fi +} + +gfs() { + git -c color.status=always status --short | + fzf --height 50% --border --ansi --multi --ansi --nth 2..,.. \ + --preview '(git diff --color=always -- {-1} | sed 1,4d; cat {-1}) | head -500' | + cut -c4- | sed 's/.* -> //' +}