shells: drop z.lua, add fish completion for zoxide

This commit is contained in:
Hoang Nguyen 2021-10-09 13:08:33 +07:00
parent 5dcd5c16be
commit ee9a615cfe
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
11 changed files with 8 additions and 98 deletions

View File

@ -79,15 +79,6 @@ export _ZO_DATA_DIR="$HOME/.local/share/zoxide"
export _ZO_ECHO=1
export _ZO_FZF_OPTS="$FZF_DEFAULT_OPTS --no-multi"
export _ZO_RESOLVE_SYMLINKS=1
# z.lua
# export _ZL_DATA="$HOME/.local/share/zlua/zlua"
# export _ZL_HYPHEN=1
# export _ZL_ECHO=1
# export _ZL_MATCH_MODE=1
# export _ZL_FZF_FLAG="--exact --no-multi"
# export _ZL_INT_SORT=1
# export _ZL_ROOT_MARKERS=".git,.svn,.hg,.root,package.json,.projectile,.pro"
# export RANGER_ZLUA="$HOME/.local/share/bash/z.lua"
# nodenv
export NODENV_ROOT="$HOME/.local/share/nodenv"
# pyenv
@ -536,22 +527,6 @@ fi
# fi
# eval "$(nodenv init -)"
# z.lua
# if [[ ! -f "$HOME/.local/share/bash/z.lua" ]]; then
# curl -fLo $HOME/.local/share/bash/z.lua https://raw.githubusercontent.com/skywind3000/z.lua/master/z.lua
# mkdir -p $HOME/.local/share/zlua
# fi
# eval "$(lua $HOME/.local/share/bash/z.lua --init bash fzf)"
# if command -v ranger >/dev/null; then
# if [ ! -f "$HOME/.config/ranger/plugins/ranger_zlua.py" ]; then
# curl -fLo $HOME/.config/ranger/plugins/ranger_zlua.py https://github.com/skywind3000/z.lua/raw/master/ranger_zlua.py
# fi
# fi
# alias zz='z -c' # restrict matches to subdirs of $PWD
# alias zi='z -i' # cd with interactive selection
# alias zf='z -I' # use fzf to select in multiple matches
# alias zb='z -b' # quickly cd to the parent directory
# zoxide
if command -v zoxide >/dev/null; then
eval "$(zoxide init bash)"

View File

@ -0,0 +1,2 @@
complete z -f -a "(__fish_complete_directories (commandline -t) '')"
complete z -n "test -n (commandline -t)" -a "(zoxide query -l -- (commandline -t))" -k

View File

@ -96,15 +96,6 @@ set -gx _ZO_DATA_DIR $HOME/.local/share/zoxide
set -gx _ZO_ECHO 1
set -gx _ZO_FZF_OPTS "$FZF_DEFAULT_OPTS --no-multi"
set -gx _ZO_RESOLVE_SYMLINKS 1
# z.lua
# set -gx _ZL_DATA $HOME/.local/share/zlua/zlua
# set -gx _ZL_ECHO 1
# set -gx _ZL_HYPHEN 1
# set -gx _ZL_MATCH_MODE 1
# set -gx _ZL_FZF_FLAG '--exact --no-multi'
# set -gx _ZL_INT_SORT 1
# set -gx _ZL_ROOT_MARKERS ".git,.svn,.hg,.root,package.json,.projectile,.pro"
# set -gx RANGER_ZLUA $HOME/.config/fish/z.lua
# forgit
if test -n "$XDG_SESSION_TYPE"
if test $XDG_SESSION_TYPE = "wayland"

View File

@ -60,24 +60,6 @@ if not test -f "$HOME/.config/fish/functions/fzf_key_bindings.fish"
end
fzf_key_bindings
# z.lua
# if not test -f "$HOME/.config/fish/z.lua"
# curl -fLo $HOME/.config/fish/z.lua https://raw.githubusercontent.com/skywind3000/z.lua/master/z.lua
# mkdir -p $HOME/.local/share/zlua
# end
# lua $HOME/.config/fish/z.lua --init fish | source
# if command -v ranger >/dev/null
# if not test -f "$HOME/.config/ranger/plugins/ranger_zlua.py"
# curl -fLo $HOME/.config/ranger/plugins/ranger_zlua.py https://github.com/skywind3000/z.lua/raw/master/ranger_zlua.py
# end
# end
# alias zc='z -c' # restrict matches to subdirs of $PWD
# alias zz='z -i' # cd with interactive selection
# alias zf='z -I' # use fzf to select in multiple matches
# alias zb='z -b' # quickly cd to the parent directory
# alias zbi='z -b -i' # interactive jump backward
# alias zbf='z -b -I' # interactive jump backward with fzf
# zoxide
if command -v zoxide >/dev/null
zoxide init fish | source

View File

