diff --git a/conf.d/abbr_tips.fish b/conf.d/abbr_tips.fish index 353008d..597e0b3 100644 --- a/conf.d/abbr_tips.fish +++ b/conf.d/abbr_tips.fish @@ -1,3 +1,7 @@ +bind " " '_abbr_tips_bind_space' +bind \n '_abbr_tips_bind_newline' +bind \r '_abbr_tips_bind_newline' + function abbr_fish --on-event fish_postexec -d "Abbreviation reminder for the current command" set -l command (string split ' ' "$argv") set -l cmd (string replace -r -a '\\s+' ' ' "$argv" ) @@ -7,6 +11,7 @@ function abbr_fish --on-event fish_postexec -d "Abbreviation reminder for the cu # or it's a function if abbr -q "$cmd" or ! type -q "$command[1]" + or test "$_abbr_tips_is_abbr" = 1 return end if test (type -t "$command[1]") = 'function' diff --git a/functions/_abbr_tips_bind_newline.fish b/functions/_abbr_tips_bind_newline.fish new file mode 100644 index 0000000..c18f917 --- /dev/null +++ b/functions/_abbr_tips_bind_newline.fish @@ -0,0 +1,8 @@ +function _abbr_tips_bind_newline + if abbr -q (string trim (commandline)) + set -g _abbr_tips_is_abbr 1 + else + set -g _abbr_tips_is_abbr 0 + end + commandline -f 'execute' +end diff --git a/functions/_abbr_tips_bind_space.fish b/functions/_abbr_tips_bind_space.fish new file mode 100644 index 0000000..72b506b --- /dev/null +++ b/functions/_abbr_tips_bind_space.fish @@ -0,0 +1,9 @@ +function _abbr_tips_bind_space + commandline -i " " + if abbr -q (string trim (commandline)) + set -g _abbr_tips_is_abbr 1 + else + set -g _abbr_tips_is_abbr 0 + end + commandline -f 'expand-abbr' +end