Add latest file key and reorganise

This commit is contained in:
Alexander Wainwright
2025-12-13 18:42:40 +10:00
parent 8df3781baf
commit 4d99aecff1
4 changed files with 28 additions and 5 deletions

View File

@@ -22,8 +22,3 @@ function bind_dollar
commandline --insert '$'
end
end
function fish_user_key_bindings
bind ! bind_bang
bind '$' bind_dollar
end

View File

@@ -0,0 +1,5 @@
function fish_user_key_bindings
bind ! bind_bang
bind '$' bind_dollar
bind @ bind_at
end

View File

@@ -0,0 +1,20 @@
function bind_at
set -l token (commandline -t)
if string match -q -- "*@" "$token"
commandline -f backward-delete-char
set -l newest_file
for f in (command ls -tA)
if test -f "$f"
set newest_file "$f"
break
end
end
if test -n "$newest_file"
commandline -i (string escape -- "$newest_file")
else
commandline -i "@"
end
else
commandline -i "@"
end
end

View File

@@ -181,10 +181,13 @@
programs.fish = {
enable = true;
interactiveShellInit = ''
source ~/.config/fish/functions/latest-file.fish
source ~/.config/fish/functions/cardboard.fish
source ~/.config/fish/functions/bangbang.fish
source ~/.config/fish/functions/borg-h.fish
source ~/.config/fish/functions/fish-user-key-bindings.fish
set PATH ~/.cargo/bin $PATH
set PATH ~/scripts $PATH
set PATH ~/.local/bin $PATH