Comments (11)
ty, so via
--bind
is more preferred than via--preview
to save/restorepos
is what u mean?
Yeah, specifically --bind 'focus:...
for saving and --bind 'load:...
for loading. But there are quite a few ways you could do it. Check man fzf
AVAILABLE KEYS and AVAILABLE EVENTS for what you can bind to, and AVAILABLE ACTIONS for what can be performed on a bind.
from fzf.
If you are trying to open fzf at the most recent position after closing, I would suggest something like seq 50 | fzf --bind $'focus:execute-silent(echo $(({n} + 1)) > last.pos)' --bind $'load:transform(echo pos\($(cat last.pos)\))'
from fzf.
seq 50 | fzf --bind
$'focus:execute-silent(echo $ (({n} + 1)) > last.pos)' --bind $'load:transform(echo pos($(cat last.pos)))'
it does not load up last post and not keep the view
from fzf.
If you mean you want to reopen fzf with 10 still selected, and also 11 and 12 still visible at the bottom of the list, I don't think there is functionality for this. The scrolling and view position is sorted out automatically by pos(). You might find --scroll-off=n
useful, which will at least keep a buffer of n
items between the top/bottom edges of the list and the cursor.
from fzf.
If you mean you want to reopen fzf with 10 still selected, and also 11 and 12 still visible at the bottom of the list, I don't think there is functionality for this. The scrolling and view position is sorted out automatically by pos(). You might find
--scroll-off=n
useful, which will at least keep a buffer ofn
items between the top/bottom edges of the list and the cursor.
yeah, --scroll-off=LINES
helped but it feel less natural than usual.
and why u suggest save and restore pos
with this? seq 50 | fzf --bind $'focus:execute-silent(echo $(({n} + 1)) > last.pos)' --bind $'load:transform(echo pos\($(cat last.pos)\))'
--> i tried and it does not work, pos
is saved to file but cursor not restored at last pos
.
from fzf.
and why u suggest save and restore
pos
with this?seq 50 | fzf --bind $'focus:execute-silent(echo $(({n} + 1)) > last.pos)' --bind $'load:transform(echo pos\($(cat last.pos)\))'
--> i tried and it does not work,pos
is saved to file but cursor not restored at lastpos
.
Sorry didn't notice you were using zsh. This looks like it works:
seq 50 | fzf --bind 'focus:execute-silent(echo $(({n} + 1)) > last.pos)' --bind 'load:transform:echo pos\($(cat last.pos)\)'
from fzf.
seq 50 | fzf --bind 'focus:execute-silent(echo $(({n} + 1)) > last.pos)' --bind 'load:transform:echo pos($(cat last.pos))'
ty, so via --bind
is more preferred than via --preview
to save/restore pos
is what u mean?
from fzf.
@junegunn @LangLangBart any idea for this issue?
from fzf.
What exactly are you trying to implement here?
fzf doesn't support persisting and restoring its internal states between processes, because of its asynchronous nature and because there are just too many dynamic states that affect the user interface. If you want to quickly come back to fzf after running some other interactive tasks, use execute
action.
from fzf.
i just realized that this feature may need to bring a daemon and db to persist some states which is not standalone exe fzf can solve.
from fzf.
for someone who stumble to this issue later, we can save last post with fzf
and restore it later, then i wonder if we can able to save the last top line pos (below header if has) and the bottom one --> so we can restore the last pos relative to one of two top and bottom pos.
this theoretically possible, when we restore the last pos, say we can make it relative (last pos + last bottom) = current relative pos. or (last pos + last top) = relative pos.
@junegunn is that possible?
from fzf.
Related Issues (20)
- Significant prompt flick with fzf --expect HOT 4
- Replacing placeholder by the query when no match HOT 2
- Using bind with an echo output, the variable assignment no longer works HOT 2
- Question: What's the expected behavior with --nth and --with-nth together? HOT 2
- Manually triggering events HOT 1
- Allow pointer to be disabled HOT 4
- FZF_DEFAULT_OPTS is broken on OSX, installing via brew or git clone HOT 1
- [BUG] Multi-line commands surrounded by parentheses not showing up in history HOT 2
- Allow CTRL-C to cancel transform actions
- fzf-completion doesn't work on fresh archlinux install HOT 8
- --marker '═' --marker-multi-line '╔║╚' does not take effect? HOT 1
- "panic: runtime error" if tty is 1 line high HOT 1
- panic: runtime error: invalid memory address or nil pointer dereference HOT 21
- fzf `CTRL+R` only working in zsh `vicmd` mode HOT 1
- Crash when piping output from node/nodemon web server HOT 6
- Running `fzf -f whatever` with an `i3` keybinding fails HOT 1
- Re-evaluate --bind each time bindkey pressed HOT 1
- Select candidate if it's multi lines? HOT 1
- Option to show --marker and --marker-multi-line if it's multi lines? HOT 1
- Constraint to only exit fzf if processes base on key press are done? HOT 4
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.