You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To my config.fish file, the foo will indeed be echoed to the screen when I start a new shell, but the new ctrl+n binding doesn't work (it does what ctrl+n usually does).
If I then run that exact same bind command manually, it does work.
Do I need to use a different syntax to bind things in the config file?
It's not called at all. I compiled fish from this repo yesterday, master branch. e1de72d
config.fish done
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
*master> cat .config/fish/config.fish
function fish_user_keybindings
bind \e\[1\;5C forward-word
bind \e\[1\;5D backward-word
echo bindings called from config.fish
end
echo config.fish done
*master> cat .config/fish/functions/binds.fish
function fish_user_keybindings
bind \e\[1\;5C forward-word
bind \e\[1\;5D backward-word
echo user keybindings from functions/binds.fish
end
The first example works well for me.
The second example is not valid. The filename should be the same as the function name or fish would be not able to find it and load.
Do you see "config.fish done" message?
What is the output of 'type __fish_config_interactive | grep fish_user_keybindings'
the fish_user_keybindings should be called from it.
I got some problem on this too...
Looks like Fish(or maybe oh-my-fish) enables history searching by default,
but it doesn't begin from the first character of command, vim could get vim asudo vim b or even touch vim c,
I tried running bind and find these...
\cp and \cn are the Ctrl-P and Ctrl-N characters. history-search-forward means what it says on the tin - search forward in history (only works once you have searched backwards).
Note that the behaviour you describe is not what this issue is tracking; perhaps you could open a new issue?
I tried to add my custom key bindings in ~/.config/fish/config.fish and in ~/.config/fish/functions/fish_user_keybindings.fish but they were ignored. The reason seems to be that /usr/share/fish/functions/fish_default_key_bindings.fish is loaded after ~/.config/fish/config.fish. See output of strace bellow:
[SOLVED]
My issue was that I downloaded the fish Mac app, then installed fish with homebrew
Just using the app doesn’t trigger ~/.config/fish/config.fish or /usr/local/share/fish/functions/fish_default_key_bindings.fish
Solution
I just used
chsh -s `which fish``
(ignore the second back-tic mark)
to make fish the default shell, and then ndemou’s hack worked for me (even when I open fish via the app)
Note that according to the manual the proper solution this issue is to "put the bind statements into a function called fish_user_key_bindings, which will be autoloaded."
Reacted by Jeff Hykin, Alexandru Rosianu and Rijnder Wever
Activity
maxfl commentedon Jul 16, 2012
Define a function fish_user_keybindings setting your keybindings. It will be called in right time.
sjl commentedon Jul 16, 2012
Ah, that works. Perhaps that could be mentioned in the
binddocumentation?rubycut commentedon Jul 29, 2012
this doesn't work for me.
rubycut commentedon Aug 2, 2012
where should this function be defined? in config.fish or in functions directory?
Neither of those works for me.
maxfl commentedon Aug 3, 2012
that is strange. Can you put 'echo user keybindings' into this function. Is it really called?
Both ways should be possible. This function should be called after sourcing config.fish.
rubycut commentedon Aug 3, 2012
It's not called at all. I compiled fish from this repo yesterday, master branch. e1de72d
maxfl commentedon Aug 3, 2012
The first example works well for me.
The second example is not valid. The filename should be the same as the function name or fish would be not able to find it and load.
Do you see "config.fish done" message?
What is the output of 'type __fish_config_interactive | grep fish_user_keybindings'
the fish_user_keybindings should be called from it.
rubycut commentedon Aug 3, 2012
key bindings are defined in __fish_config_interactive.fish in /usr/local/share/fish/functions
inside it says
rubycut commentedon Aug 3, 2012
http://ridiculousfish.com/shell/user_doc/html/index.html#initialization
"On startup, fish evaluates the files /usr/share/fish/config.fish (Or /usr/local/fish... if you installed fish in /usr/local)"
This is not correct, it evaluates first /usr/share/fish/config.fish and then if that doesn't exist, it tries: /usr/local/share/fish/config.fish
This removes /usr/share/fish/config.fish And it all works now.
rubycut commentedon Aug 3, 2012
Thanks for the tip, I guess I we can close this.
rubycut commentedon Aug 3, 2012
But as @sjl says, it should be documented before closing.
MaskRay commentedon Dec 18, 2012
fish_user_keybindings -> fish_user_key_bindings
tiye commentedon Sep 8, 2013
I got some problem on this too...
Looks like Fish(or maybe oh-my-fish) enables history searching by default,
but it doesn't begin from the first character of command,
vimcould getvim asudo vim bor eventouch vim c,I tried running
bindand find these...What do
history-token-search-forwardand\cp \cnmean here?zanchey commentedon Sep 8, 2013
\cpand\cnare the Ctrl-P and Ctrl-N characters.history-search-forwardmeans what it says on the tin - search forward in history (only works once you have searched backwards).Note that the behaviour you describe is not what this issue is tracking; perhaps you could open a new issue?
tiye commentedon Sep 8, 2013
Moved my problem here: #992 about rewriting up arrow for
history-search-backwardndemou commentedon Mar 18, 2014
I tried to add my custom key bindings in ~/.config/fish/config.fish and in ~/.config/fish/functions/fish_user_keybindings.fish but they were ignored. The reason seems to be that /usr/share/fish/functions/fish_default_key_bindings.fish is loaded after ~/.config/fish/config.fish. See output of strace bellow:
So my workaround is to call fish_user_keybindings just before the end of /usr/share/fish/functions/fish_default_key_bindings.fish. See:
Of course this is an ugly hack. Am I missing something or is this really a bug?
siteshwar commentedon Mar 18, 2014
@ndemou You are running a very old version of fish. You can get the latest stable package for Ubuntu at http://fishshell.com/files/2.1.0/linux/index.html#dl-ubuntu12.04
Better document that binds in config.fish don't work
jeff-hykin commentedon Feb 23, 2017
[SOLVED]
My issue was that I downloaded the fish Mac app, then installed fish with homebrew
Just using the app doesn’t trigger
~/.config/fish/config.fishor/usr/local/share/fish/functions/fish_default_key_bindings.fishSolution
I just used
chsh -s `which fish``
(ignore the second back-tic mark)
to make fish the default shell, and then ndemou’s hack worked for me (even when I open fish via the app)
ndemou commentedon Feb 26, 2017
Note that according to the manual the proper solution this issue is to "put the bind statements into a function called fish_user_key_bindings, which will be autoloaded."