this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix up + simplify keybinds for !$, !*

+23 -42
-4
.config/fish/functions/__fish_bind_bang.fish
··· 1 1 function __fish_bind_bang 2 2 switch (commandline --current-token)[-1] 3 3 case "!" 4 - # Without the `--`, the functionality can break when completing 5 - # flags used in the history (since, in certain edge cases 6 - # `commandline` will assume that *it* should try to interpret 7 - # the flag) 8 4 commandline --current-token -- $history[1] 9 5 commandline --function repaint 10 6 case "*"
+7 -38
.config/fish/functions/__fish_bind_dollar.fish
··· 1 1 function __fish_bind_dollar 2 2 switch (commandline --current-token)[-1] 3 - # This case lets us still type a literal `!$` if we need to (by 4 - # typing `!\$`). Probably overkill. 5 3 case "*!\\" 6 - # Without the `--`, the functionality can break when completing 7 - # flags used in the history (since, in certain edge cases 8 - # `commandline` will assume that *it* should try to interpret 9 - # the flag) 10 - commandline --current-token -- (echo -ns (commandline --current-token)[-1] | head -c '-1') 4 + # This case lets us still type a literal `!$` if we need to (by 5 + # typing `!\$`). Probably overkill. 11 6 commandline --insert '$' 12 - case "!" 13 - commandline --current-token "" 14 - commandline --function history-token-search-backward 15 - 16 - 17 - # Main difference from referenced version is this `*!` case 18 - # ========================================================= 19 - # 20 - # If the `!$` is preceded by any text, search backward for tokens 21 - # that contain that text as a substring. E.g., if we'd previously 22 - # run 23 - # 24 - # git checkout -b a_feature_branch 25 - # git checkout master 26 - # 27 - # then the `fea!$` in the following would be replaced with 28 - # `a_feature_branch` 29 - # 30 - # git branch -d fea!$ 31 - # 32 - # and our command line would look like 33 - # 34 - # git branch -d a_feature_branch 35 - # 36 - case "*!" 37 - # Without the `--`, the functionality can break when completing 38 - # flags used in the history (since, in certain edge cases 39 - # `commandline` will assume that *it* should try to interpret 40 - # the flag) 41 - commandline --current-token -- (echo -ns (commandline --current-token)[-1] | head -c '-1') 42 - commandline --function history-token-search-backward 7 + case "!" "*!" 8 + set -l last_cmd $history[1] 9 + set -l tokenized (string split ' ' -- $last_cmd) 10 + commandline --current-token -- $tokenized[-1] 11 + commandline --function repaint 43 12 case "*" 44 13 commandline --insert '$' 45 14 end
+15
.config/fish/functions/__fish_bind_star.fish
··· 1 + function __fish_bind_star 2 + switch (commandline --current-token)[-1] 3 + case "*!\\" 4 + # This case lets us still type a literal `!*` if we need to (by 5 + # typing `!\*`). Probably overkill. 6 + commandline --insert '*' 7 + case "*!" "!" 8 + set -l last_cmd $history[1] 9 + set -l tokenized (string split ' ' -- $last_cmd) 10 + commandline --current-token -- (string join ' ' $tokenized[2..]) 11 + commandline --function repaint 12 + case "*" 13 + commandline --insert '*' 14 + end 15 + end
+1
.config/fish/functions/fish_user_key_bindings.fish
··· 1 1 function fish_user_key_bindings 2 2 bind ! __fish_bind_bang 3 3 bind '$' __fish_bind_dollar 4 + bind '*' __fish_bind_star 4 5 5 6 # Bind cmd+backspace + cmd+del to delete remainder of line 6 7 bind \e\[3\;9~ kill-line