Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Detect if the terminal buffer is used by fzf or not in neovim #576

Closed
3 tasks done
ahmedelgabri opened this issue May 22, 2016 · 3 comments
Closed
3 tasks done

Comments

@ahmedelgabri
Copy link

  • Category
    • Neovim
  • OS
    • Mac OS X
  • Shell
    • zsh

I'd like to add this tnoremap <esc> <c-\><c-n> to my .vimrc but the problem is that it breaks the ESC with fzf. So is there is any way I can check if the terminal buffer is related to fzf or not and then decide to apply this key binding to it or not?

@ahmedelgabri ahmedelgabri changed the title Detect if the terminal buffer is used by fzf or not in neovim [Question] Detect if the terminal buffer is used by fzf or not in neovim May 22, 2016
@junegunn
Copy link
Owner

tnoremap <expr> <esc> &filetype == 'fzf' ? "\<esc>" : "\<c-\>\<c-n>"

FYI, you can use CTRL-C instead of ESC to close fzf.

@ahmedelgabri
Copy link
Author

@junegunn Thanks!

I know about CTRL+C but it's just that my brain is programmed to use ESC for exit while CTRL+C is for killing processes :)

@xeyownt
Copy link

xeyownt commented Nov 17, 2016

For the record, I just came with this solution:

tnoremap <Esc> <C-\><C-n>
au TermOpen term://*fzf* tnoremap <buffer> <Esc> <Esc>

Note that tunmap does not work. I also have to use the double wildcard in *fzf*.

In any case, junegunn's solution is better tmo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants