Add bang bang (!!) fish command

And move fish functions into their own fish files.
This commit is contained in:
Alexander Wainwright
2025-07-14 17:19:46 +10:00
parent f4a48bca84
commit c0e490776e
3 changed files with 39 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
function bind_bang
set -l lastchar (commandline -t)[-1]
switch $lastchar
case "!"
set -l hist (history --max=1)
if test -n "$hist"
commandline -t -- $hist
commandline -f repaint
end
case "*"
commandline --insert "!"
end
end
function bind_dollar
set -l lastchar (commandline -t)[-1]
switch $lastchar
case "!"
commandline -t -- ""
commandline -f history-token-search-backward
case "*"
commandline --insert '$'
end
end
function fish_user_key_bindings
bind ! bind_bang
bind '$' bind_dollar
end

View File

@@ -0,0 +1,3 @@
function borg-h
borg help $argv | less
end

View File

@@ -37,6 +37,10 @@
home.file.".config/tmux/tmux.conf.local".source = ./tmux/tmux.conf.local;
home.file.".wezterm.lua".source = ./wezterm.lua;
home.file.".config/jrnl/ro_jrnl.yaml".source = ./jrnl/jrnl.yaml;
home.file.".config/fish/functions" = {
source = ./fish/functions;
recursive = true;
};
home.packages = with pkgs; [
@@ -170,6 +174,9 @@
programs.fish = {
enable = true;
interactiveShellInit = ''
source ~/.config/fish/functions/bangbang.fish
source ~/.config/fish/functions/borg-h.fish
set PATH ~/.cargo/bin $PATH
set PATH ~/scripts $PATH
set PATH ~/.local/bin $PATH
@@ -191,9 +198,6 @@
zoxide init fish | source
'';
functions.borg-h = ''
borg help $argv | less
'';
};
programs.bash = {