From a3fe85770fc1b966b149404fb848b5e047008066 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 13 Jun 2022 22:56:05 +0200 Subject: [PATCH] config/shell: try emacsclient and fzy --- .config/shell/functions | 5 +++-- .zshenv | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index 8cd94c2..33776f2 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -105,7 +105,7 @@ edshell() { (*) file="$(find $CONFIG_SHELLS -name "$1*" | head -1 | grep . || echo "$CONFIG_SHELLS/$1")";; esac test -f "$file" && checksum="$(md5sum "$file")" - $EDITOR "$(test "$line" && case "$EDITOR" in (nvim) echo "+normal! ${line}ggzx";; (*vi*) echo "+$line";; esac || echo "--")" "${file%:*}" + $EDITOR "$(test "$line" && case "$EDITOR" in (nvim) echo "+normal! ${line}ggzx";; (*vi*) echo "+$line";; (emacs*) echo "+${line}";; esac || echo "--")" "${file%:*}" test -s "$file" || return 1 test "$checksum" != "$(md5sum $file)" && rs } @@ -294,7 +294,8 @@ alias hx='sudo hexedit --maximize --color' # Paginated hexyl hex() { hexyl "$@" | "${PAGER:-less}"; } -alias dic="cat $XDG_DATA_HOME/dictcc/dict.txt | sed '/#/d;/&/d;/^$/d' | fzf --tiebreak=length --bind='alt-bspace:clear-query'" +alias dic="cat $XDG_DATA_HOME/dictcc/dict.txt | sed '/#/d;/&/d;/^$/d' | fzy" +#fzf --tiebreak=length --bind='alt-bspace:clear-query' alias dict="rlwrap rdictcc -d $XDG_DATA_HOME/dictcc" alias dictu="dict -i $XDG_DATA_HOME/dictcc/dict.txt" diff --git a/.zshenv b/.zshenv index 98725b4..2ff46fd 100644 --- a/.zshenv +++ b/.zshenv @@ -63,7 +63,17 @@ mkdir -p "$XDG_STATE_HOME/zsh" # environment export PATH="$HOME/.local/bin/scripts:$HOME/.local/bin:$PATH:$XDG_CONFIG_HOME/emacs/bin:$GOPATH/bin:$XDG_DATA_HOME/gem/ruby/3.0.0/bin:$ANDROID_SDK_ROOT/platform-tools:$CARGO_HOME/bin" -which nvim >/dev/null && export EDITOR='nvim' || export EDITOR='vim' +export ALTERNATE_EDITOR="$( + if which nvim >/dev/null + then echo nvim + else echo vi + fi)" +export EDITOR="$( + if which emacs >/dev/null + then echo emacsclient #'emacsclient -a ""' + else echo $ALTERNATE_EDITOR + fi +)" export LESS="--RAW-CONTROL-CHARS --ignore-case --LONG-PROMPT --jump-target=5 $(test $(less --version | head -1 | cut -f2 -d' ') -ge 590 && echo --incsearch)" # TODO put into config file and use --exclude-from export DIRS_GENERATED="-x generated -x .gradle -x cmake_build -x dist-newstyle -x node_modules -x __pycache__"