Persistent fish abbreviation file #9609
Replies: 3 comments 1 reply
-
It already exists. Create an abbreviations file in |
Beta Was this translation helpful? Give feedback.
-
I guess you could write your own abbr function to add, then update your current shell's abbreviations. But this won't help on other open terminals. |
Beta Was this translation helpful? Give feedback.
-
We do not want an automatically reloading file, sorry. You can build something yourself, like set -g _abbr_time (path mtime -- ~/.config/fish/conf.d/abbr.fish)
function reload_abbr --on-event fish_prompt
set -l time (path mtime -- ~/.config/fish/conf.d/abbr.fish)
or return
if test "$time" -ne "$_abbr_time" 2>/dev/null
abbr -e (abbr --list)
source ~/.config/fish/conf.d/abbr.fish
set -g _abbr_time $time
end
end which will reload your abbr.fish any time it changes on a new prompt. But this isn't something we want to incorporate into fish proper as it will reexecute arbitrary code. |
Beta Was this translation helpful? Give feedback.
-
Since universal abbreviations are no longer supported, could it be feasible to use a new config file loaded under ~/.config/fish/ e.g. abbreviations.fish where abbreviations are stored? This way, users can continue to use
$abbr foo
, and the abbreviation would be appended to the file.I am currently utilizing a similar solution using a function wherein I echo the abbreviations into a file and source the file in config.fish, but it requires reloading the fish shell every time an abbreviation is added and manually editing the file if I need to remove one.
Beta Was this translation helpful? Give feedback.
All reactions