diff --git a/.gitconfig b/.gitconfig index ad71a9e..7cdbfa3 100644 --- a/.gitconfig +++ b/.gitconfig @@ -18,14 +18,9 @@ vimdiff = difftool -y -t vimdiff # tricks from https://www.durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/ - - # show vimdiff of the commit, for all files in the commit - diffc = "!f() { git diff ${1}^1 ${1}; }; f" - vimdiffc = "!f() { git vimdiff ${1}^1 ${1}; }; f" - - # show diff for file in the commit - diffcf = "!f() { git diff ${1}^1 ${1} -- $2; }; f" - vimdiffcf = "!f() { git vimdiff ${1}^1 ${1} -- $2; }; f" + # if no file is specified, show diff for all files in the changeset + diffc = "!f() { git diff ${1}^1 ${1} -- $2; }; f" + vimdiffc = "!f() { git vimdiff ${1}^1 ${1} -- $2; }; f" [user] name = Petr Nyc @@ -33,7 +28,3 @@ [merge] tool = vimdiff - -[user] - email = jet.jetpac@gmail.com - name = Petr Nyc diff --git a/.zshenv b/.zshenv index 4e4e7ba..8153a96 100644 --- a/.zshenv +++ b/.zshenv @@ -8,6 +8,7 @@ alias oe='open /Applications/Emacs.app' alias config='/usr/bin/git --git-dir=$HOME/.cfg/.git/ --work-tree=$HOME' alias -g N="2>&1 " # export PATH=$HOME/.rd/bin +# # for gems installed in my home direcotry @@ -37,7 +38,7 @@ function print_st() { } function set_iterm_profile() { - readonly profile=${1:?"The port must be specified."} + readonly profile=${1:?"The profile must be specified."} print_osc printf "1337;SetProfile=$profile" print_st @@ -45,18 +46,18 @@ function set_iterm_profile() { function set_tmux_profile() { if [[ -n $TMUX ]]; then - profile=${1:?"The port must be specified."} + profile=${1:?"The profile must be specified."} tmux source-file $HOME/.tmux/plugins/tmux-colors-solarized/tmuxcolors-${profile}.conf fi } function set_dark() { - set_iterm_profile 'Dark' + set_iterm_profile 'Solarized Dark' set_tmux_profile 'dark' } function set_light() { - set_iterm_profile 'Light' + set_iterm_profile 'Solarized Light' set_tmux_profile 'light' } diff --git a/.zshrc b/.zshrc index bbd2f3e..84dbce8 100644 --- a/.zshrc +++ b/.zshrc @@ -96,6 +96,13 @@ source $ZSH/oh-my-zsh.sh # User configuration +# if on macos: +if [[ "$OSTYPE" == "darwin"* ]]; then + touch /tmp/darwin + export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD +fi + + # export MANPATH="/usr/local/man:$MANPATH" # You may need to manually set your language environment diff --git a/Library/Application Support/iTerm2/DynamicProfiles/solarized_dark.json b/Library/Application Support/iTerm2/DynamicProfiles/solarized_dark.json new file mode 100644 index 0000000..b9b0ce9 --- /dev/null +++ b/Library/Application Support/iTerm2/DynamicProfiles/solarized_dark.json @@ -0,0 +1,169 @@ +{ + "Profiles": [ + { + "Name": "Solarized Dark", + "Guid": "EAAE4823-98F2-4CF1-909C-E2C37013889C", + "Dynamic Profile Parent Name": "tmux keys", + "Badge Color" : { + "Red Component" : 1, + "Color Space" : "sRGB", + "Blue Component" : 0, + "Alpha Component" : 0.5, + "Green Component" : 0.14910027384757996 + }, + "Selected Text Color" : { + "Red Component" : 0.57647058823529407, + "Color Space" : "sRGB", + "Blue Component" : 0.63137254901960782, + "Green Component" : 0.63137254901960782 + }, + "Foreground Color" : { + "Red Component" : 0.51372549019607838, + "Color Space" : "sRGB", + "Blue Component" : 0.58823529411764708, + "Green Component" : 0.58039215686274515 + }, + "Selection Color" : { + "Red Component" : 0.027450980392156862, + "Color Space" : "sRGB", + "Blue Component" : 0.25882352941176473, + "Green Component" : 0.21176470588235294 + }, + "Cursor Guide Color" : { + "Red Component" : 0.70214027166366577, + "Color Space" : "sRGB", + "Blue Component" : 1, + "Alpha Component" : 0.25, + "Green Component" : 0.92681378126144409 + }, + "Link Color" : { + "Red Component" : 0, + "Color Space" : "sRGB", + "Blue Component" : 0.73422712087631226, + "Alpha Component" : 1, + "Green Component" : 0.35915297269821167 + }, + "Bold Color" : { + "Red Component" : 0.57647058823529407, + "Color Space" : "sRGB", + "Blue Component" : 0.63137254901960782, + "Green Component" : 0.63137254901960782 + }, + "Cursor Text Color" : { + "Red Component" : 0.027450980392156862, + "Color Space" : "sRGB", + "Blue Component" : 0.25882352941176473, + "Green Component" : 0.21176470588235294 + }, + "Cursor Color" : { + "Red Component" : 0.51372549019607838, + "Color Space" : "sRGB", + "Blue Component" : 0.58823529411764708, + "Green Component" : 0.58039215686274515 + }, + "Background Color" : { + "Red Component" : 0, + "Color Space" : "sRGB", + "Blue Component" : 0.21176470588235294, + "Green Component" : 0.16862745098039217 + }, + "Ansi 0 Color" : { + "Red Component" : 0.027450980392156862, + "Color Space" : "sRGB", + "Blue Component" : 0.25882352941176473, + "Green Component" : 0.21176470588235294 + }, + "Ansi 1 Color" : { + "Red Component" : 0.86274509803921573, + "Color Space" : "sRGB", + "Blue Component" : 0.18431372549019609, + "Green Component" : 0.19607843137254902 + }, + "Ansi 2 Color" : { + "Red Component" : 0.52156862745098043, + "Color Space" : "sRGB", + "Blue Component" : 0, + "Green Component" : 0.59999999999999998 + }, + "Ansi 3 Color" : { + "Red Component" : 0.70980392156862748, + "Color Space" : "sRGB", + "Blue Component" : 0, + "Green Component" : 0.53725490196078429 + }, + "Ansi 4 Color" : { + "Red Component" : 0.14901960784313725, + "Color Space" : "sRGB", + "Blue Component" : 0.82352941176470584, + "Green Component" : 0.54509803921568623 + }, + + "Ansi 5 Color" : { + "Red Component" : 0.82745098039215681, + "Color Space" : "sRGB", + "Blue Component" : 0.50980392156862742, + "Green Component" : 0.21176470588235294 + }, + "Ansi 6 Color" : { + "Red Component" : 0.16470588235294117, + "Color Space" : "sRGB", + "Blue Component" : 0.59607843137254901, + "Green Component" : 0.63137254901960782 + }, + "Ansi 7 Color" : { + "Red Component" : 0.93333333333333335, + "Color Space" : "sRGB", + "Blue Component" : 0.83529411764705885, + "Green Component" : 0.90980392156862744 + }, + "Ansi 8 Color" : { + "Red Component" : 0, + "Color Space" : "sRGB", + "Blue Component" : 0.21176470588235294, + "Green Component" : 0.16862745098039217 + }, + "Ansi 9 Color" : { + "Red Component" : 0.79607843137254897, + "Color Space" : "sRGB", + "Blue Component" : 0.086274509803921567, + "Green Component" : 0.29411764705882354 + }, + "Ansi 10 Color" : { + "Red Component" : 0.34509803921568627, + "Color Space" : "sRGB", + "Blue Component" : 0.45882352941176469, + "Green Component" : 0.43137254901960786 + }, + "Ansi 11 Color" : { + "Red Component" : 0.396078431372549, + "Color Space" : "sRGB", + "Blue Component" : 0.51372549019607838, + "Green Component" : 0.4823529411764706 + }, + "Ansi 12 Color" : { + "Red Component" : 0.51372549019607838, + "Color Space" : "sRGB", + "Blue Component" : 0.58823529411764708, + "Green Component" : 0.58039215686274515 + }, + "Ansi 13 Color" : { + "Red Component" : 0.42352941176470588, + "Color Space" : "sRGB", + "Blue Component" : 0.7686274509803922, + "Green Component" : 0.44313725490196076 + }, + "Ansi 14 Color" : { + "Red Component" : 0.57647058823529407, + "Color Space" : "sRGB", + "Blue Component" : 0.63137254901960782, + "Green Component" : 0.63137254901960782 + }, + "Ansi 15 Color" : { + "Red Component" : 0.99215686274509807, + "Color Space" : "sRGB", + "Blue Component" : 0.8901960784313725, + "Green Component" : 0.96470588235294119 + }, + } + ] +} diff --git a/Library/Application Support/iTerm2/DynamicProfiles/solarized_light.json b/Library/Application Support/iTerm2/DynamicProfiles/solarized_light.json new file mode 100644 index 0000000..27692db --- /dev/null +++ b/Library/Application Support/iTerm2/DynamicProfiles/solarized_light.json @@ -0,0 +1,169 @@ +{ + "Profiles": [ + { + "Name": "Solarized Light", + "Guid": "6B52A877-EDA5-4079-83BD-8B3CDB05F4D5", + "Dynamic Profile Parent Name": "tmux keys", + "Badge Color" : { + "Red Component" : 1, + "Color Space" : "sRGB", + "Blue Component" : 0, + "Alpha Component" : 0.5, + "Green Component" : 0.14910027384757996 + }, + "Selected Text Color" : { + "Red Component" : 0.34509803921568627, + "Color Space" : "sRGB", + "Blue Component" : 0.45882352941176469, + "Green Component" : 0.43137254901960786 + }, + "Foreground Color" : { + "Red Component" : 0.396078431372549, + "Color Space" : "sRGB", + "Blue Component" : 0.51372549019607838, + "Green Component" : 0.4823529411764706 + }, + "Selection Color" : { + "Red Component" : 0.93333333333333335, + "Color Space" : "sRGB", + "Blue Component" : 0.83529411764705885, + "Green Component" : 0.90980392156862744 + }, + "Cursor Guide Color" : { + "Red Component" : 0.70214027166366577, + "Color Space" : "sRGB", + "Blue Component" : 1, + "Alpha Component" : 0.25, + "Green Component" : 0.92681378126144409 + }, + "Link Color" : { + "Red Component" : 0, + "Color Space" : "sRGB", + "Blue Component" : 0.73422712087631226, + "Alpha Component" : 1, + "Green Component" : 0.35915297269821167 + }, + "Bold Color" : { + "Red Component" : 0.34509803921568627, + "Color Space" : "sRGB", + "Blue Component" : 0.45882352941176469, + "Green Component" : 0.43137254901960786 + }, + "Cursor Text Color" : { + "Red Component" : 0.93333333333333335, + "Color Space" : "sRGB", + "Blue Component" : 0.83529411764705885, + "Green Component" : 0.90980392156862744 + }, + "Cursor Color" : { + "Red Component" : 0.396078431372549, + "Color Space" : "sRGB", + "Blue Component" : 0.51372549019607838, + "Green Component" : 0.4823529411764706 + }, + "Background Color" : { + "Red Component" : 0.99215686274509807, + "Color Space" : "sRGB", + "Blue Component" : 0.8901960784313725, + "Green Component" : 0.96470588235294119 + }, + "Ansi 0 Color" : { + "Red Component" : 0.027450980392156862, + "Color Space" : "sRGB", + "Blue Component" : 0.25882352941176473, + "Green Component" : 0.21176470588235294 + }, + "Ansi 1 Color" : { + "Red Component" : 0.86274509803921573, + "Color Space" : "sRGB", + "Blue Component" : 0.18431372549019609, + "Green Component" : 0.19607843137254902 + }, + "Ansi 2 Color" : { + "Red Component" : 0.52156862745098043, + "Color Space" : "sRGB", + "Blue Component" : 0, + "Green Component" : 0.59999999999999998 + }, + "Ansi 3 Color" : { + "Red Component" : 0.70980392156862748, + "Color Space" : "sRGB", + "Blue Component" : 0, + "Green Component" : 0.53725490196078429 + }, + "Ansi 4 Color" : { + "Red Component" : 0.14901960784313725, + "Color Space" : "sRGB", + "Blue Component" : 0.82352941176470584, + "Green Component" : 0.54509803921568623 + }, + + "Ansi 5 Color" : { + "Red Component" : 0.82745098039215681, + "Color Space" : "sRGB", + "Blue Component" : 0.50980392156862742, + "Green Component" : 0.21176470588235294 + }, + "Ansi 6 Color" : { + "Red Component" : 0.16470588235294117, + "Color Space" : "sRGB", + "Blue Component" : 0.59607843137254901, + "Green Component" : 0.63137254901960782 + }, + "Ansi 7 Color" : { + "Red Component" : 0.93333333333333335, + "Color Space" : "sRGB", + "Blue Component" : 0.83529411764705885, + "Green Component" : 0.90980392156862744 + }, + "Ansi 8 Color" : { + "Red Component" : 0, + "Color Space" : "sRGB", + "Blue Component" : 0.21176470588235294, + "Green Component" : 0.16862745098039217 + }, + "Ansi 9 Color" : { + "Red Component" : 0.79607843137254897, + "Color Space" : "sRGB", + "Blue Component" : 0.086274509803921567, + "Green Component" : 0.29411764705882354 + }, + "Ansi 10 Color" : { + "Red Component" : 0.34509803921568627, + "Color Space" : "sRGB", + "Blue Component" : 0.45882352941176469, + "Green Component" : 0.43137254901960786 + }, + "Ansi 11 Color" : { + "Red Component" : 0.396078431372549, + "Color Space" : "sRGB", + "Blue Component" : 0.51372549019607838, + "Green Component" : 0.4823529411764706 + }, + "Ansi 12 Color" : { + "Red Component" : 0.51372549019607838, + "Color Space" : "sRGB", + "Blue Component" : 0.58823529411764708, + "Green Component" : 0.58039215686274515 + }, + "Ansi 13 Color" : { + "Red Component" : 0.42352941176470588, + "Color Space" : "sRGB", + "Blue Component" : 0.7686274509803922, + "Green Component" : 0.44313725490196076 + }, + "Ansi 14 Color" : { + "Red Component" : 0.57647058823529407, + "Color Space" : "sRGB", + "Blue Component" : 0.63137254901960782, + "Green Component" : 0.63137254901960782 + }, + "Ansi 15 Color" : { + "Red Component" : 0.99215686274509807, + "Color Space" : "sRGB", + "Blue Component" : 0.8901960784313725, + "Green Component" : 0.96470588235294119 + }, + } + ] +} diff --git a/Library/Application Support/iTerm2/DynamicProfiles/dynamic_profile.json b/Library/Application Support/iTerm2/DynamicProfiles/tmux_keys.json similarity index 100% rename from Library/Application Support/iTerm2/DynamicProfiles/dynamic_profile.json rename to Library/Application Support/iTerm2/DynamicProfiles/tmux_keys.json diff --git a/bin/print256colors.sh b/bin/print256colors.sh new file mode 100755 index 0000000..99e3d8c --- /dev/null +++ b/bin/print256colors.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +# Tom Hale, 2016. MIT Licence. +# Print out 256 colours, with each number printed in its corresponding colour +# See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163 + +set -eu # Fail on errors or undeclared variables + +printable_colours=256 + +# Return a colour that contrasts with the given colour +# Bash only does integer division, so keep it integral +function contrast_colour { + local r g b luminance + colour="$1" + + if (( colour < 16 )); then # Initial 16 ANSI colours + (( colour == 0 )) && printf "15" || printf "0" + return + fi + + # Greyscale # rgb_R = rgb_G = rgb_B = (number - 232) * 10 + 8 + if (( colour > 231 )); then # Greyscale ramp + (( colour < 244 )) && printf "15" || printf "0" + return + fi + + # All other colours: + # 6x6x6 colour cube = 16 + 36*R + 6*G + B # Where RGB are [0..5] + # See http://stackoverflow.com/a/27165165/5353461 + + # r=$(( (colour-16) / 36 )) + g=$(( ((colour-16) % 36) / 6 )) + # b=$(( (colour-16) % 6 )) + + # If luminance is bright, print number in black, white otherwise. + # Green contributes 587/1000 to human perceived luminance - ITU R-REC-BT.601 + (( g > 2)) && printf "0" || printf "15" + return + + # Uncomment the below for more precise luminance calculations + + # # Calculate percieved brightness + # # See https://www.w3.org/TR/AERT#color-contrast + # # and http://www.itu.int/rec/R-REC-BT.601 + # # Luminance is in range 0..5000 as each value is 0..5 + # luminance=$(( (r * 299) + (g * 587) + (b * 114) )) + # (( $luminance > 2500 )) && printf "0" || printf "15" +} + +# Print a coloured block with the number of that colour +function print_colour { + local colour="$1" contrast + contrast=$(contrast_colour "$1") + printf "\e[48;5;%sm" "$colour" # Start block of colour + printf "\e[38;5;%sm%3d" "$contrast" "$colour" # In contrast, print number + printf "\e[0m " # Reset colour +} + +# Starting at $1, print a run of $2 colours +function print_run { + local i + for (( i = "$1"; i < "$1" + "$2" && i < printable_colours; i++ )) do + print_colour "$i" + done + printf " " +} + +# Print blocks of colours +function print_blocks { + local start="$1" i + local end="$2" # inclusive + local block_cols="$3" + local block_rows="$4" + local blocks_per_line="$5" + local block_length=$((block_cols * block_rows)) + + # Print sets of blocks + for (( i = start; i <= end; i += (blocks_per_line-1) * block_length )) do + printf "\n" # Space before each set of blocks + # For each block row + for (( row = 0; row < block_rows; row++ )) do + # Print block columns for all blocks on the line + for (( block = 0; block < blocks_per_line; block++ )) do + print_run $(( i + (block * block_length) )) "$block_cols" + done + (( i += block_cols )) # Prepare to print the next row + printf "\n" + done + done +} + +print_run 0 16 # The first 16 colours are spread over the whole spectrum +printf "\n" +print_blocks 16 231 6 6 3 # 6x6x6 colour cube between 16 and 231 inclusive +print_blocks 232 255 12 2 1 # Not 50, but 24 Shades of Grey