aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--config/fish/config.fish12
-rw-r--r--config/yazi/init.lua24
-rw-r--r--config/yazi/keymap.toml9
-rw-r--r--config/yazi/plugins/smart-enter.yazi/init.lua9
-rw-r--r--config/yazi/theme.toml6
-rw-r--r--config/yazi/yazi.toml21
-rwxr-xr-xinstall6
-rw-r--r--pacman/base1
9 files changed, 88 insertions, 2 deletions
diff --git a/README.md b/README.md
index a365ad5..31078e9 100644
--- a/README.md
+++ b/README.md
@@ -39,3 +39,5 @@ $ ./install
- [x] image preview with ueberzug++
- [x] drag and drop with dragon
- [ ] make default file opener https://github.com/GermainZ/xdg-desktop-portal-termfilechooser
+ - [ ] add nvim shortcut to open yazi in current directory and in the git root
+- [ ] zoxide - <https://github.com/ajeetdsouza/zoxide?tab=readme-ov-file>
diff --git a/config/fish/config.fish b/config/fish/config.fish
index d205631..9682f90 100644
--- a/config/fish/config.fish
+++ b/config/fish/config.fish
@@ -120,7 +120,6 @@ if status is-interactive
alias nvim 'VIMINIT="" /usr/bin/nvim'
end
alias v 'nvim'
- alias y 'yazi'
alias gdb 'gdb -q' # disable long intro message
alias sudo 'sudo ' # enable color (the search for aliases continues)
alias doas 'doas ' # same for doas
@@ -131,6 +130,17 @@ if status is-interactive
alias arduino-cli='arduino-cli --config-file $XDG_CONFIG_HOME/arduino15/arduino-cli.yaml'
# alias nvidia-settings --config="$XDG_CONFIG_HOME"/nvidia/settings
+ #alias y 'yazi'
+ # from: https://yazi-rs.github.io/docs/quick-start#shell-wrapper
+ function y
+ set tmp (mktemp -t "yazi-cwd.XXXXXX")
+ yazi $argv --cwd-file="$tmp"
+ if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
+ builtin cd -- "$cwd"
+ end
+ rm -f -- "$tmp"
+ end
+
if command -qv eza
alias ls='eza --git --git-repos --mounts --classify --icons'
else
diff --git a/config/yazi/init.lua b/config/yazi/init.lua
new file mode 100644
index 0000000..c781e9b
--- /dev/null
+++ b/config/yazi/init.lua
@@ -0,0 +1,24 @@
+require("git"):setup()
+
+-- Add the user and group in the status line (from: https://yazi-rs.github.io/docs/tips#user-group-in-status)
+Status:children_add(function()
+ local h = cx.active.current.hovered
+ if h == nil or ya.target_family() ~= "unix" then
+ return ui.Line {}
+ end
+
+ return ui.Line {
+ ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
+ ui.Span(":"),
+ ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
+ ui.Span(" "),
+ }
+end, 500, Status.RIGHT)
+
+-- Add hostname and username in header (from: https://yazi-rs.github.io/docs/tips#username-hostname-in-header)
+Header:children_add(function()
+ if ya.target_family() ~= "unix" then
+ return ui.Line {}
+ end
+ return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. " "):fg("blue")
+end, 500, Header.LEFT)
diff --git a/config/yazi/keymap.toml b/config/yazi/keymap.toml
index 8f3ca8a..7ab5ee7 100644
--- a/config/yazi/keymap.toml
+++ b/config/yazi/keymap.toml
@@ -2,14 +2,21 @@
[[manager.prepend_keymap]]
on = "<C-n>"
run = '''
- shell 'dragon-drop -x -i -T "$1"' --confirm
+ shell 'dragon-drop --and-exit --on-top "$@"' --confirm
'''
desc = "Open the drag and drop utility"
+
[[manager.prepend_keymap]]
on = "!"
run = 'shell "$SHELL" --block --confirm'
desc = "Open shell in the current directory"
+
[[manager.prepend_keymap]]
on = ["g", "d"]
run = 'cd ~/dl'
desc = "Open ~/dl"
+
+[[manager.prepend_keymap]]
+on = "l"
+run = 'plugin --sync smart-enter'
+desc = "Enter the child directory, or open the file"
diff --git a/config/yazi/plugins/smart-enter.yazi/init.lua b/config/yazi/plugins/smart-enter.yazi/init.lua
new file mode 100644
index 0000000..8724200
--- /dev/null
+++ b/config/yazi/plugins/smart-enter.yazi/init.lua
@@ -0,0 +1,9 @@
+-- from: https://yazi-rs.github.io/docs/tips#smart-enter
+
+--- @sync entry
+return {
+ entry = function()
+ local h = cx.active.current.hovered
+ ya.manager_emit(h and h.cha.is_dir and "enter" or "open", { hovered = true })
+ end,
+}
diff --git a/config/yazi/theme.toml b/config/yazi/theme.toml
new file mode 100644
index 0000000..0116edd
--- /dev/null
+++ b/config/yazi/theme.toml
@@ -0,0 +1,6 @@
+[flavor]
+use = "gruvbox-dark"
+
+[status]
+separator_open = ""
+separator_close = ""
diff --git a/config/yazi/yazi.toml b/config/yazi/yazi.toml
index bf5487d..c40e2e0 100644
--- a/config/yazi/yazi.toml
+++ b/config/yazi/yazi.toml
@@ -2,3 +2,24 @@
linemode = "size"
sort_by = "modified"
sort_reverse = true
+# mouse = [ "click", "scroll", "drag" ]
+
+[preview]
+cache_dir = "~/.cache/yazi"
+
+[opener]
+edit = [
+ { run = 'VIMINIT="" ${EDITOR:-vi} "$@"', desc = "$EDITOR", block = true, for = "unix" },
+ { run = 'code %*', orphan = true, desc = "code", for = "windows" },
+ { run = 'code -w %*', block = true, desc = "code (block)", for = "windows" },
+]
+
+[[plugin.prepend_fetchers]]
+id = "git"
+name = "*"
+run = "git"
+
+[[plugin.prepend_fetchers]]
+id = "git"
+name = "*/"
+run = "git"
diff --git a/install b/install
index 82070f8..98e99df 100755
--- a/install
+++ b/install
@@ -114,6 +114,12 @@ fish -c 'fisher install PatrickF1/fzf.fish'
fish -c 'fisher install decors/fish-colored-man'
fish -c 'fisher install ainmosni/fish-aws'
+if command -v ya > /dev/null
+then
+ ya pack -a bennyyip/gruvbox-dark
+ ya pack -a yazi-rs/plugins:git
+fi
+
###############################################################################
# Linux specific
###############################################################################
diff --git a/pacman/base b/pacman/base
index c9ab9d0..13077d7 100644
--- a/pacman/base
+++ b/pacman/base
@@ -141,3 +141,4 @@ xsel
yazi
ueberzugpp
+perl-image-exiftool