From 397ce671bb028802d528faf8811101e08557e527 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Mar 2017 09:48:24 +0100 Subject: Re-structure tags to GNU stow format --- zsh/.config/zsh/.zshenv | 43 +++++++++ zsh/.config/zsh/.zshrc | 241 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 284 insertions(+) create mode 100644 zsh/.config/zsh/.zshenv create mode 100644 zsh/.config/zsh/.zshrc (limited to 'zsh/.config') diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv new file mode 100644 index 0000000..f1cad02 --- /dev/null +++ b/zsh/.config/zsh/.zshenv @@ -0,0 +1,43 @@ +if [[ $SHLVL -eq 1 || -n $DISPLAY ]] +then + if [[ -f $ZDOTDIR/zshenv.local ]] + then + . $ZDOTDIR/zshenv.local + fi + + if [[ -f $ZDOTDIR/zshenv.private ]] + then + . $ZDOTDIR/zshenv.private + fi + + ZPLUG_HOME=${ZPLUG_HOME:-~/projects/zplug} + + if [[ -z $SSH_AUTH_SOCK ]] + then + export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent + fi + + case $OSTYPE in + darwin*) + os=darwin + ;; + linux-gnu) + os=linux + ;; + freebsd*) + os=freebsd + ;; + *) + os=unknown + ;; + esac + + case $MACHTYPE in + *64) + arch=amd64 + ;; + *) + arch=386 + ;; + esac +fi diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 0000000..f2102b3 --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1,241 @@ +# -*- mode: sh; -*- +source $ZPLUG_HOME/init.zsh + +zplug "zsh-users/zsh-completions", depth:1, defer:0 +zplug "junegunn/fzf-bin", from:gh-r, as:command, rename-to:fzf +zplug "junegunn/fzf", as:plugin, use:"shell/*.zsh", defer:2 +zplug "junegunn/fzf", as:command, use:"bin/*" +zplug "caarlos0/zsh-open-pr", as:plugin +zplug "unixorn/tumult.plugin.zsh", as:plugin, if:"[[ $os -eq darwin ]]" +if [[ -n $commands[nix-env] ]] +then + zplug "spwhitt/nix-zsh-completions", as:plugin + fpath=($fpath $ZPLUG_REPOS/spwhitt/nix-zsh-completions) +fi + +zplug "gerges/oh-my-zsh-jira-plus", as:plugin, if:"[[ ${(SN)HOST%spotcap} ]]" +zplug "plugins/yarn", from:oh-my-zsh, defer:2, if:"[[ -n $commands[yarn] ]]", defer:2 +zplug "lukechilds/zsh-better-npm-completion", if:"[[ -n $commands[npm] ]]", defer:2 +zplug "hlissner/zsh-autopair", defer:2 + +HISTSIZE=3000 +SAVEHIST=10000 +HISTFILE=${XDG_CACHE_HOME:=$HOME/.cache}/zsh/history + +WORDCHARS=${${WORDCHARS//[-.]}//[\/]} + +if [[ ${path[(I)$HOME/bin ]} ]] +then + path+=($HOME/bin) +fi + +if [[ ${path[(I)$HOME/.local/bin ]} ]] +then + path+=($HOME/.local/bin) +fi + +if [[ -d /opt/local/share/zsh/site-functions ]] +then + fpath+=(/opt/local/share/zsh/site-functions) +fi + +export EDITOR=emacsclient +alias ec=emacsclient +alias open-project=projectile +_emacs_function () { + emacsclient -e "($1 \"$2\")" > /dev/null +} +projectile () { + _emacs_function projectile-switch-project-by-name ${1:-$PWD} +} +yarn () { + PREFIX=$HOME/.local command yarn "$@" +} + +ls='\ls' +gnu_ls_options="-v --group-directories-first --color=auto" +gnu_ls_isodate="--time-style=long-iso" +bsd_ls_options="-p" +bsd_ls_isodate="-D '%F %k:%M'" + +case $os in + darwin) + if [[ -n $commands[gls] ]] + then + ls='\gls' + ls_options=$gnu_ls_options + ls_isodate=$gnu_ls_isodate + else + ls_options=$bsd_ls_options + ls_isodate=$bsd_ls_isodate + fi + ;; + freebsd) + ls_options=$bsd_ls_options + ls_isodate=$bsd_ls_isodate + ;; + linux) + ls_options=$gnu_ls_options + ls_isodate=$gnu_ls_isodate + ;; +esac +alias l="${ls} ${ls_options} -Bp" +alias l1="${ls} ${ls_options} -1" +alias ls="${ls} ${ls_options} -hF" +alias la="${ls} ${ls_options} -hA" +alias ll="${ls} ${ls_options} ${ls_isodate} -hl" +alias lal="ll -A" +alias lla="lal" +alias llr="ll -t" + +zmodload zsh/terminfo + +bindkey '\e[3~' delete-char + +bindkey '\C-hd' describe-key-briefly + +backward-argument () { + local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" + zle backward-word +} + +forward-argument () { + local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" + zle forward-word +} + +kill-argument () { + local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\"" + zle backward-argument + zle kill-word +} + +zle -N backward-argument +zle -N forward-argument +zle -N kill-argument +bindkey '\e^b' backward-argument +bindkey '\e^f' forward-argument +bindkey '\e^k' kill-argument + +ds () { + du -hd1 $1 | sort -h +} + +zle -C hist-complete complete-word _generic +zstyle ':completion:hist-complete:*' completer _history +bindkey '\e ' hist-complete + +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}' +zstyle ':completion:*' completer _expand _complete _match + +if [[ -z $SSH_AUTH_SOCK && $commands[ssh-agent] ]] +then + eval $(ssh-agent) +fi + +# Then, source plugins and add commands to $PATH +zplug load + +# General configuration + +if [[ -n $commands[hub] ]] +then + alias git=hub + alias gh=hub +fi + +if [[ -n $commands[lunchy] ]] +then + LUNCHY_DIR=$(dirname $(gem which lunchy))/../extras + if [ -f $LUNCHY_DIR/lunchy-completion.zsh ]; then + . $LUNCHY_DIR/lunchy-completion.zsh + fi +fi + +if [[ $TERM == "dumb" ]] +then + unsetopt zle + PROMPT="> " +else + unset RPROMPT + # show username@host if logged in through SSH + [[ "$SSH_CONNECTION" != '' ]] && prompt_pure_username=' %F{242}%n@%m%f' + + # show username@host if root, with username in white + [[ $UID -eq 0 ]] && prompt_pure_username=' %F{white}%n%f%F{242}@%m%f' + + setopt prompt_subst + setopt prompt_cr + PROMPT='%F{blue}%~%f${prompt_pure_username} +%(?.%F{magenta}.%F{red})>%f ' + + ## From https://github.com/robbyrussell/oh-my-zsh/blob/71deb74552d54630d99ae1db3647ebed7b3bc735/lib/termsupport.zsh + + # Keep Apple Terminal.app's current working directory updated + # Based on this answer: http://superuser.com/a/315029 + # With extra fixes to handle multibyte chars and non-UTF-8 locales + + if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]]; then + # Emits the control sequence to notify Terminal.app of the cwd + # Identifies the directory using a file: URI scheme, including + # the host name to disambiguate local vs. remote paths. + function update_terminalapp_cwd() { + emulate -L zsh + + # Percent-encode the pathname. + # Percent-encode the pathname. + local URL_PATH='' + { + # Use LC_CTYPE=C to process text byte-by-byte. + local i ch hexch LC_CTYPE=C + for ((i = 1; i <= ${#PWD}; ++i)); do + ch="$PWD[i]" + if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then + URL_PATH+="$ch" + else + hexch=$(printf "%02X" "'$ch") + URL_PATH+="%$hexch" + fi + done + } + [[ $? != 0 ]] && return 1 + + printf '\e]7;%s\a' "file://$HOST$URL_PATH" + } + + # Use a precmd hook instead of a chpwd hook to avoid contaminating output + precmd_functions+=(update_terminalapp_cwd) + # Run once to get initial cwd set + update_terminalapp_cwd + fi + + function set_window_title { printf '\e]2;%s\a' "$1" } + + function update_window_title { + if [[ -n "$SSH_CONNECTION" || $UID -eq 0 ]] + then + set_window_title "$USER@$HOST" + else + set_window_title "" + fi + } + precmd_functions+=(update_window_title) +fi + +if zplug check junegunn/fzf +then + _fzf_compgen_path() { + echo "$1" + command find -L "$1" \ + -name .git -prune -o -name .svn -prune -o \( -type d -o -type f -o -type l \) \ + -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' + } + + _fzf_compgen_dir() { + command find -L "$1" \ + -name .git -prune -o -name .svn -prune -o -type d \ + -a -not -path "$1" -print 2> /dev/null | sed 's@^\./@@' + } +fi + +unsetopt flow_control # Let me use ^S and ^Q -- cgit 1.4.1 From 9fee193c12d92ab503f1ba334345f7e56c10f217 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 Mar 2017 10:01:23 +0100 Subject: Merge host-specific configuration to tags --- emacs/.emacs.d/private.el.gpg | Bin 0 -> 2288 bytes host-ap-spotcap.local/config/mpv/config | 11 ------- host-ap-spotcap.local/config/zsh/zshenv.local | 9 ------ host-ap-spotcap.local/emacs.d/private.el.gpg | Bin 2288 -> 0 bytes host-ap-spotcap.local/rcrc.local | 2 -- host-ap-spotcap.local/slate | 45 -------------------------- host-marvin/xmodmaprc | 20 ------------ host-prefect/Xresources | 4 --- host-prefect/rcrc.local | 2 -- mpv/.config/config | 11 +++++++ slate/.slate | 45 ++++++++++++++++++++++++++ xmodmap/xmodmaprc | 20 ++++++++++++ zsh/.config/zsh/.zshenv | 5 +++ zsh/.config/zsh/.zshrc | 6 ++++ 14 files changed, 87 insertions(+), 93 deletions(-) create mode 100644 emacs/.emacs.d/private.el.gpg delete mode 100644 host-ap-spotcap.local/config/mpv/config delete mode 100644 host-ap-spotcap.local/config/zsh/zshenv.local delete mode 100644 host-ap-spotcap.local/emacs.d/private.el.gpg delete mode 100644 host-ap-spotcap.local/rcrc.local delete mode 100644 host-ap-spotcap.local/slate delete mode 100644 host-marvin/xmodmaprc delete mode 100644 host-prefect/Xresources delete mode 100644 host-prefect/rcrc.local create mode 100644 mpv/.config/config create mode 100644 slate/.slate create mode 100644 xmodmap/xmodmaprc (limited to 'zsh/.config') diff --git a/emacs/.emacs.d/private.el.gpg b/emacs/.emacs.d/private.el.gpg new file mode 100644 index 0000000..784a023 Binary files /dev/null and b/emacs/.emacs.d/private.el.gpg differ diff --git a/host-ap-spotcap.local/config/mpv/config b/host-ap-spotcap.local/config/mpv/config deleted file mode 100644 index 56c6d99..0000000 --- a/host-ap-spotcap.local/config/mpv/config +++ /dev/null @@ -1,11 +0,0 @@ -[default] - -vo=opengl-hq:backend=cocoa -ao=coreaudio - -hwdec=videotoolbox - -alang=en,eng,de,ger - -ytdl -ytdl-format=best diff --git a/host-ap-spotcap.local/config/zsh/zshenv.local b/host-ap-spotcap.local/config/zsh/zshenv.local deleted file mode 100644 index af63e1b..0000000 --- a/host-ap-spotcap.local/config/zsh/zshenv.local +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode: sh; -*- -if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] -then - . $HOME/.nix-profile/etc/profile.d/nix.sh; -fi - -JIRA_RAPID_BOARD=true -JIRA_URL=https://spotcap.atlassian.net -EMAIL=alan.pearce@spotcap.com diff --git a/host-ap-spotcap.local/emacs.d/private.el.gpg b/host-ap-spotcap.local/emacs.d/private.el.gpg deleted file mode 100644 index 784a023..0000000 Binary files a/host-ap-spotcap.local/emacs.d/private.el.gpg and /dev/null differ diff --git a/host-ap-spotcap.local/rcrc.local b/host-ap-spotcap.local/rcrc.local deleted file mode 100644 index 4639c9e..0000000 --- a/host-ap-spotcap.local/rcrc.local +++ /dev/null @@ -1,2 +0,0 @@ -DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git global tmux zsh" \ No newline at end of file diff --git a/host-ap-spotcap.local/slate b/host-ap-spotcap.local/slate deleted file mode 100644 index e8c675d..0000000 --- a/host-ap-spotcap.local/slate +++ /dev/null @@ -1,45 +0,0 @@ -config keyboardLayout colemak - -config defaultToCurrentScreen true -config nudgePercentOf screenSize -config resizePercentOf screenSize - -config windowHintsSpread true - -alias mon-laptop 1680x1050 -alias mon-work 1920x1200 -alias mon-home 2560x1440 - -alias 1-full throw 0 resize -alias 1-left push left bar-resize:screenSizeX/2 0 -alias 1-right push right bar-resize:screenSizeX/2 0 -alias 2-left push left bar-resize:screenSizeX/2 1 -alias 2-right push right bar-resize:screenSizeX/2 1 - -# Push Bindings -bind right:alt;cmd push right bar-resize:screenSizeX/2 -bind left:alt;cmd push left bar-resize:screenSizeX/2 -bind up:alt;cmd push up bar-resize:screenSizeY/2 -bind down:alt;cmd push down bar-resize:screenSizeY/2 - -# Throw Bindings -bind 1:ctrl;alt throw 0 resize -bind 2:ctrl;alt throw 1 resize -bind 3:ctrl;alt throw 2 resize -bind right:ctrl;alt;cmd throw right resize -bind left:ctrl;alt;cmd throw left resize -bind up:ctrl;alt;cmd throw up resize -bind down:ctrl;alt;cmd throw down resize - -bind f:cmd;shift move screenOriginX;screenOriginY screenSizeX;screenSizeY - -# Focus Bindings -bind right:cmd;shift focus right -bind left:cmd;shift focus left -# bind up:cmd;shift focus up -# bind down:cmd;shift focus down -bind up:cmd;shift focus behind -bind down:cmd;shift focus behind - -# Window Hints -bind esc:cmd hint setnriao diff --git a/host-marvin/xmodmaprc b/host-marvin/xmodmaprc deleted file mode 100644 index 82a8674..0000000 --- a/host-marvin/xmodmaprc +++ /dev/null @@ -1,20 +0,0 @@ -keycode 37 = Super_L NoSymbol Super_L -keycode 133 = Alt_L Meta_L Alt_L Meta_L -keycode 64 = Control_L NoSymbol Control_L - -! Thinkpad has PrtSc next to Alt_R -keycode 108 = Control_R NoSymbol Control_R -keycode 107 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift -keycode 105 = Super_R NoSymbol Super_R -! For external keyboards -keycode 134 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift - -clear Control -clear Mod1 -clear Mod3 -clear Mod4 - -add Control = Control_L Control_R -add Mod1 = Alt_L Meta_L -add Mod4 = Super_L Super_R Super_L Hyper_L -add Mod5 = ISO_Level3_Shift Mode_switch \ No newline at end of file diff --git a/host-prefect/Xresources b/host-prefect/Xresources deleted file mode 100644 index c89d486..0000000 --- a/host-prefect/Xresources +++ /dev/null @@ -1,4 +0,0 @@ -#include "main" - -Emacs.Font: -xos4-Terminus-normal-normal-normal-*-14-*-*-*-*-*-*-* -Emacs.fixed-pitch.attributeFont: -xos4-Terminus-normal-normal-normal-*-14-*-*-*-*-*-*-* diff --git a/host-prefect/rcrc.local b/host-prefect/rcrc.local deleted file mode 100644 index 3b80dd6..0000000 --- a/host-prefect/rcrc.local +++ /dev/null @@ -1,2 +0,0 @@ -DOTFILES_DIRS="$HOME/projects/dotfiles" -TAGS="emacs git hg clojure ssh zsh" diff --git a/mpv/.config/config b/mpv/.config/config new file mode 100644 index 0000000..56c6d99 --- /dev/null +++ b/mpv/.config/config @@ -0,0 +1,11 @@ +[default] + +vo=opengl-hq:backend=cocoa +ao=coreaudio + +hwdec=videotoolbox + +alang=en,eng,de,ger + +ytdl +ytdl-format=best diff --git a/slate/.slate b/slate/.slate new file mode 100644 index 0000000..e8c675d --- /dev/null +++ b/slate/.slate @@ -0,0 +1,45 @@ +config keyboardLayout colemak + +config defaultToCurrentScreen true +config nudgePercentOf screenSize +config resizePercentOf screenSize + +config windowHintsSpread true + +alias mon-laptop 1680x1050 +alias mon-work 1920x1200 +alias mon-home 2560x1440 + +alias 1-full throw 0 resize +alias 1-left push left bar-resize:screenSizeX/2 0 +alias 1-right push right bar-resize:screenSizeX/2 0 +alias 2-left push left bar-resize:screenSizeX/2 1 +alias 2-right push right bar-resize:screenSizeX/2 1 + +# Push Bindings +bind right:alt;cmd push right bar-resize:screenSizeX/2 +bind left:alt;cmd push left bar-resize:screenSizeX/2 +bind up:alt;cmd push up bar-resize:screenSizeY/2 +bind down:alt;cmd push down bar-resize:screenSizeY/2 + +# Throw Bindings +bind 1:ctrl;alt throw 0 resize +bind 2:ctrl;alt throw 1 resize +bind 3:ctrl;alt throw 2 resize +bind right:ctrl;alt;cmd throw right resize +bind left:ctrl;alt;cmd throw left resize +bind up:ctrl;alt;cmd throw up resize +bind down:ctrl;alt;cmd throw down resize + +bind f:cmd;shift move screenOriginX;screenOriginY screenSizeX;screenSizeY + +# Focus Bindings +bind right:cmd;shift focus right +bind left:cmd;shift focus left +# bind up:cmd;shift focus up +# bind down:cmd;shift focus down +bind up:cmd;shift focus behind +bind down:cmd;shift focus behind + +# Window Hints +bind esc:cmd hint setnriao diff --git a/xmodmap/xmodmaprc b/xmodmap/xmodmaprc new file mode 100644 index 0000000..82a8674 --- /dev/null +++ b/xmodmap/xmodmaprc @@ -0,0 +1,20 @@ +keycode 37 = Super_L NoSymbol Super_L +keycode 133 = Alt_L Meta_L Alt_L Meta_L +keycode 64 = Control_L NoSymbol Control_L + +! Thinkpad has PrtSc next to Alt_R +keycode 108 = Control_R NoSymbol Control_R +keycode 107 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift +keycode 105 = Super_R NoSymbol Super_R +! For external keyboards +keycode 134 = ISO_Level3_Shift NoSymbol ISO_Level3_Shift + +clear Control +clear Mod1 +clear Mod3 +clear Mod4 + +add Control = Control_L Control_R +add Mod1 = Alt_L Meta_L +add Mod4 = Super_L Super_R Super_L Hyper_L +add Mod5 = ISO_Level3_Shift Mode_switch \ No newline at end of file diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index f1cad02..0be5a7a 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -17,6 +17,11 @@ then export SSH_AUTH_SOCK=${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent fi + if [[ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]] + then + . $HOME/.nix-profile/etc/profile.d/nix.sh; + fi + case $OSTYPE in darwin*) os=darwin diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index f2102b3..8a9c806 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -133,6 +133,12 @@ then eval $(ssh-agent) fi +if zplug check gerges/oh-my-zsh-jira-plus +then + JIRA_RAPID_BOARD=true + JIRA_URL=https://spotcap.atlassian.net +fi + # Then, source plugins and add commands to $PATH zplug load -- cgit 1.4.1 From 53f50286e177abb9d1ac4a7c239dcbcc3fed63b7 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 20 Mar 2017 15:11:06 +0100 Subject: Emacs/zsh: Enable GNU Global if available --- emacs/.emacs.d/init.org | 2 +- zsh/.config/zsh/.zshenv | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'zsh/.config') diff --git a/emacs/.emacs.d/init.org b/emacs/.emacs.d/init.org index 880e4bc..7578c72 100644 --- a/emacs/.emacs.d/init.org +++ b/emacs/.emacs.d/init.org @@ -1736,7 +1736,7 @@ A nice completion backend for programming modes. #+BEGIN_SRC emacs-lisp (use-package ggtags - :disabled t + :if (executable-find "gtags") :commands turn-on-ggtags-mode :functions (ggtags-navigation-mode-abort) :config (progn diff --git a/zsh/.config/zsh/.zshenv b/zsh/.config/zsh/.zshenv index 0be5a7a..512dc56 100644 --- a/zsh/.config/zsh/.zshenv +++ b/zsh/.config/zsh/.zshenv @@ -45,4 +45,7 @@ then arch=386 ;; esac + + export GTAGSCONF=~/.globalrc + export GTAGSLABEL=ctags fi -- cgit 1.4.1