From b67fb2683d6e7a5ae43d2d03f19dd0d888ba487d Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Tue, 3 May 2016 21:14:39 +0200 Subject: [PATCH] Use vim for git editor, diff and merge --- .bashrc | 12 +++++------- .gitconfig | 36 ++---------------------------------- .tmux.conf | 14 ++++++++------ .vimrc | 10 +++++++--- bin/git-difftool.sh | 1 - bin/git-editor.sh | 10 ++-------- bin/git-mergetool.sh | 16 ++-------------- 7 files changed, 26 insertions(+), 73 deletions(-) diff --git a/.bashrc b/.bashrc index 016057a..3d5fddf 100644 --- a/.bashrc +++ b/.bashrc @@ -4,12 +4,10 @@ [[ "$-" != *i* ]] && return #[ -n "$PS1" ] && source ~/.bash_profile; -# Load the shell dotfiles -for file in ~/.bash/*; -do - [ -r "$file" ] && [ -f "$file" ] && source "$file"; +# Load settings +for file in ~/.bash/*; do + [ -f "$file" ] && source "$file"; done; -if [ -f ~/.bashrc_local ]; then - source ~/.bashrc_local -fi +# Local/private settings +[ -f ~/.bashrc_local ] && source ~/.bashrc_local; diff --git a/.gitconfig b/.gitconfig index 1a819dc..e11463a 100644 --- a/.gitconfig +++ b/.gitconfig @@ -4,132 +4,100 @@ lg1 = !"git lg1-specific --all" lg2 = !"git lg2-specific --all" lg3 = !"git lg3-specific --all" - lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)' - # View the current working tree status using the short format s = status -s - # Show the diff between the latest commit and the current state d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" - # `git di $number` shows the diff between the state `$number` revisions ago and the current state di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" diffall = !sh git-diffall.sh - # Pull in remote changes for the current repository and all its submodules p = !"git pull; git submodule foreach git pull origin master" - # Clone a repository including all submodules c = clone --recursive - # Commit all changes ca = !git add -A && git commit -av - # Switch to a branch, creating it if necessary go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" - # Show verbose output about tags, branches or remotes tags = tag -l branches = branch -a remotes = remote -v bra = branch -a brd = branch -d - # Amend the currently staged files to the latest commit amend = commit --amend --reuse-message=HEAD - # Credit an author on the latest commit credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" - # Interactive rebase with the given number of latest commits reb = "!r() { git rebase -i HEAD~$1; }; r" - # Find branches containing commit fb = "!f() { git branch -a --contains $1; }; f" - # Find tags containing commit ft = "!f() { git describe --always --contains $1; }; f" - # Find commits by source code fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f" - # Find commits by commit message fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" - # Remove branches that have already been merged with master # a.k.a. ?delete merged? dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" - # List contributors with number of commits contributors = shortlog --summary --numbered - co = checkout cobr = checkout -b - root = rev-parse --show-toplevel - [apply] # Detect whitespace errors when applying a patch whitespace = fix - [core] # Use custom `.gitignore` excludesfile = ~/.gitignore_global - # Treat spaces before tabs and all kinds of trailing whitespace as an error # [default] trailing-space: looks for spaces at the end of a line # [default] space-before-tab: looks for spaces before tabs at the beginning of a line whitespace = space-before-tab,-indent-with-non-tab,trailing-space - # utocrlf = input editor = git-editor.sh - [color] # Use colors in Git commands that are capable of colored output when # outputting to the terminal. (This is the default setting in Git = 1.8.4.) ui = auto - [color "branch"] current = yellow reverse local = yellow remote = green - [color "diff"] meta = yellow bold frag = magenta bold # line info old = red # deletions new = green # additions - [color "status"] added = yellow changed = green untracked = cyan - [help] # Automatically correct and execute mistyped commands autocorrect = 1 - [diff] tool = git-difftool # Detect copies as well as renames renames = copies prompt = false - [difftool "git-difftool"] cmd = git-difftool.sh $LOCAL $REMOTE - [merge] tool = git-mergetool # Include summaries of merged commits in newly created merge commit messages log = true prompt = false - [mergetool "git-mergetool"] cmd = git-mergetool.sh $LOCAL $REMOTE $BASE $MERGED - +[push] + default = simple [include] # Local/private config goes in the include path = ~/.gitconfig_local diff --git a/.tmux.conf b/.tmux.conf index c4e2c39..4c56589 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -51,11 +51,11 @@ set -g detach-on-destroy off # Increase history-limit for scrolling (default is 2000) set-option -g history-limit 15000 # mouse support - set to on if you want to use the mouse -setw -g mode-mouse on -set -g mouse-select-pane on -set -g mouse-resize-pane on -set -g mouse-select-window on -set -g mouse-utf8 on +#setw -g mode-mouse on +#set -g mouse-select-pane on +#set -g mouse-resize-pane on +#set -g mouse-select-window on +#set -g mouse-utf8 on # enable vi keys. setw -g mode-keys vi # Reload the file with Prefix r @@ -97,4 +97,6 @@ bind -t vi-copy 'y' copy-selection # open tree instead of session list bind s run 'tmuxer choose-session' bind-key -t vi-choice h tree-collapse -bind-key -t vi-choice l tree-expand \ No newline at end of file +bind-key -t vi-choice l tree-expand +# local/private settings +source-file ~/.tmux_local.conf diff --git a/.vimrc b/.vimrc index 75281cd..51747a2 100644 --- a/.vimrc +++ b/.vimrc @@ -18,22 +18,25 @@ Plugin 'chazy/cscope_maps' call vundle#end() " required filetype plugin indent on " required -syntax enable " syntaxs highlightning +syntax enable "------------------------------------------------------------------------------ " Regular setting "------------------------------------------------------------------------------ " -set backspace=2 " backspace in insert mode works like normal editor +set backspace=eol,start,indent set autoindent " auto indenting set number " line numbers set nobackup " get rid of anoying ~file +set noswapfile +set nowb set encoding=utf-8 set expandtab -set fileencodings=ucs-bom,utf-8,euc-jp set hid set hlsearch set incsearch +set ignorecase +set smartcase set laststatus=2 set number set mouse=a @@ -46,6 +49,7 @@ set tabstop=4 set visualbell t_vb= set modeline set modelines=1 +set so=7 " For color "let g:solarized_termcolors=256 diff --git a/bin/git-difftool.sh b/bin/git-difftool.sh index 651b3b3..19fdcd5 100755 --- a/bin/git-difftool.sh +++ b/bin/git-difftool.sh @@ -1,4 +1,3 @@ TOOL=vimdiff ARG=$@ - $TOOL $ARG diff --git a/bin/git-editor.sh b/bin/git-editor.sh index d5afa9c..0e904c2 100755 --- a/bin/git-editor.sh +++ b/bin/git-editor.sh @@ -1,10 +1,4 @@ #!/bin/bash -if [[ -f $HOME/usr/bin/vim ]]; then - TOOL="${HOME}/usr/bin/vim" - ARG=$@ -elif [[ -f /usr/bin/vim ]]; then - TOOL="/usr/bin/vim" - ARG=$@ -fi - +TOOL=vim +ARG=$@ $TOOL $ARG diff --git a/bin/git-mergetool.sh b/bin/git-mergetool.sh index 576c19f..3c1e79e 100755 --- a/bin/git-mergetool.sh +++ b/bin/git-mergetool.sh @@ -1,16 +1,4 @@ #! /bin/bash -if [[ -f $HOME/bin/bcompare ]]; then - TOOL="${HOME}/bin/bcompare" - ARG="$(cygpath -w $1) $(cygpath -w $2) $(cygpath -w $3) $(cygpath -w $4)" -elif [[ -f /sw/stericsson/lud_tools/bcompare/3.3.5.15075/rh5/bin/bcompare ]]; then - TOOL=/sw/stericsson/lud_tools/bcompare/3.3.5.15075/rh5/bin/bcompare - ARG=$@ -elif [[ -f $HOME/usr/bin/vimdiff ]]; then - TOOL="${HOME}/usr/bin/vimdiff" - ARG=$@ -elif [[ -f /usr/bin/vimdiff ]]; then - TOOL="/usr/bin/vimdiff" - ARG=$@ -fi - +TOOL=vimdiff +ARG=$@ $TOOL $ARG -- 2.43.0