Add latest file key and reorganise
This commit is contained in:
@@ -22,8 +22,3 @@ function bind_dollar
|
||||
commandline --insert '$'
|
||||
end
|
||||
end
|
||||
|
||||
function fish_user_key_bindings
|
||||
bind ! bind_bang
|
||||
bind '$' bind_dollar
|
||||
end
|
||||
|
||||
5
alex/fish/functions/fish-user-key-bindings.fish
Normal file
5
alex/fish/functions/fish-user-key-bindings.fish
Normal file
@@ -0,0 +1,5 @@
|
||||
function fish_user_key_bindings
|
||||
bind ! bind_bang
|
||||
bind '$' bind_dollar
|
||||
bind @ bind_at
|
||||
end
|
||||
20
alex/fish/functions/latest-file.fish
Normal file
20
alex/fish/functions/latest-file.fish
Normal 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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user