From 4a07639c42de054c11a513526d879b717667f009 Mon Sep 17 00:00:00 2001 From: Anthony Cicchetti Date: Tue, 21 Apr 2020 09:39:00 -0400 Subject: [PATCH] Zsh updates --- zsh/funcs/skim.funcs | 13 ++++++------- zsh/zshrc | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/zsh/funcs/skim.funcs b/zsh/funcs/skim.funcs index baf3549..b04dedc 100644 --- a/zsh/funcs/skim.funcs +++ b/zsh/funcs/skim.funcs @@ -1,8 +1,6 @@ -# export SKIM_DEFAULT_COMMAND="rg --files" # Key bindings # ------------ # copied and modified from https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh -# if [[ $- == *i* ]]; then # CTRL-T - Paste the selected file path(s) into the command line @@ -11,7 +9,7 @@ __fsel() { -o -type f -print \ -o -type d -print \ -o -type l -print 2> /dev/null | cut -b3-"}" - setopt localoptions pipefail 2> /dev/null + setopt localoptions pipefail no_aliases 2> /dev/null eval "$cmd" | SKIM_DEFAULT_OPTIONS="--height ${SKIM_TMUX_HEIGHT:-40%} --reverse $SKIM_DEFAULT_OPTIONS $SKIM_CTRL_T_OPTS" $(__skimcmd) -m "$@" | while read item; do echo -n "${(q)item} " done @@ -36,7 +34,7 @@ skim-file-widget() { return $ret } zle -N skim-file-widget -bindkey '^P' skim-file-widget +bindkey '^T' skim-file-widget # Ensure precmds are run after cd skim-redraw-prompt() { @@ -52,13 +50,14 @@ zle -N skim-redraw-prompt skim-cd-widget() { local cmd="${SKIM_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ -o -type d -print 2> /dev/null | cut -b3-"}" - setopt localoptions pipefail 2> /dev/null + setopt localoptions pipefail no_aliases 2> /dev/null local dir="$(eval "$cmd" | SKIM_DEFAULT_OPTIONS="--height ${SKIM_TMUX_HEIGHT:-40%} --reverse $SKIM_DEFAULT_OPTIONS $SKIM_ALT_C_OPTS" $(__skimcmd) -m)" if [[ -z "$dir" ]]; then zle redisplay return 0 fi cd "$dir" + unset dir # ensure this doesn't end up appearing in prompt expansion local ret=$? zle skim-redraw-prompt return $ret @@ -69,9 +68,9 @@ bindkey '\ec' skim-cd-widget # CTRL-R - Paste the selected command from history into the command line skim-history-widget() { local selected num - setopt localoptions noglobsubst noposixbuiltins pipefail 2> /dev/null + setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null selected=( $(fc -rl 1 | - SKIM_DEFAULT_OPTIONS="--height ${SKIM_TMUX_HEIGHT:-40%} $SKIM_DEFAULT_OPTIONS -n2..,.. --tiebreak=index $SKIM_CTRL_R_OPTS --query=${(qqq)LBUFFER} -m" $(__skimcmd)) ) + SKIM_DEFAULT_OPTIONS="--height ${SKIM_TMUX_HEIGHT:-40%} $SKIM_DEFAULT_OPTIONS -n2..,.. --tiebreak=score,index $SKIM_CTRL_R_OPTS --query=${(qqq)LBUFFER} -m" $(__skimcmd)) ) local ret=$? if [ -n "$selected" ]; then num=$selected[1] diff --git a/zsh/zshrc b/zsh/zshrc index c55a316..5d13bf8 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -82,7 +82,7 @@ function nv() { export PATH="$PATH:$HOME/.anyenv/bin" eval "$(anyenv init -)" export PATH="$(yarn global bin):$PATH" -# export SKIM_TMUX=1 +export SKIM_TMUX=1 #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! export SDKMAN_DIR="$HOME/.sdkman"