Comments (2)
Thanks for suggestion.
I don't see myself implementing it, as I think mode switching is overkill for fzf where you don't spend a lot of time editing your query. I think this holds true for most of the other users, they wouldn't spend more than a few seconds inside fzf 90% of the time; open fzf, type in a few characters, and you get the best match at your hand, press enter. So I don't think it's worth the effort, but if anyone's interested in implementing it, I can review the patch though there's no guarantee that it'll finally land on fzf.
FWIW, I've been using Vim for many years by now, and I can safely say that I know one or two things about it, but I don't use vi-mode on command-line because I feel Emacs-style bindings work better for input prompts. I wasn't familiar with all the bindings, but after properly learning them, I realized I was severely underutilizing them, and they can be more efficient than vi-mode in quick editing mode.
- CTRL-W and CTRL-U to quickly delete word and line
- CTRL-A and CTRL-E to move cursor to the front and to the back
- ALT-B and ALT-F for word-wise movement
- ALT-BS and ALT-D for deleting a word backward and forward
- CTRL-B, CTRL-F to move cursor by a column, CTRL-D to delete a character
- And CTRL-Y to paste the previously deleted chunk.
And fzf implements all of these.
Even if we incorporate some readline library, implementing it properly won't be trivial, because fzf allows full customization of the keys via --bind
and it's going to be a lot of work to reconcile the two systems.
from fzf.
hello! i've made a mini python script that generates bindings for a pseudo vi-mode from a config file (because i have no alt key, and dislike ctrl because of an idiosyncratic keyboard).
it's a really quick-and-dirty solution but well i can't do better and impact on performance is not terrible in my experience (it produces a veeeery long binding).
i really like using fzf like this (escape, then j/k to go down/up, c for delete, i/a/I/A for insert mode, and so on). it's here on github: thjbdvlt/fzf-vi-mode
here is how the config file could look:
[mode]
escape = esc
insert_before = i
insert_after = a
insert_end_line = A
insert_beginning_line = I
[normal]
j = down
k = up
s = jump
p = toggle-preview
h = backward-char
l = forward-char
e = forward-word
b = backward-word
d = clear-query
y = execute(echo {} | xsel -b)
E = preview-half-page-down
U = preview-half-page-up
c = cancel
x = forward-char+backward-delete-char
X = backward-delete-char
[insert]
® = backward-kill-word
change = top
backward-eof = abort
and here is the bindings for this config file:
--bind=j:down,k:up,s:jump,p:toggle-preview \
--bind=h:backward-char,l:forward-char,e:forward-word,b:backward-word \
--bind=d:clear-query \
--bind='y:execute(echo {} | xsel -b)' \
--bind=E:preview-half-page-down,U:preview-half-page-up \
--bind=c:cancel,x:forward-char+backward-delete-char \
--bind=X:backward-delete-char \
--bind=start:enable-search+unbind(e,j,s,p,h,l,é,b,d,y,E,U,c,x,X,i,a,A,I) \
--bind=i:enable-search+unbind(j,k,s,p,h,l,e,b,d,y,E,U,c,x,X,i,a,A,I) \
--bind=a:enable-search+unbind(j,k,s,p,h,l,e,b,d,y,E,U,c,x,X,i,a,A,I)+forward-char \
--bind=A:enable-search+unbind(j,k,s,p,h,l,e,b,d,y,E,U,c,x,X,i,a,A,I)+end-of-line \
--bind=I:enable-search+unbind(j,k,s,p,h,l,e,b,d,y,E,U,c,x,X,i,a,A,I)+beginning-of-line \
--bind=esc:disable-search+rebind(j,k,s,p,h,l,e,b,d,y,E,U,c,x,X,i,a,A,I) \
--bind=®:backward-kill-word,change:top,backward-eof:abort
from fzf.
Related Issues (20)
- Help creating custom fuzzy seach command script. HOT 1
- [Feature Request] Handle pytest command the same as python HOT 10
- Requires tmux 3.2 or above not only popup window HOT 1
- Support comments within FZF_DEFAULT_OPTS_FILE content HOT 5
- Matching with word boundaries HOT 7
- fzf version for linux too outdated HOT 1
- "Error: Not support reporting screen sizes in pixels" when previewing images in kitty from tmux with `--tmux` option. HOT 2
- feature request: add support for `-S fg=<color> -s fg=<color>` tmux popup flags in fzf-tmux HOT 2
- Support elvish shell condition in --bind HOT 9
- unknown option: --bash HOT 1
- on windows, using gitbash/mintty, fzf reverse history search (ctrl-r) hangs the terminal indefinitely HOT 4
- The `--txux` flag ignored when set from the config file HOT 4
- Santa blocking execution HOT 1
- vim fzf doesn't work with the latest vim junegunn/fzf HOT 2
- Please add 'command' bindkey in Macos
- Anchor match (specifically the "suffix-exact-match") doesn't seems to be working as expected! HOT 3
- [Feature request] improve performance handling iterm2 image protocol in `--preview`
- Sort by length with --disabled HOT 2
- Placeholder expression for accept/print actions
- Bash history integration on Mac prefixing selected command with reverse index 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.