From 4f468f9ab2f12d229d40f541511003db5947904b Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Sat, 1 Feb 2020 19:18:45 +0100 Subject: [PATCH] Renormalize --- .config/git/attributes | 4 +- .config/git/config | 206 ++++++------- .config/git/ignore | 128 ++++---- .config/git/templates/config | 18 +- .config/ranger/rc.conf | 46 +-- .config/ranger/scope.sh | 222 +++++++------- .cshrc | 24 +- .inputrc | 128 ++++---- .mutt/keybindings | 106 +++---- .mutt/signature | 10 +- .ssh/config | 20 +- .tmux.conf | 204 ++++++------- bin/build-akmod.sh | 10 +- bin/build-luajit.sh | 6 +- bin/build-vim.sh | 36 +-- bin/caps-hjkl-or-esc.ahk | 62 ++-- bin/edit_with_vim.bat | 18 +- bin/git-diffall.sh | 552 +++++++++++++++++------------------ 18 files changed, 900 insertions(+), 900 deletions(-) diff --git a/.config/git/attributes b/.config/git/attributes index 1816133..72bce72 100644 --- a/.config/git/attributes +++ b/.config/git/attributes @@ -8,10 +8,10 @@ *.txt text # Text files with fixed EOL=LF -*.sh text eol=LF +*.sh text eol=lf # Text files with fixed EOL=CRLF$ -*.bat text eol=CRLF +*.bat text eol=crlf *.ahk text eol=crlf *.vcproj text eol=crlf diff --git a/.config/git/config b/.config/git/config index 6a21a01..03c5f8d 100644 --- a/.config/git/config +++ b/.config/git/config @@ -1,117 +1,117 @@ -[user] - name = Jannik ZANDER +[user] + name = Jannik ZANDER email = jzander@grundfos.com -[core] - editor = vim - pager = less +[core] + editor = vim + pager = less quotepath = false commitGraph = true -[help] - autocorrect = 10 -[branch] - autosetupmerge = always - autosetuprebase = always -[rebase] - autosquash = true - autostash = true -[pull] - rebase = true -[push] - default = simple +[help] + autocorrect = 10 +[branch] + autosetupmerge = always + autosetuprebase = always +[rebase] + autosquash = true + autostash = true +[pull] + rebase = true +[push] + default = simple recurseSubmodules = check -[diff] - tool = bc +[diff] + tool = bc submodule = log -[merge] - tool = bc -[difftool "vimdiff"] - prompt = false - conflictstyle = diff3 -[mergetool "vimdiff"] - prompt = false -[difftool "bc"] +[merge] + tool = bc +[difftool "vimdiff"] + prompt = false + conflictstyle = diff3 +[mergetool "vimdiff"] + prompt = false +[difftool "bc"] path = c:/Program Files/Beyond Compare 4/bcomp.exe trustExitCode = false [mergetool "bc"] path = c:/Program Files/Beyond Compare 4/bcomp.exe - trustExitCode = false -[init] - templatedir = ~/.config/git/templates -[filter "lfs"] - clean = git-lfs clean %f - smudge = git-lfs smudge %f - required = true -[alias] -# shortcuts - pp = "!git pull --rebase && git push" - up = "!git pull --rebase --prune $@ && git submodule update --init --recursive" - co = checkout - ci = commit - st = status - ls = ls-files - cl = clone --recurse-submodules -j8 + trustExitCode = false +[init] + templatedir = ~/.config/git/templates +[filter "lfs"] + clean = git-lfs clean %f + smudge = git-lfs smudge %f + required = true +[alias] +# shortcuts + pp = "!git pull --rebase && git push" + up = "!git pull --rebase --prune $@ && git submodule update --init --recursive" + co = checkout + ci = commit + st = status + ls = ls-files + cl = clone --recurse-submodules -j8 dt = cloner = clone --recursive - dt = difftool - mt = mergetool - undo = reset --soft HEAD^ - unci = reset --soft HEAD~ - una = reset HEAD -- - uha = checkout HEAD -- - unaa = reset HEAD - uhaa = reset --hard HEAD - sb = status -sb - amend = commit --amend - a = add - br = branch - brdm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" - go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" - diff = diff --word-diff - # dont pull without rebase, and dont push without pull (fetch & merge) - # avoid merge commits - mf = merge --ff-only - cp = cherry-pick - wc = whatchanged -p - ch = cherry -v - fs = "!git fetch && git status" - rb = rebase - ec = config --global -e - l = log --oneline --decorate - lg = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph - lol = log --oneline --decorate --graph --all --first-parent - last = log -1 HEAD - lt = tag -l - type = cat-file -t - dump = cat-file -p - who = shortlog -s -- - remotes = remote -v - root = rev-parse --show-toplevel - - # 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" - - # 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" - - #Credit an author on the latest commit - credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" - # List contributors with number of commits - contributors = shortlog --summary --numbered - - ctags = "!sh -c '[ -f .git/hooks/ctags ] || git init; .git/hooks/ctags' git-ctags" - gtags = "!sh -c '[ -f .git/hooks/gtags ] || git init; .git/hooks/gtags' git-gtags" - cscope = "!sh -c '[ -f .git/hooks/cscope ] || git init; .git/hooks/cscope' git-cscope" - + dt = difftool + mt = mergetool + undo = reset --soft HEAD^ + unci = reset --soft HEAD~ + una = reset HEAD -- + uha = checkout HEAD -- + unaa = reset HEAD + uhaa = reset --hard HEAD + sb = status -sb + amend = commit --amend + a = add + br = branch + brdm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" + go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" + diff = diff --word-diff + # dont pull without rebase, and dont push without pull (fetch & merge) + # avoid merge commits + mf = merge --ff-only + cp = cherry-pick + wc = whatchanged -p + ch = cherry -v + fs = "!git fetch && git status" + rb = rebase + ec = config --global -e + l = log --oneline --decorate + lg = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph + lol = log --oneline --decorate --graph --all --first-parent + last = log -1 HEAD + lt = tag -l + type = cat-file -t + dump = cat-file -p + who = shortlog -s -- + remotes = remote -v + root = rev-parse --show-toplevel + + # 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" + + # 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" + + #Credit an author on the latest commit + credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" + # List contributors with number of commits + contributors = shortlog --summary --numbered + + ctags = "!sh -c '[ -f .git/hooks/ctags ] || git init; .git/hooks/ctags' git-ctags" + gtags = "!sh -c '[ -f .git/hooks/gtags ] || git init; .git/hooks/gtags' git-gtags" + cscope = "!sh -c '[ -f .git/hooks/cscope ] || git init; .git/hooks/cscope' git-cscope" + sdiff = !git diff && git submodule foreach 'git diff' -[include] - path = ~/.gitconfig.local +[include] + path = ~/.gitconfig.local [gc] writeCommitGraph = true [status] diff --git a/.config/git/ignore b/.config/git/ignore index 0d306af..5221ad5 100644 --- a/.config/git/ignore +++ b/.config/git/ignore @@ -1,64 +1,64 @@ -# Ignore tags created by etags, ctags, gtags (GNU global) and cscope -TAGS -.TAGS -!TAGS/ -tags -.tags -!tags/ -gtags.files -GTAGS -GRTAGS -GPATH -cscope.files -cscope.out -cscope.in.out -cscope.po.out - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - - -# OSX -*.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -__pycache__ +# Ignore tags created by etags, ctags, gtags (GNU global) and cscope +TAGS +.TAGS +!TAGS/ +tags +.tags +!tags/ +gtags.files +GTAGS +GRTAGS +GPATH +cscope.files +cscope.out +cscope.in.out +cscope.po.out + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + + +# OSX +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +__pycache__ diff --git a/.config/git/templates/config b/.config/git/templates/config index 2dc4a39..f8767a9 100644 --- a/.config/git/templates/config +++ b/.config/git/templates/config @@ -1,9 +1,9 @@ -[core] - repositoryformatversion = 0 - filemode = true - bare = false - logallrefupdates = true -[branch "master"] - remote = origin - merge = refs/heads/master - rebase = true +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true +[branch "master"] + remote = origin + merge = refs/heads/master + rebase = true diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index 918b6c1..4ba8b5f 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -1,23 +1,23 @@ -# =================================================================== -# == Options -# =================================================================== - -# Show hidden files? You can toggle this by typing 'zh' -set show_hidden true - -# Which script is used to generate file previews? -# ranger ships with scope.sh, a script that calls external programs (see -# README.md for dependencies) to preview images, archives, etc. -set preview_script ~/.config/ranger/scope.sh - -# Use the external preview script or display simple plain text or image previews? -set use_preview_script true - -# State of the three backends git, hg, bzr. The possible states are -# disabled, local (only show local info), enabled (show local and remote -# information). -set vcs_backend_git enabled - -# Use one of the supported image preview protocols -set preview_images true - +# =================================================================== +# == Options +# =================================================================== + +# Show hidden files? You can toggle this by typing 'zh' +set show_hidden true + +# Which script is used to generate file previews? +# ranger ships with scope.sh, a script that calls external programs (see +# README.md for dependencies) to preview images, archives, etc. +set preview_script ~/.config/ranger/scope.sh + +# Use the external preview script or display simple plain text or image previews? +set use_preview_script true + +# State of the three backends git, hg, bzr. The possible states are +# disabled, local (only show local info), enabled (show local and remote +# information). +set vcs_backend_git enabled + +# Use one of the supported image preview protocols +set preview_images true + diff --git a/.config/ranger/scope.sh b/.config/ranger/scope.sh index 7ee3367..2ca3aab 100755 --- a/.config/ranger/scope.sh +++ b/.config/ranger/scope.sh @@ -1,111 +1,111 @@ -#!/usr/bin/env sh -# ranger supports enhanced previews. If the option "use_preview_script" -# is set to True and this file exists, this script will be called and its -# output is displayed in ranger. ANSI color codes are supported. - -# NOTES: This script is considered a configuration file. If you upgrade -# ranger, it will be left untouched. (You must update it yourself.) -# Also, ranger disables STDIN here, so interactive scripts won't work properly - -# Meanings of exit codes: -# code | meaning | action of ranger -# -----+------------+------------------------------------------- -# 0 | success | success. display stdout as preview -# 1 | no preview | failure. display no preview at all -# 2 | plain text | display the plain content of the file -# 3 | fix width | success. Don't reload when width changes -# 4 | fix height | success. Don't reload when height changes -# 5 | fix both | success. Don't ever reload -# 6 | image | success. display the image $cached points to as an image preview -# 7 | image | success. display the file directly as an image - -# Meaningful aliases for arguments: -path="$1" # Full path of the selected file -width="$2" # Width of the preview pane (number of fitting characters) -height="$3" # Height of the preview pane (number of fitting characters) -cached="$4" # Path that should be used to cache image previews -preview_images="$5" # "True" if image previews are enabled, "False" otherwise. - -maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln - -# Find out something about the file: -mimetype=$(file --mime-type -Lb "$path") -extension=$(/bin/echo "${path##*.}" | awk '{print tolower($0)}') - -# Functions: -# runs a command and saves its output into $output. Useful if you need -# the return value AND want to use the output in a pipe -try() { output=$(eval '"$@"'); } - -# writes the output of the previously used "try" command -dump() { /bin/echo "$output"; } - -# a common post-processing function used after most commands -trim() { head -n "$maxln"; } - -# wraps highlight to treat exit code 141 (killed by SIGPIPE) as success -safepipe() { "$@"; test $? = 0 -o $? = 141; } - -# Image previews, if enabled in ranger. -if [ "$preview_images" = "True" ]; then - case "$mimetype" in - # Image previews for SVG files, disabled by default. - ###image/svg+xml) - ### convert "$path" "$cached" && exit 6 || exit 1;; - # Image previews for image files. w3mimgdisplay will be called for all - # image files (unless overriden as above), but might fail for - # unsupported types. - image/*) - exit 7;; - # Image preview for video, disabled by default.: - ###video/*) - ### ffmpegthumbnailer -i "$path" -o "$cached" -s 0 && exit 6 || exit 1;; - esac -fi - -case "$extension" in - # Archive extensions: - a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\ - rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip) - try als "$path" && { dump | trim; exit 0; } - try acat "$path" && { dump | trim; exit 3; } - try bsdtar -lf "$path" && { dump | trim; exit 0; } - exit 1;; - rar) - # avoid password prompt by providing empty password - try unrar -p- lt "$path" && { dump | trim; exit 0; } || exit 1;; - 7z) - # avoid password prompt by providing empty password - try 7z -p l "$path" && { dump | trim; exit 0; } || exit 1;; - # PDF documents: - pdf) - try pdftotext -l 10 -nopgbrk -q "$path" - && \ - { dump | trim | fmt -s -w $width; exit 0; } || exit 1;; - # BitTorrent Files - torrent) - try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;; - # ODT Files - odt|ods|odp|sxw) - try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;; - # HTML Pages: - htm|html|xhtml) - try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } - ;; # fall back to highlight/cat if the text browsers fail -esac - -case "$mimetype" in - # Syntax highlight for text files: - text/* | */xml) - try safepipe less "$path" && { dump | trim; exit 5; } - exit 2;; - # Ascii-previews of images: - image/*) - img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;; - # Display information about media files: - video/* | audio/*) - exiftool "$path" && exit 5 - # Use sed to remove spaces so the output fits into the narrow window - try mediainfo "$path" && { dump | trim | sed 's/ \+:/: /;'; exit 5; } || exit 1;; -esac - -exit 1 +#!/usr/bin/env sh +# ranger supports enhanced previews. If the option "use_preview_script" +# is set to True and this file exists, this script will be called and its +# output is displayed in ranger. ANSI color codes are supported. + +# NOTES: This script is considered a configuration file. If you upgrade +# ranger, it will be left untouched. (You must update it yourself.) +# Also, ranger disables STDIN here, so interactive scripts won't work properly + +# Meanings of exit codes: +# code | meaning | action of ranger +# -----+------------+------------------------------------------- +# 0 | success | success. display stdout as preview +# 1 | no preview | failure. display no preview at all +# 2 | plain text | display the plain content of the file +# 3 | fix width | success. Don't reload when width changes +# 4 | fix height | success. Don't reload when height changes +# 5 | fix both | success. Don't ever reload +# 6 | image | success. display the image $cached points to as an image preview +# 7 | image | success. display the file directly as an image + +# Meaningful aliases for arguments: +path="$1" # Full path of the selected file +width="$2" # Width of the preview pane (number of fitting characters) +height="$3" # Height of the preview pane (number of fitting characters) +cached="$4" # Path that should be used to cache image previews +preview_images="$5" # "True" if image previews are enabled, "False" otherwise. + +maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln + +# Find out something about the file: +mimetype=$(file --mime-type -Lb "$path") +extension=$(/bin/echo "${path##*.}" | awk '{print tolower($0)}') + +# Functions: +# runs a command and saves its output into $output. Useful if you need +# the return value AND want to use the output in a pipe +try() { output=$(eval '"$@"'); } + +# writes the output of the previously used "try" command +dump() { /bin/echo "$output"; } + +# a common post-processing function used after most commands +trim() { head -n "$maxln"; } + +# wraps highlight to treat exit code 141 (killed by SIGPIPE) as success +safepipe() { "$@"; test $? = 0 -o $? = 141; } + +# Image previews, if enabled in ranger. +if [ "$preview_images" = "True" ]; then + case "$mimetype" in + # Image previews for SVG files, disabled by default. + ###image/svg+xml) + ### convert "$path" "$cached" && exit 6 || exit 1;; + # Image previews for image files. w3mimgdisplay will be called for all + # image files (unless overriden as above), but might fail for + # unsupported types. + image/*) + exit 7;; + # Image preview for video, disabled by default.: + ###video/*) + ### ffmpegthumbnailer -i "$path" -o "$cached" -s 0 && exit 6 || exit 1;; + esac +fi + +case "$extension" in + # Archive extensions: + a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\ + rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip) + try als "$path" && { dump | trim; exit 0; } + try acat "$path" && { dump | trim; exit 3; } + try bsdtar -lf "$path" && { dump | trim; exit 0; } + exit 1;; + rar) + # avoid password prompt by providing empty password + try unrar -p- lt "$path" && { dump | trim; exit 0; } || exit 1;; + 7z) + # avoid password prompt by providing empty password + try 7z -p l "$path" && { dump | trim; exit 0; } || exit 1;; + # PDF documents: + pdf) + try pdftotext -l 10 -nopgbrk -q "$path" - && \ + { dump | trim | fmt -s -w $width; exit 0; } || exit 1;; + # BitTorrent Files + torrent) + try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;; + # ODT Files + odt|ods|odp|sxw) + try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;; + # HTML Pages: + htm|html|xhtml) + try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } + ;; # fall back to highlight/cat if the text browsers fail +esac + +case "$mimetype" in + # Syntax highlight for text files: + text/* | */xml) + try safepipe less "$path" && { dump | trim; exit 5; } + exit 2;; + # Ascii-previews of images: + image/*) + img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;; + # Display information about media files: + video/* | audio/*) + exiftool "$path" && exit 5 + # Use sed to remove spaces so the output fits into the narrow window + try mediainfo "$path" && { dump | trim | sed 's/ \+:/: /;'; exit 5; } || exit 1;; +esac + +exit 1 diff --git a/.cshrc b/.cshrc index d62cb82..9a21b6d 100644 --- a/.cshrc +++ b/.cshrc @@ -1,12 +1,12 @@ -# .cshrc: executed by C shells on startup - -# If this is login or command shell then change to a sane shell -if ($SHELL != /bin/bash) then - setenv SHELL /bin/bash - if ($?command) then - exec /bin/bash -c "$command" - else - exec /bin/bash - endif -endif - +# .cshrc: executed by C shells on startup + +# If this is login or command shell then change to a sane shell +if ($SHELL != /bin/bash) then + setenv SHELL /bin/bash + if ($?command) then + exec /bin/bash -c "$command" + else + exec /bin/bash + endif +endif + diff --git a/.inputrc b/.inputrc index d6649bd..2eeb802 100644 --- a/.inputrc +++ b/.inputrc @@ -1,64 +1,64 @@ -# Use vi keybindings for everything that uses readline. - -# Useful stuff for UTF-8 -set meta-flag on -set input-meta on -set output-meta on -set convert-meta off - -# Adds punctuation as word delimiters -set bind-tty-special-chars off - -# Completion Options -set completion-ignore-case on -set show-all-if-ambiguous on -set show-all-if-unmodified on -set mark-symlinked-directories on -set match-hidden-files off -set page-completions on -set completion-query-items 200 -set visible-stats on -set skip-completed-text on - -set editing-mode vi -set keymap vi - -set show-mode-in-prompt on -set vi-ins-mode-string + -set vi-cmd-mode-string - - -set keymap vi-command -"gg": beginning-of-history -"G": end-of-history -"j": history-search-forward -"k": history-search-backward - -$if Bash - # do history expansion when space entered - Space: magic-space -$endif - -set keymap vi-insert -"\e": vi-movement-mode -"jk": vi-movement-mode -Tab: complete -#Tab: menu-complete - -$if Python -$endif - -$if Gdb - "\e[15~": "continue\n" - "\e[21~": "next\n" - "\e[23~": "step\n" - "\eOQ": "nexti\n" - "\eOR": "stepi\n" -$endif - -$if mysql - "\C-xs": "show tables like '%%';\e[D\e[D\e[D" -$endif - -# Include system wide settings which is ignored -# by default if one has own .inputrc -$include ~/inputrc.local +# Use vi keybindings for everything that uses readline. + +# Useful stuff for UTF-8 +set meta-flag on +set input-meta on +set output-meta on +set convert-meta off + +# Adds punctuation as word delimiters +set bind-tty-special-chars off + +# Completion Options +set completion-ignore-case on +set show-all-if-ambiguous on +set show-all-if-unmodified on +set mark-symlinked-directories on +set match-hidden-files off +set page-completions on +set completion-query-items 200 +set visible-stats on +set skip-completed-text on + +set editing-mode vi +set keymap vi + +set show-mode-in-prompt on +set vi-ins-mode-string + +set vi-cmd-mode-string - + +set keymap vi-command +"gg": beginning-of-history +"G": end-of-history +"j": history-search-forward +"k": history-search-backward + +$if Bash + # do history expansion when space entered + Space: magic-space +$endif + +set keymap vi-insert +"\e": vi-movement-mode +"jk": vi-movement-mode +Tab: complete +#Tab: menu-complete + +$if Python +$endif + +$if Gdb + "\e[15~": "continue\n" + "\e[21~": "next\n" + "\e[23~": "step\n" + "\eOQ": "nexti\n" + "\eOR": "stepi\n" +$endif + +$if mysql + "\C-xs": "show tables like '%%';\e[D\e[D\e[D" +$endif + +# Include system wide settings which is ignored +# by default if one has own .inputrc +$include ~/inputrc.local diff --git a/.mutt/keybindings b/.mutt/keybindings index fa0a981..4f8c237 100644 --- a/.mutt/keybindings +++ b/.mutt/keybindings @@ -1,53 +1,53 @@ -bind generic,index Q exit -bind editor noop -bind editor complete-query - -bind browser gg top-page -bind browser G bottom-page -bind browser \Cb previous-page -bind browser \Cf next-page -bind browser A check-new -bind browser v view-file - -bind index ~ set-flag -bind index \Cv what-key -bind index H current-top -bind index M current-middle -bind index L current-bottom -bind index / search -bind index : enter-command -bind index i mail - -bind pager i edit -bind pager u mark-as-new -bind pager gg top -bind pager G bottom -bind pager j next-line -bind pager k previous-line - -bind index,attach gg first-entry -bind index,attach G last-entry - -bind index,pager L list-reply -# bind index,pager P print-message -bind index,pager R group-reply -bind index,pager \Cd half-down -bind index,pager \Cu half-up -bind index,pager \Cf next-page -bind index,pager \Cb previous-page -bind index,pager \Cn next-thread -bind index,pager \Cp previous-thread - -bind index,pager f forward-message -bind index,pager p previous-undeleted -bind index,pager N next-unread -bind index,pager P previous-unread - -bind index,pager X print-message - -macro index Z "mu find --clearlinks --format=links --linksdir=~/.mu/results " "mu find" -macro index S "~/.mu/results" "mu find results" - -macro attach s $HOME "Save to default directory for attachments" - -# vim: ft=muttrc +bind generic,index Q exit +bind editor noop +bind editor complete-query + +bind browser gg top-page +bind browser G bottom-page +bind browser \Cb previous-page +bind browser \Cf next-page +bind browser A check-new +bind browser v view-file + +bind index ~ set-flag +bind index \Cv what-key +bind index H current-top +bind index M current-middle +bind index L current-bottom +bind index / search +bind index : enter-command +bind index i mail + +bind pager i edit +bind pager u mark-as-new +bind pager gg top +bind pager G bottom +bind pager j next-line +bind pager k previous-line + +bind index,attach gg first-entry +bind index,attach G last-entry + +bind index,pager L list-reply +# bind index,pager P print-message +bind index,pager R group-reply +bind index,pager \Cd half-down +bind index,pager \Cu half-up +bind index,pager \Cf next-page +bind index,pager \Cb previous-page +bind index,pager \Cn next-thread +bind index,pager \Cp previous-thread + +bind index,pager f forward-message +bind index,pager p previous-undeleted +bind index,pager N next-unread +bind index,pager P previous-unread + +bind index,pager X print-message + +macro index Z "mu find --clearlinks --format=links --linksdir=~/.mu/results " "mu find" +macro index S "~/.mu/results" "mu find results" + +macro attach s $HOME "Save to default directory for attachments" + +# vim: ft=muttrc diff --git a/.mutt/signature b/.mutt/signature index 17ceed3..a4b8a61 100644 --- a/.mutt/signature +++ b/.mutt/signature @@ -1,5 +1,5 @@ - - -- Jannik Zander - - + + +- Jannik Zander + + diff --git a/.ssh/config b/.ssh/config index c0d2f52..af20b43 100644 --- a/.ssh/config +++ b/.ssh/config @@ -1,10 +1,10 @@ -# default for all -IdentityFile ~/.ssh/id_rsa - -Host localhost git.zndr.dk - HostName localhost - User git - -Host zndr.dk - HostName zndr.dk - User jaz +# default for all +IdentityFile ~/.ssh/id_rsa + +Host localhost git.zndr.dk + HostName localhost + User git + +Host zndr.dk + HostName zndr.dk + User jaz diff --git a/.tmux.conf b/.tmux.conf index ecbbbdc..4c56589 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,102 +1,102 @@ -# Setting the prefix from C-b to C-a -set -g prefix C-a -# Free the original Ctrl-b prefix keybinding -unbind C-b -#setting the delay between prefix and command -set -sg escape-time 1 -# Ensure that we can send Ctrl-A to other apps -bind C-a send-prefix -# Set the base index for windows to 1 instead of 0 -set -g base-index 1 -# Set the base index for panes to 1 instead of 0 -setw -g pane-base-index 1 - -# Set the default terminal mode to 256color mode -set -g default-terminal "screen-256color" -# enable activity alerts -setw -g monitor-activity on -set -g visual-activity on -# set the status line's colors -set -g status-fg white -set -g status-bg black -# set the color of the window list -setw -g window-status-fg cyan -setw -g window-status-bg default -setw -g window-status-attr dim -# set colors for the active window -setw -g window-status-current-fg white -setw -g window-status-current-bg red -setw -g window-status-current-attr bright -# pane colors -set -g pane-border-fg green -set -g pane-border-bg black -set -g pane-active-border-fg white -set -g pane-active-border-bg yellow -# Command / message line -set -g message-fg white -set -g message-bg black -set -g message-attr bright -# Status line left side -set -g status-left-length 40 -set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P" -set -g status-utf8 on -# Status line right side -# 15% | 28 Nov 18:15 -set -g status-right "#(~/battery Discharging) | #[fg=cyan]%d %b %R" -# Update the status bar every sixty seconds -set -g status-interval 60 -# Center the window list -set -g status-justify centre -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 -# enable vi keys. -setw -g mode-keys vi -# Reload the file with Prefix r -bind r source-file ~/.tmux.conf \; display "Reloaded!" -# splitting panes -bind c neww -c "#{pane_current_path}" -bind | split-window -h -c "#{pane_current_path}" -bind - split-window -v -c "#{pane_current_path}" -# moving between panes -bind h select-pane -L -bind j select-pane -D -bind k select-pane -U -bind l select-pane -R -# Quick pane selection -bind -r C-h select-window -t :- -bind -r C-l select-window -t :+ -# Pane resizing -bind -r H resize-pane -L 5 -bind -r J resize-pane -D 5 -bind -r K resize-pane -U 5 -bind -r L resize-pane -R 5 -# Open panes in the same directory using the tmux-panes script -unbind v -unbind n -bind v send-keys " ~/tmux-panes -h" C-m -bind n send-keys " ~/tmux-panes -v" C-m -# Maximize and restore a pane -unbind Up -bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp -unbind Down -bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp -# Log output to a text file on demand -bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log" -# better binding for copy mode -bind v copy-mode -# Select/yank like vim -bind -t vi-copy 'v' begin-selection -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 -# local/private settings -source-file ~/.tmux_local.conf +# Setting the prefix from C-b to C-a +set -g prefix C-a +# Free the original Ctrl-b prefix keybinding +unbind C-b +#setting the delay between prefix and command +set -sg escape-time 1 +# Ensure that we can send Ctrl-A to other apps +bind C-a send-prefix +# Set the base index for windows to 1 instead of 0 +set -g base-index 1 +# Set the base index for panes to 1 instead of 0 +setw -g pane-base-index 1 + +# Set the default terminal mode to 256color mode +set -g default-terminal "screen-256color" +# enable activity alerts +setw -g monitor-activity on +set -g visual-activity on +# set the status line's colors +set -g status-fg white +set -g status-bg black +# set the color of the window list +setw -g window-status-fg cyan +setw -g window-status-bg default +setw -g window-status-attr dim +# set colors for the active window +setw -g window-status-current-fg white +setw -g window-status-current-bg red +setw -g window-status-current-attr bright +# pane colors +set -g pane-border-fg green +set -g pane-border-bg black +set -g pane-active-border-fg white +set -g pane-active-border-bg yellow +# Command / message line +set -g message-fg white +set -g message-bg black +set -g message-attr bright +# Status line left side +set -g status-left-length 40 +set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P" +set -g status-utf8 on +# Status line right side +# 15% | 28 Nov 18:15 +set -g status-right "#(~/battery Discharging) | #[fg=cyan]%d %b %R" +# Update the status bar every sixty seconds +set -g status-interval 60 +# Center the window list +set -g status-justify centre +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 +# enable vi keys. +setw -g mode-keys vi +# Reload the file with Prefix r +bind r source-file ~/.tmux.conf \; display "Reloaded!" +# splitting panes +bind c neww -c "#{pane_current_path}" +bind | split-window -h -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" +# moving between panes +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R +# Quick pane selection +bind -r C-h select-window -t :- +bind -r C-l select-window -t :+ +# Pane resizing +bind -r H resize-pane -L 5 +bind -r J resize-pane -D 5 +bind -r K resize-pane -U 5 +bind -r L resize-pane -R 5 +# Open panes in the same directory using the tmux-panes script +unbind v +unbind n +bind v send-keys " ~/tmux-panes -h" C-m +bind n send-keys " ~/tmux-panes -v" C-m +# Maximize and restore a pane +unbind Up +bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp +unbind Down +bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp +# Log output to a text file on demand +bind P pipe-pane -o "cat >>~/#W.log" \; display "Toggled logging to ~/#W.log" +# better binding for copy mode +bind v copy-mode +# Select/yank like vim +bind -t vi-copy 'v' begin-selection +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 +# local/private settings +source-file ~/.tmux_local.conf diff --git a/bin/build-akmod.sh b/bin/build-akmod.sh index c451db7..ddcec7d 100755 --- a/bin/build-akmod.sh +++ b/bin/build-akmod.sh @@ -1,5 +1,5 @@ -#!/bin/sh - -sudo dnf install kernel-$1 -sudo dnf install akmod-wl "kernel-devel-uname-r == $(uname -r)" -sudo akmods +#!/bin/sh + +sudo dnf install kernel-$1 +sudo dnf install akmod-wl "kernel-devel-uname-r == $(uname -r)" +sudo akmods diff --git a/bin/build-luajit.sh b/bin/build-luajit.sh index 2989278..5d635d9 100755 --- a/bin/build-luajit.sh +++ b/bin/build-luajit.sh @@ -1,3 +1,3 @@ -#!/bin/sh -make PREFIX=$PREFIX MULTILIB=lib -make install PREFIX=$PREFIX/apps/luajit MULTILIB=lib +#!/bin/sh +make PREFIX=$PREFIX MULTILIB=lib +make install PREFIX=$PREFIX/apps/luajit MULTILIB=lib diff --git a/bin/build-vim.sh b/bin/build-vim.sh index b0938cc..09274d0 100755 --- a/bin/build-vim.sh +++ b/bin/build-vim.sh @@ -1,18 +1,18 @@ -#!/bin/sh - -./configure \ ---prefix=$PREFIX \ ---with-features=huge \ ---with-compiledby="ejannza" \ ---enable-multibyte \ ---enable-gui=gtk2 \ ---enable-luainterp \ ---with-lua-prefix=$PREFIX --with-luajit \ ---enable-gpm \ ---enable-cscope \ ---enable-fontset \ ---enable-fail-if-missing - - -make -make install prefix=$PREFIX/apps/vim +#!/bin/sh + +./configure \ +--prefix=$PREFIX \ +--with-features=huge \ +--with-compiledby="ejannza" \ +--enable-multibyte \ +--enable-gui=gtk2 \ +--enable-luainterp \ +--with-lua-prefix=$PREFIX --with-luajit \ +--enable-gpm \ +--enable-cscope \ +--enable-fontset \ +--enable-fail-if-missing + + +make +make install prefix=$PREFIX/apps/vim diff --git a/bin/caps-hjkl-or-esc.ahk b/bin/caps-hjkl-or-esc.ahk index 407dfd1..550eba3 100644 --- a/bin/caps-hjkl-or-esc.ahk +++ b/bin/caps-hjkl-or-esc.ahk @@ -1,31 +1,31 @@ -#NoEnv -SendMode Input - -; Disable default CapsLock functionality -SetCapsLockState, AlwaysOff - -; Post Esc if pressed alone -CapsLock:: - - ; If you want to override CapsLock functionality for specific windows, etc. - ; Just define an OverrideCapsLock() function where you #include this script! - OverrideFunction := "OverrideCapsLock" - - ; Call the function dynamically to allow for silent failure. - if (Overridden := %OverrideFunction%()) { - Send {%Overridden%} - return - } - - KeyWait, CapsLock - if (A_PriorKey="CapsLock") - Send {Esc} -return - -; Map CapsLock modified hjkl movement -#If, GetKeyState("CapsLock", "P") -h::Left -j::Down -k::Up -l::Right -#If +#NoEnv +SendMode Input + +; Disable default CapsLock functionality +SetCapsLockState, AlwaysOff + +; Post Esc if pressed alone +CapsLock:: + + ; If you want to override CapsLock functionality for specific windows, etc. + ; Just define an OverrideCapsLock() function where you #include this script! + OverrideFunction := "OverrideCapsLock" + + ; Call the function dynamically to allow for silent failure. + if (Overridden := %OverrideFunction%()) { + Send {%Overridden%} + return + } + + KeyWait, CapsLock + if (A_PriorKey="CapsLock") + Send {Esc} +return + +; Map CapsLock modified hjkl movement +#If, GetKeyState("CapsLock", "P") +h::Left +j::Down +k::Up +l::Right +#If diff --git a/bin/edit_with_vim.bat b/bin/edit_with_vim.bat index d4b7586..e29534a 100644 --- a/bin/edit_with_vim.bat +++ b/bin/edit_with_vim.bat @@ -1,10 +1,10 @@ -@echo off -SET vim_path = %USERPROFILE%\apps\vim\vim73\gvim.exe -> edit_with_vim.reg ECHO REGEDIT4 ->> edit_with_vim.reg ECHO [HKEY_CLASSES_ROOT\*\shell\vim] ->> edit_with_vim.reg ECHO @="Edit with &Vim" ->> edit_with_vim.reg ECHO [HKEY_CLASSES_ROOT\*\shell\vim\command] -SET v_test=%USERPROFILE%\apps\vim\vim73\gvim.exe -Set v_replacement=\\ -SET v_result=%v_test:\=\\% +@echo off +SET vim_path = %USERPROFILE%\apps\vim\vim73\gvim.exe +> edit_with_vim.reg ECHO REGEDIT4 +>> edit_with_vim.reg ECHO [HKEY_CLASSES_ROOT\*\shell\vim] +>> edit_with_vim.reg ECHO @="Edit with &Vim" +>> edit_with_vim.reg ECHO [HKEY_CLASSES_ROOT\*\shell\vim\command] +SET v_test=%USERPROFILE%\apps\vim\vim73\gvim.exe +Set v_replacement=\\ +SET v_result=%v_test:\=\\% >> edit_with_vim.reg ECHO @="%v_result% \"%%1\"" \ No newline at end of file diff --git a/bin/git-diffall.sh b/bin/git-diffall.sh index 25fdda9..2ae11ea 100755 --- a/bin/git-diffall.sh +++ b/bin/git-diffall.sh @@ -1,277 +1,277 @@ -#!/bin/sh -# Copyright 2010 - 2012, Tim Henigan -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -# Perform a directory diff between commits in the repository using -# the external diff or merge tool specified in the user's config. - -USAGE='[--cached] [--copy-back] [-x|--extcmd=] {0,2} [-- *] - - --cached Compare to the index rather than the working tree. - - --copy-back Copy files back to the working tree when the diff - tool exits (in case they were modified by the - user). This option is only valid if the diff - compared with the working tree. - - -x= - --extcmd= Specify a custom command for viewing diffs. - git-diffall ignores the configured defaults and - runs $command $LOCAL $REMOTE when this option is - specified. Additionally, $BASE is set in the - environment. -' - -SUBDIRECTORY_OK=1 -. "$(git --exec-path)/git-sh-setup" - -TOOL_MODE=diff -. "$(git --exec-path)/git-mergetool--lib" - -merge_tool="$(get_merge_tool)" -if test -z "$merge_tool" -then - echo "Error: Either the 'diff.tool' or 'merge.tool' option must be set." - usage -fi - -start_dir=$(pwd) - -# All the file paths returned by the diff command are relative to the root -# of the working copy. So if the script is called from a subdirectory, it -# must switch to the root of working copy before trying to use those paths. -cdup=$(git rev-parse --show-cdup) && -cd "$cdup" || { - echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree" - exit 1 -} - -# set up temp dir -tmp=$(perl -e 'use File::Temp qw(tempdir); - $t=tempdir("/tmp/git-diffall.XXXXX") or exit(1); - print $t') || exit 1 -#trap 'rm -rf "$tmp"' EXIT - -left= -right= -paths= -dashdash_seen= -compare_staged= -merge_base= -left_dir= -right_dir= -diff_tool= -copy_back= - -while test $# != 0 -do - case "$1" in - -h|--h|--he|--hel|--help) - usage - ;; - --cached) - compare_staged=1 - ;; - --copy-back) - copy_back=1 - ;; - -x|--e|--ex|--ext|--extc|--extcm|--extcmd) - if test $# = 1 - then - echo You must specify the tool for use with --extcmd - usage - else - diff_tool=$2 - shift - fi - ;; - --) - dashdash_seen=1 - ;; - -*) - echo Invalid option: "$1" - usage - ;; - *) - # could be commit, commit range or path limiter - case "$1" in - *...*) - left=${1%...*} - right=${1#*...} - merge_base=1 - ;; - *..*) - left=${1%..*} - right=${1#*..} - ;; - *) - if test -n "$dashdash_seen" - then - paths="$paths$1 " - elif test -z "$left" - then - left=$1 - elif test -z "$right" - then - right=$1 - else - paths="$paths$1 " - fi - ;; - esac - ;; - esac - shift -done - -# Determine the set of files which changed -if test -n "$left" && test -n "$right" -then - left_dir="cmt-$(git rev-parse --short $left)" - right_dir="cmt-$(git rev-parse --short $right)" - - if test -n "$compare_staged" - then - usage - elif test -n "$merge_base" - then - git diff --name-only "$left"..."$right" -- $paths >"$tmp/filelist" - else - git diff --name-only "$left" "$right" -- $paths >"$tmp/filelist" - fi -elif test -n "$left" -then - left_dir="cmt-$(git rev-parse --short $left)" - - if test -n "$compare_staged" - then - right_dir="staged" - git diff --name-only --cached "$left" -- $paths >"$tmp/filelist" - else - right_dir="working_tree" - git diff --name-only "$left" -- $paths >"$tmp/filelist" - fi -else - left_dir="HEAD" - - if test -n "$compare_staged" - then - right_dir="staged" - git diff --name-only --cached -- $paths >"$tmp/filelist" - else - right_dir="working_tree" - git diff --name-only -- $paths >"$tmp/filelist" - fi -fi - -# Exit immediately if there are no diffs -if test ! -s "$tmp/filelist" -then - exit 0 -fi - -if test -n "$copy_back" && test "$right_dir" != "working_tree" -then - echo "--copy-back is only valid when diff includes the working tree." - exit 1 -fi - -# Create the named tmp directories that will hold the files to be compared -mkdir -p "$tmp/$left_dir" "$tmp/$right_dir" - -# Populate the tmp/right_dir directory with the files to be compared -while read name -do - if test -n "$right" - then - ls_list=$(git ls-tree $right "$name") - if test -n "$ls_list" - then - mkdir -p "$tmp/$right_dir/$(dirname "$name")" - git show "$right":"$name" >"$tmp/$right_dir/$name" || true - fi - elif test -n "$compare_staged" - then - ls_list=$(git ls-files -- "$name") - if test -n "$ls_list" - then - mkdir -p "$tmp/$right_dir/$(dirname "$name")" - git show :"$name" >"$tmp/$right_dir/$name" - fi - else - if test -e "$name" - then - mkdir -p "$tmp/$right_dir/$(dirname "$name")" - cp "$name" "$tmp/$right_dir/$name" - fi - fi -done < "$tmp/filelist" - -# Populate the tmp/left_dir directory with the files to be compared -while read name -do - if test -n "$left" - then - ls_list=$(git ls-tree $left "$name") - if test -n "$ls_list" - then - mkdir -p "$tmp/$left_dir/$(dirname "$name")" - git show "$left":"$name" >"$tmp/$left_dir/$name" || true - fi - else - if test -n "$compare_staged" - then - ls_list=$(git ls-tree HEAD "$name") - if test -n "$ls_list" - then - mkdir -p "$tmp/$left_dir/$(dirname "$name")" - git show HEAD:"$name" >"$tmp/$left_dir/$name" - fi - else - mkdir -p "$tmp/$left_dir/$(dirname "$name")" - git show :"$name" >"$tmp/$left_dir/$name" - fi - fi -done < "$tmp/filelist" - -LOCAL="$tmp/$left_dir" -REMOTE="$tmp/$right_dir" - -if test -n "$diff_tool" -then - export BASE - eval $diff_tool '"$LOCAL"' '"$REMOTE"' -else - run_merge_tool "$merge_tool" false -fi - -# Copy files back to the working dir, if requested -if test -n "$copy_back" && test "$right_dir" = "working_tree" -then - cd "$start_dir" - git_top_dir=$(git rev-parse --show-toplevel) - find "$tmp/$right_dir" -type f | - while read file - do - cp "$file" "$git_top_dir/${file#$tmp/$right_dir/}" - done +#!/bin/sh +# Copyright 2010 - 2012, Tim Henigan +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +# Perform a directory diff between commits in the repository using +# the external diff or merge tool specified in the user's config. + +USAGE='[--cached] [--copy-back] [-x|--extcmd=] {0,2} [-- *] + + --cached Compare to the index rather than the working tree. + + --copy-back Copy files back to the working tree when the diff + tool exits (in case they were modified by the + user). This option is only valid if the diff + compared with the working tree. + + -x= + --extcmd= Specify a custom command for viewing diffs. + git-diffall ignores the configured defaults and + runs $command $LOCAL $REMOTE when this option is + specified. Additionally, $BASE is set in the + environment. +' + +SUBDIRECTORY_OK=1 +. "$(git --exec-path)/git-sh-setup" + +TOOL_MODE=diff +. "$(git --exec-path)/git-mergetool--lib" + +merge_tool="$(get_merge_tool)" +if test -z "$merge_tool" +then + echo "Error: Either the 'diff.tool' or 'merge.tool' option must be set." + usage +fi + +start_dir=$(pwd) + +# All the file paths returned by the diff command are relative to the root +# of the working copy. So if the script is called from a subdirectory, it +# must switch to the root of working copy before trying to use those paths. +cdup=$(git rev-parse --show-cdup) && +cd "$cdup" || { + echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree" + exit 1 +} + +# set up temp dir +tmp=$(perl -e 'use File::Temp qw(tempdir); + $t=tempdir("/tmp/git-diffall.XXXXX") or exit(1); + print $t') || exit 1 +#trap 'rm -rf "$tmp"' EXIT + +left= +right= +paths= +dashdash_seen= +compare_staged= +merge_base= +left_dir= +right_dir= +diff_tool= +copy_back= + +while test $# != 0 +do + case "$1" in + -h|--h|--he|--hel|--help) + usage + ;; + --cached) + compare_staged=1 + ;; + --copy-back) + copy_back=1 + ;; + -x|--e|--ex|--ext|--extc|--extcm|--extcmd) + if test $# = 1 + then + echo You must specify the tool for use with --extcmd + usage + else + diff_tool=$2 + shift + fi + ;; + --) + dashdash_seen=1 + ;; + -*) + echo Invalid option: "$1" + usage + ;; + *) + # could be commit, commit range or path limiter + case "$1" in + *...*) + left=${1%...*} + right=${1#*...} + merge_base=1 + ;; + *..*) + left=${1%..*} + right=${1#*..} + ;; + *) + if test -n "$dashdash_seen" + then + paths="$paths$1 " + elif test -z "$left" + then + left=$1 + elif test -z "$right" + then + right=$1 + else + paths="$paths$1 " + fi + ;; + esac + ;; + esac + shift +done + +# Determine the set of files which changed +if test -n "$left" && test -n "$right" +then + left_dir="cmt-$(git rev-parse --short $left)" + right_dir="cmt-$(git rev-parse --short $right)" + + if test -n "$compare_staged" + then + usage + elif test -n "$merge_base" + then + git diff --name-only "$left"..."$right" -- $paths >"$tmp/filelist" + else + git diff --name-only "$left" "$right" -- $paths >"$tmp/filelist" + fi +elif test -n "$left" +then + left_dir="cmt-$(git rev-parse --short $left)" + + if test -n "$compare_staged" + then + right_dir="staged" + git diff --name-only --cached "$left" -- $paths >"$tmp/filelist" + else + right_dir="working_tree" + git diff --name-only "$left" -- $paths >"$tmp/filelist" + fi +else + left_dir="HEAD" + + if test -n "$compare_staged" + then + right_dir="staged" + git diff --name-only --cached -- $paths >"$tmp/filelist" + else + right_dir="working_tree" + git diff --name-only -- $paths >"$tmp/filelist" + fi +fi + +# Exit immediately if there are no diffs +if test ! -s "$tmp/filelist" +then + exit 0 +fi + +if test -n "$copy_back" && test "$right_dir" != "working_tree" +then + echo "--copy-back is only valid when diff includes the working tree." + exit 1 +fi + +# Create the named tmp directories that will hold the files to be compared +mkdir -p "$tmp/$left_dir" "$tmp/$right_dir" + +# Populate the tmp/right_dir directory with the files to be compared +while read name +do + if test -n "$right" + then + ls_list=$(git ls-tree $right "$name") + if test -n "$ls_list" + then + mkdir -p "$tmp/$right_dir/$(dirname "$name")" + git show "$right":"$name" >"$tmp/$right_dir/$name" || true + fi + elif test -n "$compare_staged" + then + ls_list=$(git ls-files -- "$name") + if test -n "$ls_list" + then + mkdir -p "$tmp/$right_dir/$(dirname "$name")" + git show :"$name" >"$tmp/$right_dir/$name" + fi + else + if test -e "$name" + then + mkdir -p "$tmp/$right_dir/$(dirname "$name")" + cp "$name" "$tmp/$right_dir/$name" + fi + fi +done < "$tmp/filelist" + +# Populate the tmp/left_dir directory with the files to be compared +while read name +do + if test -n "$left" + then + ls_list=$(git ls-tree $left "$name") + if test -n "$ls_list" + then + mkdir -p "$tmp/$left_dir/$(dirname "$name")" + git show "$left":"$name" >"$tmp/$left_dir/$name" || true + fi + else + if test -n "$compare_staged" + then + ls_list=$(git ls-tree HEAD "$name") + if test -n "$ls_list" + then + mkdir -p "$tmp/$left_dir/$(dirname "$name")" + git show HEAD:"$name" >"$tmp/$left_dir/$name" + fi + else + mkdir -p "$tmp/$left_dir/$(dirname "$name")" + git show :"$name" >"$tmp/$left_dir/$name" + fi + fi +done < "$tmp/filelist" + +LOCAL="$tmp/$left_dir" +REMOTE="$tmp/$right_dir" + +if test -n "$diff_tool" +then + export BASE + eval $diff_tool '"$LOCAL"' '"$REMOTE"' +else + run_merge_tool "$merge_tool" false +fi + +# Copy files back to the working dir, if requested +if test -n "$copy_back" && test "$right_dir" = "working_tree" +then + cd "$start_dir" + git_top_dir=$(git rev-parse --show-toplevel) + find "$tmp/$right_dir" -type f | + while read file + do + cp "$file" "$git_top_dir/${file#$tmp/$right_dir/}" + done fi \ No newline at end of file -- 2.43.0