Comments (5)
Ah, you're perfectly right, thanks for raising the issue. I was a bit worried about this too, but I haven't found a solution yet. I particularly don't like the fact that even if you have set -o vi
in your .bashrc, if it comes after source ~/.fzf.bash
, the key bindings will not be correctly set. Mentioning this quirkiness in the documentation would be helpful of course, and we should probably do so, but it would be better if we could fix the problem. Do you know of a better way to handle this?
from fzf.
I've just updated the key bindings section of the README page. But I'm still interested in a real solution :)
from fzf.
Hi Junegunn,
Thanks for updating the readme...good call about the "set -o vi" being before the source also being a gotcha.
I don't have any good ideas for a real solution.
Perhaps fzf could wait until it was invoked to detect vi mode? I vaguely recall seeing some arcane binding setup on Stackoverflow where invoking one binding would, via a bash function, conditionally setup/"bind" the next binding, and then itself automatically invoke that next binding.
I think the con was that it "burned" a binding, in that you had to use two (or three?) bindings to accomplish it. Plus it was fairly complex anyway.
from fzf.
Thanks for the reply. I googled a bit and I guess you're referring to this, right?
http://stackoverflow.com/questions/8366450/complex-keybinding-in-bash
I roughly tested the approach as follows:
__fzf_rebind() {
if [ -z "$(set -o | grep '^vi.*on')" ]; then
bind '"\C-x\C-t": " \C-u \C-a\C-k$(__fsel_tmux)\e\C-e\C-y\C-a\C-d\C-y\ey\C-h"'
else
bind '"\C-x\C-t": "\e$a \eddi$(__fsel_tmux)\C-x\C-e\e0P$xa"'
fi
}
bind -x '"\C-x\C-f": __fzf_rebind'
bind '"\C-t": "\C-x\C-f\C-x\C-t'
So it re-binds C-x + C-t
to the right version depending on the current setting. It functionally works but when the rebind function is executed via C-x + C-f
as an intermediate step, I see a line feed. I don't know if it's possible to suppress this unwanted line feed, but if it's not, we can't employ this approach.
If you don't mind, I'll keep this issue open until we find a clean solution to the problem.
from fzf.
Hi Junegunn,
Yes, that was the article...nice find! Sorry for not including the link, I was on my other machine.
That is odd about the new line; I don't have any good ideas. I'll try it out later when I have some time.
Until then I agree leaving the issue open sounds like a good idea.
Thanks for the great support on these issues; I only just came across fzf but I think I will quickly be very addicted to it. It's a great idea.
from fzf.
Related Issues (20)
- Preserve fzf fuzzy list view? HOT 11
- Preserve color output of `kubecolor get pods -A | fzf --ansi`? HOT 1
- Is it possible to create new bind on action from transform HOT 2
- Unknown command fzf_key_bindings error when invoking read in a Fish shell script HOT 3
- Header line at bottom? HOT 1
- `{q}` isn't escaped properly on Windows HOT 12
- last good fzf for fzf.vim on Windows 10 HOT 4
- FZF ignores nested files from $FZF_DEFAULT_COMMAND='fd' but not when piping fd into FZF HOT 3
- Can't input non ascii characters HOT 6
- Hang on SIGSTP when session leader
- simplify cygwin handling in Git Bash
- Action to clear selections if there are any else exit fzf. (Feature request) HOT 1
- Feature request: no-clear option that affects execute action (no clear before executing)
- On fzf.vim opening in new cmd Window in Git Bash HOT 42
- [Feature Request] Combining `--expect` and `--bind` HOT 4
- left-align preview window to the right of the finder HOT 1
- Does it support using fzf inside lldb debugger for searching command history HOT 1
- --preview-window=auto to place the preview window based on terminal size HOT 4
- Neovim: Opening a file via `:FZF` clears messages (e.g. warning W325 for existing swapfile is not shown) HOT 2
- Key Bindings For Windows Muscle Memory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fzf.