Alt-C not working on OSX
simonweil opened this issue · 15 comments
Using OSX Yosemite in bash with vim mode, Alt-C
just prints out ç
.
CTRL-T
& CTRL-R
work perfectly.
Thanks for a great tool and really awaiting the neovim support!
If you use iterm2, try this (excerpt from https://iterm2.com/faq.html)
Q: How do I make the option/alt key act like Meta or send escape codes?
A: Go to Preferences->Profiles tab. Select your profile on the left, and then open the Keyboard tab. At the bottom is a set of buttons that lets you select the behavior of the Option key. For most users, Esc+ will be the best choice.
It's important to note that if you have a GB keyboard; this will stop you being able to use the #
character with alt+3
in iTerm. If you want to do this, you'll need to change your keyboard to Australian, which is exactly the same except £
and #
are swapped.
Works great, thanks!
Maybe add this info to the readme?
Note that you don't necessarily need to change the behavior of the Alt
key if you use it to type special characters. You may just use Esc+C
instead of Alt-C
to do fzf's fuzzy directory change.
If you are using a normal Mac OSX terminal (not iTerm2), here are two solutions:
Solution 1:
You can open your terminal, and in the menu at the top of the screen, open "Preferences", click the "Profiles" tab then go to "Keyboard" section and then check the checkbox that is called "Use Option as Meta key". The downside of this is that you can't type characters like øœåΩ®ü etc easily at the terminal.
So instead:
Solution 2:
You can send the "Meta" by typing pressing "Control-[", so then the solution to get fzf's awsome magical find-the-directory-and-cd-into-it feature is to simply press:
"Control-[ c". Similar to varepsilon's solution of hitting "Esc c".
Thanks!
If you use ZSH, add this line to .zshrc
:
bindkey "ç" fzf-cd-widget
I use Fish with Vim keybindings and I used the Fish version of what @TheJavaGuy suggested
bind -M insert "ç" fzf-cd-widget
Getting something strange when doing this:
unknown option: -t
For hyper the hyper terminal, you need to add the following to the config:
modifierKeys: {
altIsMeta: true,
},
Without this setting, you will get the cedille ç instead of meta-c
or alt-c
Bash users: the given share/fzf/key-bindings.bash
has:
# ALT-C - cd into the selected directory
bind -m emacs-standard '"\ec": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
bind -m vi-command '"\ec": "\C-z\ec\C-z"'
bind -m vi-insert '"\ec": "\C-z\ec\C-z"'
So this can be additionally bound in the ~/.bashrc
or similar to the cedille character as:
# ALT-C - cd into the selected directory
bind -m emacs-standard '"ç": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
bind -m vi-command '"ç": "\C-z\ec\C-z"'
bind -m vi-insert '"ç": "\C-z\ec\C-z"'
Might want to only enable that if mac:
if [[ "$OSTYPE" == "darwin"* ]]; then
# modified from from $(fzf-share)/key-bindings.bash
# see https://github.com/junegunn/fzf/issues/164#issuecomment-1324505215
# ALT-C - cd into the selected directory
bind -m emacs-standard '"ç": " \C-b\C-k \C-u`__fzf_cd__`\e\C-e\er\C-m\C-y\C-h\e \C-y\ey\C-x\C-x\C-d"'
bind -m vi-command '"ç": "\C-z\ec\C-z"'
bind -m vi-insert '"ç": "\C-z\ec\C-z"'
fi
Ok, so you need to do the opt-c
or alt-c
not after cd **
like as for tab. Actually in a empty prompt do opt-c
and you will go into __fzf_cd__
-ing. The tutorial video linked in the README.md was unclear about this at 04:18.
For Alacritty lovers, add this to ~/.config/alacritty/alacritty.yml
:
key_bindings:
- { key: F, mods: Alt, chars: "\x1bf" }
- { key: B, mods: Alt, chars: "\x1bb" }
Mind the two spaces.
Also, to find more of these useful bindings for alacritty, check out my alacritty.yml
None of the above working for me on zsh
for some reason (just inserting a blank line) the widget solution from @TheJavaGuy didn't work for me either 🤦
So instead I use this:
bindkey -s 'ç' "fd --type d . --hidden | fzf --preview 'tree -C {} | head -50'^M"
Not very clean but it works. Probably something I'm missing, or there is a conflict somewhere, just leaving this here in case someone else has similar issues.
the earlier solution for alacritty did not work for me but this does in my alacritty.toml
:
[keyboard]
bindings = [{ key = "C", mods = "Alt", chars = "\u001bc" }]