--no-input
advanced, Path n
avigation with fzf
#4228
fsc0
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
demo.mp4
I remember some projects with this kind of approach (use fzf like a file manager).
And also there are well-known modern TUI file managers.
But still playing with these kind of ideas gives a lot of fun to me.
I saved the main script with single name
n
.And I have below function in my
.bashrc
.Important
Before testing the script,
the configuration path is
~/.config/n/
.Save below
n.conf
,bookmark
samples to above path then edit for your system.Last, check
n
's--bind
values for each features.Like
a
for rename,f7
for mkdir,s
for instant shell,space
for toggle clipboard selection,c
for display clipboard list,p
for paste init action,r
for refresh andy
for yank (filename).n.conf
bookmark
n
Finding potential of fzf is one of fun time in CLI,TUI life.
Still early idea and gonna change a lot, but worth to share.
Guess this script deserve to have some repo,
but I'm too lazy for version management.
And this is a just baby step to actual useful. 😅
But I believe you can upgrade, improve this script better. (Like adding --preview)
Cause that's how FOSS world runs. 👍
UPDATE 1.
Handle symbolic link for directory.
UPDATE 2.
Added recursive search (
ctrl-/
).UPDATE 3.
Added bookmark. (
'
)UPDATE 4.
Added
remove
action forfzf_clipboard
.UPDATE 5.
Added select all (
ctrl-a
) and toggle all (v
).UPDATE 6.
Added information bar.
UPDATE 7.
Support LS_COLORS.
Support multiple instance.
UPDATE 8.
Added clipboard indicator
[n]
at the infomation bar.Added clear clipboard selection (
u
).UPDATE 9.
Added instant rename (
a
).Added instant mkdir (
f7
).UPDATE 10.
Added instant shell (
s
).Changed temporary shell binding to
S
from;
.UPDATE 11.
Remember clipboard selection for each directory.
Restore right cursor position after instant or fzf_paste actions.
UPDATE 12.
Added user configuration file
n.conf
.Added instant compress of clipboard contents (if none, just focused item) (
C
).└
:compress archive_name
(zip only).UPDATE 13.
Now
n
restorecd in
cursor position not justcd ..
.Added display hidden toggle (
.
).Added get total size of clipboard contents (if none, just focused item) (
d
).Changed paste method to chain binding (
p
).Spawn bookmark list without screen clear.
UPDATE 14.
Added sort by time (
o
).Added
fzf_n_grep_str
to handle brackets.Changed substitution method (to
awk
fromsed
) to handle unique names like "f|i|l|e.txt".UPDATE 15.
Append suffix (
_
,_n
) for pastepp
pP
.Inform cd stderr through information bar.
Added invalid symlink handling.
UPDATE 16.
Added cd history navigation (
H
: prev,L
: next).UPDATE 17.
Improve cd history navigation (with cursor position).
UPDATE 18.
Supress inputs until ls ready.
Ignore some bindings at
..
(empty directory).Changed paste bindings. (
pp
,po
for mv, andpP
,pO
for cp).UPDATE 19.
Use .bashrc function
n()
instead ofalias n='source n'
.Added clipboard selection for recursive search.
Fixed cd history when there's only 2 logs.
Added trap return SIGINT for
:actions
.UPDATE 20.
Added
fzf_n_pseudo_ls
for less flickering.Execute
:actions
inside of fzf rather thanabort
pass.UPDATE 21.
Better
fzf_n_pseudo_ls
decorations (with pos highlight).Respect the fzf environment variables (like
FZF_POS
).Added FZF_N_BINDINGS.
UPDATE 22.
Use fzf-tmux while in tmux session.
└ (Recommend) tmux + fzf-tmux,
n
presents zero flickering experience.Changed instant rename method (more like inplace rename).
UPDATE 23.
Added
fzf_n_tmux_popup
for future action update.Separate
fzf_n_opener
actions (checkn.conf
).Escape ampersands (&) in awk sub.
Use information bar to inform unregistered file type.
Maintain cursor position when cd returns stderr.
UPDATE 24.
Added
fzf_n_bulk_rename
(A
) inn.conf
.UPDATE 25.
Added symbolic link
-> absolute path
to information bar.UPDATE 26.
Inform cd history navigation stderr through information bar.
Reset bookmark cursor position if directory changed.
Suppress
n
bindings untilfzf_n_opener
ends.UPDATE 27.
Added FZF_N_COLORS in
n.conf
.UPDATE 28.
Changed
fzf_n_clipboard
to respect the order of selection (no sort).└ Added feature that
vr
do bulk renaming with above selections.Massive rework of
--bind
to handle double quote(s) such asfile".txt
├ Added
fzf_n_show_input
,fzf_n_input_state
.├ Improved
fzf_n_rename
,fzf_n_mkdir
,fzf_n_compress
,fzf_n_sh
,fzf_n_rsearch
...└ Changed
--bind 'tab,space:'
behavior.Added
fzf_n_awk_sub_str
├ Fixed the issue that cursor position not recovers after visit root dir '/'.
└ Fixed the issue that clipboard selection not recovers in dir that contains
(),[]
.Added paste binding
pl
forln -s
.Added conditions that ignore bindings when there's no clipboard selection.
Added
'
into FZF_N_BINDINGS.Fixed the issue that holding
h
(fastcd ..
) breaks cursor position recovery.Fixed the issue that
fzf_n_opener
,fzf_n_sh
resets search results.Fixed the issue that couldn't cd into selected file's dir in recursive search (
ctrl-/
).UPDATE 29.
Added fzf_n_scope (
i
) inn.conf
.Added FZF_N_POINTER in
n.conf
.Removed last
/
when yank the dir with fzf_n_yank (y
,Y
).Fixed the issue that
fzf_n_compress
not perform the compress with inplace target (no selection).Fixed the issue that
fzf_n_compress
not perform the compress with filename (except extension) that already exists in current dir.UPDATE 30.
Changed tmux session
fzf_n_rename
method (using vim).Fixed the issue that
fzf_n_rename_inline
couldn't get the proper FZF_N_RENAME_ORIG.Fixed the issue that
fzf_n_mkdir_fin
doesn't reload when the new dir has sub dir.Fixed the issue that unselect (toggle off) not working when the target has
+
character.Added
--no-scrollbar
at the main fzf command.UPDATE 31.
Fixed the issue that
fzf_n_compress_inline
not working.Fixed the issue that bottom info not updated with --bind
r
.Fixed the issue that bottom info not updated when the target removed by
fzf_n_bulk_rename
.Fixed the issue that cursor position lost after rename a symbolic link with
fzf_n_rename
.Fixed the issue that cursor position lost after add/remove file/dir with
fzf_n_opener
.Added condition for
fzf_n_rename
to move cursor to the very last.
of a file.UPDATE 32.
Added
-f
option to the commandless
.Added dust as alternative
du
command infzf_n_du
. (d
)Fixed the issue that clipboard compression not perform at the empty directory.
Changed
fzf_n_compress_fin
to usetmux splitw
intead offzf_n_tmux_popup
.Known issue
Still finding a way to keep the query string and it's input stream without using
xdotool key Escape
.└ Check
--bind 'load:transform:...'
and--bind 'change:transform:...'
.NOTE
Example bulk renaming tool in
n.conf
command is vim-bulk-rename.Below patch is adding features like
recursive rename
+extension filter
+name swap
+rename with 2 lists
and
delete (rm -rf)
[WARN].vr.diff
Beta Was this translation helpful? Give feedback.
All reactions