Add bang bang (!!) fish command
And move fish functions into their own fish files.
This commit is contained in:
parent
f4a48bca84
commit
c0e490776e
3 changed files with 39 additions and 3 deletions
29
alex/fish/functions/bangbang.fish
Normal file
29
alex/fish/functions/bangbang.fish
Normal 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
|
||||||
3
alex/fish/functions/borg-h.fish
Normal file
3
alex/fish/functions/borg-h.fish
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
function borg-h
|
||||||
|
borg help $argv | less
|
||||||
|
end
|
||||||
|
|
@ -37,6 +37,10 @@
|
||||||
home.file.".config/tmux/tmux.conf.local".source = ./tmux/tmux.conf.local;
|
home.file.".config/tmux/tmux.conf.local".source = ./tmux/tmux.conf.local;
|
||||||
home.file.".wezterm.lua".source = ./wezterm.lua;
|
home.file.".wezterm.lua".source = ./wezterm.lua;
|
||||||
home.file.".config/jrnl/ro_jrnl.yaml".source = ./jrnl/jrnl.yaml;
|
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; [
|
home.packages = with pkgs; [
|
||||||
|
|
||||||
|
|
@ -170,6 +174,9 @@
|
||||||
programs.fish = {
|
programs.fish = {
|
||||||
enable = true;
|
enable = true;
|
||||||
interactiveShellInit = ''
|
interactiveShellInit = ''
|
||||||
|
source ~/.config/fish/functions/bangbang.fish
|
||||||
|
source ~/.config/fish/functions/borg-h.fish
|
||||||
|
|
||||||
set PATH ~/.cargo/bin $PATH
|
set PATH ~/.cargo/bin $PATH
|
||||||
set PATH ~/scripts $PATH
|
set PATH ~/scripts $PATH
|
||||||
set PATH ~/.local/bin $PATH
|
set PATH ~/.local/bin $PATH
|
||||||
|
|
@ -191,9 +198,6 @@
|
||||||
|
|
||||||
zoxide init fish | source
|
zoxide init fish | source
|
||||||
'';
|
'';
|
||||||
functions.borg-h = ''
|
|
||||||
borg help $argv | less
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue