diff --git a/alex/fish/functions/bangbang.fish b/alex/fish/functions/bangbang.fish new file mode 100644 index 0000000..1f2f067 --- /dev/null +++ b/alex/fish/functions/bangbang.fish @@ -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 diff --git a/alex/fish/functions/borg-h.fish b/alex/fish/functions/borg-h.fish new file mode 100644 index 0000000..ef310f5 --- /dev/null +++ b/alex/fish/functions/borg-h.fish @@ -0,0 +1,3 @@ +function borg-h + borg help $argv | less +end \ No newline at end of file diff --git a/alex/home.nix b/alex/home.nix index b237d34..c0c7a60 100644 --- a/alex/home.nix +++ b/alex/home.nix @@ -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 = {