如何将绑定命令添加到 config.fish?
How to add bind commands to config.fish?
我正在尝试配置 bind
命令以使其持久化。似乎正确的文件是 ~/.config/fish/config.fish
我放在那里
set fish_greeting "wazaa"
bind \n 'commandline -f accept-autosuggestion execute'
然后我得到一个新的 shell
root@srv ~# fish
wazaa
root@srv ~#
因此确实解析了文件,但未考虑绑定命令。
从提示符开始的相同命令工作正常。
有没有特殊的方法可以在启动文件中添加bind
命令?
将它们放入一个名为 fish_user_key_bindings
的函数中,即
function fish_user_key_bindings
bind \n 'commandline -f accept-autosuggestion execute'
end
这是因为 fish 在 config.fish 之后设置了它的键绑定(为了支持 emacs 和 vi 模式,并在它们之间切换)。
(文档会在下个版本中提到这个,可惜之前没有)
我正在尝试配置 bind
命令以使其持久化。似乎正确的文件是 ~/.config/fish/config.fish
我放在那里
set fish_greeting "wazaa"
bind \n 'commandline -f accept-autosuggestion execute'
然后我得到一个新的 shell
root@srv ~# fish
wazaa
root@srv ~#
因此确实解析了文件,但未考虑绑定命令。
从提示符开始的相同命令工作正常。
有没有特殊的方法可以在启动文件中添加bind
命令?
将它们放入一个名为 fish_user_key_bindings
的函数中,即
function fish_user_key_bindings
bind \n 'commandline -f accept-autosuggestion execute'
end
这是因为 fish 在 config.fish 之后设置了它的键绑定(为了支持 emacs 和 vi 模式,并在它们之间切换)。
(文档会在下个版本中提到这个,可惜之前没有)