summaryrefslogtreecommitdiff
path: root/dot-config
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-10-18 13:21:41 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-10-18 13:21:41 +0800
commitcace1a3700c551f1cd0b9a47bf4ab865272b3242 (patch)
tree8176c3100ebb519d2fa1f2dcaa9f88c18fb893e1 /dot-config
parent854df2774a8d4a444685f5af95c83781129e33f7 (diff)
bump: fish
new(fish): custom zoxide func
Diffstat (limited to 'dot-config')
-rw-r--r--dot-config/fish/conf.d/__zoxide.fish25
-rw-r--r--dot-config/fish/conf.d/abbr.fish4
-rw-r--r--dot-config/fish/conf.d/env.fish2
-rw-r--r--dot-config/fish/conf.d/funcs.fish30
4 files changed, 43 insertions, 18 deletions
diff --git a/dot-config/fish/conf.d/__zoxide.fish b/dot-config/fish/conf.d/__zoxide.fish
index 2e9cc179..8cbff6b9 100644
--- a/dot-config/fish/conf.d/__zoxide.fish
+++ b/dot-config/fish/conf.d/__zoxide.fish
@@ -1 +1,24 @@
-zoxide init fish | source
+zoxide init fish --cmd cd | source
+
+# minimal version
+# function __zoxide_complete
+# set -l tokens (commandline --current-process --tokenize)
+# set -l token (commandline --cut-at-cursor --current-process --tokenize)
+
+# if __fish_complete_directories "$tokens[2..-1]" '' | read -lz __out
+# echo $__out
+# else
+# command zoxide query --exclude (__zoxide_pwd) -- $tokens[2..-1] 2>/dev/null | string replace -a -- (__zoxide_pwd)/ '' | string split0 | string join /
+# end
+# end
+
+function __zoxide_complete
+ set -l tokens (commandline --current-process --tokenize)
+ set -l token (commandline --cut-at-cursor --current-process --tokenize)
+
+ __fish_complete_directories "$tokens[2..-1]" ''
+ command zoxide query --exclude (__zoxide_pwd) -- $tokens[2..-1] 2>/dev/null | string replace -a -- (__zoxide_pwd)/ '' | string split0 | string join /
+end
+
+complete --erase --command __zoxide_z
+complete --command __zoxide_z --no-files --arguments '(__zoxide_complete)'
diff --git a/dot-config/fish/conf.d/abbr.fish b/dot-config/fish/conf.d/abbr.fish
index af1e952d..9bf7d10b 100644
--- a/dot-config/fish/conf.d/abbr.fish
+++ b/dot-config/fish/conf.d/abbr.fish
@@ -144,7 +144,7 @@ abbr -a config-polybar "vim ~/.config/bspwm/themes/default/polybar/config.ini"
abbr -a tarxz "tar -xvJf"
abbr -a targz "tar -xvzf"
# faster(vim)
-abbr -a v vim
+abbr -a v hx
## auto fuck
# better finds
#alias find='sudo find / | grep '
@@ -340,6 +340,6 @@ end
abbr -a icat "kitten icat"
-abbr -a cd z
+# abbr -a cd z
abbr -a md mkdir
diff --git a/dot-config/fish/conf.d/env.fish b/dot-config/fish/conf.d/env.fish
index fbc3e699..68325cb1 100644
--- a/dot-config/fish/conf.d/env.fish
+++ b/dot-config/fish/conf.d/env.fish
@@ -52,6 +52,8 @@ set -x XDG_VIDEOS_DIR "$HOME/Videos"
# Pager/editor helpers
set -x MANPAGER 'nvim +Man! +"set nocul" +"set noshowcmd" +"set noruler" +"set noshowmode" +"set laststatus=0" +"set showtabline=0" +"set nonumber"'
+# set -x MANPAGER hx
+# set -x MANROFFOPT -c
set -x DIFFPROG 'nvim -d'
# set -x MANPAGER "lvim +Man"
diff --git a/dot-config/fish/conf.d/funcs.fish b/dot-config/fish/conf.d/funcs.fish
index e6b5663f..009c3d51 100644
--- a/dot-config/fish/conf.d/funcs.fish
+++ b/dot-config/fish/conf.d/funcs.fish
@@ -1,13 +1,13 @@
-# vim with auto sudo
-function vim
+# hx with auto sudo
+function hx
if test (count $argv) -eq 0
if not test -w (pwd)
- printf "Opening vim with sudo...\n"
- sudo -E $EDITOR
+ printf "Opening hx with sudo...\n"
+ command sudo -E $EDITOR
return
else
- printf "Opening vim...\n"
- $EDITOR
+ printf "Opening hx...\n"
+ command $EDITOR
return
end
end
@@ -19,7 +19,7 @@ function vim
switch $choice
case y Y
if not test -w (dirname $argv[1])
- printf "Opening vim with sudo...\n"
+ printf "Opening hx with sudo...\n"
sudo -E $EDITOR $argv[1]
if not test -e $argv[1]
printf "File \"%s\" is isn't saved, auto deleted...\n" $argv[1]
@@ -27,8 +27,8 @@ function vim
end
return
else
- printf "Opening vim...\n"
- $EDITOR $argv[1]
+ printf "Opening hx...\n"
+ command $EDITOR $argv[1]
if not test -e $argv[1]
printf "File \"%s\" is isn't saved, auto deleted...\n" $argv[1]
return
@@ -42,12 +42,12 @@ function vim
end
if not test -w $argv[1]
- printf "Opening vim with sudo...\n"
+ printf "Opening hx with sudo...\n"
sudo -E $EDITOR $argv[1]
return
else if test -e $argv[1]
- printf "Opening vim...\n"
- $EDITOR $argv[1]
+ printf "Opening hx...\n"
+ command $EDITOR $argv[1]
return
end
end
@@ -60,7 +60,7 @@ function path
echo (pwd)/$argv[1]
end
-function vimake
+function vmake
if test -e Makefile
$EDITOR Makefile
else
@@ -68,9 +68,9 @@ function vimake
end
end
-function vimpkg
+function vmpkg
if test -e PKGBUILD
- nvim PKGBUILD
+ $EDITOR PKGBUILD
else
printf "No PKGBUILD"
end