@ -197,13 +197,9 @@ cmd Link %{{
fi
}}
# fzf + zlua/zoxide
# fzf + zoxide
cmd fzz ${{
if command -v zoxide >/dev/null; then
sel=$(zoxide query --list | fzf --no-multi)
else
sel=$(awk -F "|" '{print $1}' "$HOME/.local/share/zlua/zlua" | fzf --no-multi | awk '{$1=$1};1')
fi
sel=$(zoxide query --list | fzf --no-multi)
lf -remote "send $id cd \"$sel\""
}}
@ -233,7 +229,7 @@ map o open-with
# fzf
map <c-f> $vi $(fzf)
map <a-f> zlua
map <a-f> fzz
map f :fzf_jump
# archives

View File

@ -1,9 +1,6 @@
#!/usr/bin/env sh
# Description: cd to any dir in the z database using an fzf pane
#
# Shell: POSIX compliant
# Author: Nick Waywood
. "$(dirname "$0")"/.nnn-plugin-helper
@ -16,15 +13,7 @@ fi
if command -v zoxide >/dev/null; then
sel=$(zoxide query --list | $fuzzy)
else
datafile="${_ZL_DATA:-$HOME/.local/share/zlua/zlua}"
if [ -f "$datafile" ]; then
# I read the data from z's file instead of calling the z command so that the data doesn't need to be processed twice
sel=$(awk -F "|" '{print $1}' "$datafile" | $fuzzy | awk '{$1=$1};1')
# NOTE: Uncomment this line and comment out the line above if you want to see the weightings of the dir's in the fzf pane
# sel=$(awk -F "|" '{printf "%s %s\n", $2, $1}' "$datafile" | $fuzzy | sed 's/^[0-9,.]* *//' | awk '{$1=$1};1')
else
exit 1
fi
exit 1
fi
printf "%s" "0c$sel" > "$NNN_PIPE"

View File

@ -1,7 +0,0 @@
#!/bin/sh
if command -v zoxide >/dev/null; then
zoxide query --list | fzf --no-multi
else
awk -F "|" '{print $1}' "$HOME/.local/share/zlua/zlua" | fzf --no-multi | awk '{$1=$1};1'
fi

View File

@ -151,8 +151,8 @@ command! fzd : let $FZF_RES = term('fd --type d --follow --hidden --exclude .git
\| cd $FZF_RES
\| endif
" fzf zoxide/zlua
command! z : let $FZF_RES = term('fzfz 2>&0')
" fzf zoxide
command! z : let $FZF_RES = term('zoxide query --list | fzf --no-multi 2>&0')
\| if $FZF_RES != ''
\| cd $FZF_RES
\| endif

View File

@ -378,15 +378,6 @@ export ZSH_PLUGINS_ALIAS_TIPS_TEXT="💡 => "
# zsh-autosuggestions
export ZSH_AUTOSUGGEST_STRATEGY=(history completion)
export ZSH_AUTOSUGGEST_USE_ASYNC=1
# z.lua
# export _ZL_DATA="$HOME/.local/share/zlua/zlua"
# export _ZL_ECHO=1
# export _ZL_HYPHEN=1
# export _ZL_MATCH_MODE=1
# export _ZL_FZF_FLAG="--exact --no-multi"
# export _ZL_INT_SORT=1
# export _ZL_ROOT_MARKERS=".git,.svn,.hg,.root,package.json,.projectile,.pro"
# export RANGER_ZLUA="$HOME/.local/share/zsh/zinit/plugins/skywind3000---z.lua/z.lua"
# zsh-abbr
export ABBR_USER_ABBREVIATIONS_FILE="$HOME/.local/share/zsh/abbreviations"
# gencomp

View File

@ -148,14 +148,6 @@ zinit light wfxr/forgit
zinit light olets/zsh-abbr
# zinit light djui/alias-tips
# cd around faster with zlua
# zinit light skywind3000/z.lua
# if command -v ranger >/dev/null; then
# if [ ! -f "$HOME/.config/ranger/plugins/ranger_zlua.py" ]; then
# curl -fLo $HOME/.config/ranger/plugins/ranger_zlua.py https://github.com/skywind3000/z.lua/raw/master/ranger_zlua.py
# fi
# fi
# Plugins' configurations
source $ZDOTDIR/plugins.zsh

View File

@ -30,7 +30,6 @@ bindkey '^O' autosuggest-accept
zstyle ':fzf-tab:*' single-group ''
zstyle ':fzf-tab:*' continuous-trigger '/'
zstyle ':fzf-tab:*' print-query alt-enter
zstyle ':fzf-tab:complete:_zlua:*' query-string input
zstyle ':fzf-tab:complete:kill:argument-rest' fzf-preview 'ps --pid=$word -o cmd --no-headers -w -w'
zstyle ':fzf-tab:complete:kill:argument-rest' fzf-flags '--preview-window=down:3:wrap'
zstyle ':fzf-tab:complete:kill:*' popup-pad 0 3