Hacking with fd, fzf, fzf-tmux, and neovim

  Рет қаралды 60,235

Elijah Manor

Elijah Manor

2 жыл бұрын

In this quick 1-minute short, I progressively use fd and fzf to find and open a file in neovim. I slowly build up the command and create a zsh alias at the end.
Thanks to ‪@JoshMedeski‬ for the idea and inspiration of the #short
Final command…
fd --type f --hidden --exclude .git | fzf-tmux -p --reverse | xargs nvim
and the alias…
alias v='fd --type f --hidden --exclude .git | fzf-tmux -p --reverse | xargs nvim'

Пікірлер: 88
@nonono9700
@nonono9700 Жыл бұрын
didn't know those exist, here I am using plain old find and grep
@ElijahManor
@ElijahManor Жыл бұрын
Oh yeah, some really cool tools out there! So fun to learn and wire up these tools together. Thanks for watching
@jacobusburger
@jacobusburger Жыл бұрын
Just subbed, this is great.
@ElijahManor
@ElijahManor Жыл бұрын
Awesome, thank you! Hope you enjoy the other content too!
@sexyeur
@sexyeur Жыл бұрын
Thanks for the suggestion. I've joined you!
@RobertMcGovernTarasis
@RobertMcGovernTarasis 2 ай бұрын
Genuinely useful short. Such a palette cleanser
@Denis-wf4bl
@Denis-wf4bl 6 ай бұрын
I love it, especially the fzf-tmux -p part
@moellerdk93
@moellerdk93 3 ай бұрын
Thanks now i cant sleep 😂 have to go and try this 😅
@andressalazargaleano6419
@andressalazargaleano6419 Жыл бұрын
Subbed just from watching this
@ElijahManor
@ElijahManor Жыл бұрын
Awesome, thanks! I should have a new one this week. Recorded part of it yesterday and plan to wrap it up in the next day or two.
@androidgeeking
@androidgeeking 7 күн бұрын
You leveled my geek up
@RootsterAnon
@RootsterAnon Жыл бұрын
This is Awesome!
@Jplaysterraria
@Jplaysterraria Жыл бұрын
I don't know if fzf has this option, but you can use `skim` to have a preview of the files while fuzzy-finding telescope style
@ElijahManor
@ElijahManor Жыл бұрын
Yes, you could do something like the following... fd --type f --hidden --exclude .git | fzf --preview 'bat {1}' | xargs nvim
@xorlop
@xorlop Жыл бұрын
This is so cool
@ElijahManor
@ElijahManor Жыл бұрын
Yay, glad you enjoyed it
@MetalManiacBoy
@MetalManiacBoy Жыл бұрын
I already had a similar thing like this to cd into directories, for some reason never thought to use it to open files in neovim! Thanks :D
@ElijahManor
@ElijahManor Жыл бұрын
Oh yeah, pretty powerful. These days I typically use telescope once I'm in the general root project, but it's good to know about fd and fzf too. Great tools
@eddyekofo5102
@eddyekofo5102 Ай бұрын
Brilliant! 🎉
@glitchy_weasel
@glitchy_weasel 5 ай бұрын
Very very creative!
@exec_mayank
@exec_mayank Жыл бұрын
Good, to the point, stuff! Thanks!
@ElijahManor
@ElijahManor Жыл бұрын
Glad it was helpful!
@julienv7031
@julienv7031 2 ай бұрын
To me you are just doing ls and grep the hard way…Or maybe I’m too old to understand the benefit of this lol
@cory1111
@cory1111 20 күн бұрын
It’s just aesthetics that’s it. No functionality actually gained
@watermelonsalesman
@watermelonsalesman 29 күн бұрын
Very nice
@jrkdndb
@jrkdndb 9 ай бұрын
Is there any way to customize fzf? There are just colour options. Any other ideas to completely customize it? Also great content! subbed!
@aktasesata
@aktasesata Ай бұрын
Wow thanks
@ivanvelinov4630
@ivanvelinov4630 Жыл бұрын
awesome!
@ElijahManor
@ElijahManor Жыл бұрын
Glad you think so!
@christianrystad7858
@christianrystad7858 11 ай бұрын
I did something similar with oh-my-bash on Linux. Looks like this: selected_file=$(find . -maxdepth 1 -type f | sort | tac | fzf --ansi) && [ -n "$selected_file" ] && nvim "$selected_file"
@Cassandra_Johnson
@Cassandra_Johnson 7 ай бұрын
I feel like this is a really complicated way to press tab twice.
@novaz8936
@novaz8936 25 күн бұрын
Have my like
@naranyala_dev
@naranyala_dev Жыл бұрын
awesome, go further
@ElijahManor
@ElijahManor Жыл бұрын
Glad you found it interesting 😀
@HuntingKingYT
@HuntingKingYT 6 ай бұрын
_Uses telescope_
@iusearchbtw4969
@iusearchbtw4969 11 ай бұрын
For some reason, in bash -p doesn't work
@mohammedwisam2188
@mohammedwisam2188 6 ай бұрын
Because you need to use it inside of tmux
@michaelmueller9635
@michaelmueller9635 11 ай бұрын
neat
@user-xd5gd4pc9h
@user-xd5gd4pc9h 8 ай бұрын
That is pretty cool to use fzf-tmux. I wonder how to achieve this thing using just zellij, I found zellij action thing, but it give me a "dead" pane with cannot take input to fzf. I do this because I cannot find the counterpart of zellij to do the same thing like fzf-tmux and fzf-tmux cannot be installed by nix/homemanager directly. Thx!
@jannmarcvillablanca7183
@jannmarcvillablanca7183 Жыл бұрын
awesome alias! but i found a problem, say if you want to interrupt the search with ctrl+c, xargs proceeds to open an empty buffer anyway, any idea how to stop running nvim?
@ElijahManor
@ElijahManor Жыл бұрын
TIL, thank you! And I appreciate you getting to their comment before I did. Helpful KZbin comments are the best :)
@umop3plsdn
@umop3plsdn Ай бұрын
great stuff but already using it... but I GOTTA KNOW what's your colorscheme/font
@sexyeur
@sexyeur Жыл бұрын
I just want the full line of that rob alias haha Where are Elijah's dot files???
@TheStickofWar
@TheStickofWar Жыл бұрын
Holy shit. How did you think of this? Now I won’t be able to not use it in my workflow, it is just too convenient.
@ElijahManor
@ElijahManor Жыл бұрын
Glad you found it interesting
@user-mn6wv4iw6r
@user-mn6wv4iw6r 10 ай бұрын
Cool , may I ask what’s your theme in your zsh? I think that color is great. Thank~
@daleryanaldover6545
@daleryanaldover6545 9 ай бұрын
it's tmux
@GokayBURUC
@GokayBURUC 3 ай бұрын
It's Tmux and macOs. That's why font rendering and the colors are so clear and shiny.
@BrazenNL
@BrazenNL Жыл бұрын
So annoying that you can't go back and forth through the video with shorts. Searched your channel but there wasn't even a normal video.
@ElijahManor
@ElijahManor Жыл бұрын
Yes, shorts were a new thing to me. I now understand a lot of their limitations. If you want, you could view the tweet video where you can pause and replay parts twitter.com/elijahmanor/status/1557003773272133632?s=20&t=i9vTaDSkaFrzaAJ3O8RM3g I'm halfway consider deleting this short and making it a full video due to the limitations. Thanks for the comment
@BrazenNL
@BrazenNL Жыл бұрын
@@ElijahManor Much better. Thanks.
@greyshopleskin2315
@greyshopleskin2315 Жыл бұрын
You can go to history, there will appear the short and if you click on it, it will be played just like a regular yt vid
@BrazenNL
@BrazenNL Жыл бұрын
@@greyshopleskin2315 I can't get that to work, it opens it as a Short from History, too. I'm on macOS Ventura using Chrome, what are you using?
@shaileshsundram
@shaileshsundram Жыл бұрын
@@BrazenNL works on youtube vanced
@tommy.3377
@tommy.3377 3 ай бұрын
Why we already have ls for that
@ngocquannguyen9901
@ngocquannguyen9901 Жыл бұрын
i can't show the popup with -p flag in | fzf-tmux -p --reverse. do it go with fzf or do i have install fzf-tmux. pls hep me
@vlenddd
@vlenddd 10 ай бұрын
got same problem
@moon-0
@moon-0 5 ай бұрын
You have to be in a tmux session to start with in order to use it
@moon-0
@moon-0 5 ай бұрын
@vlendd ^
@davidlee588
@davidlee588 Жыл бұрын
is there a link for the cli in the video, thank you
@ElijahManor
@ElijahManor Жыл бұрын
The description has more info, but since it's a short that might not be easy to get at... Final command… fd --type f --hidden --exclude .git | fzf-tmux -p --reverse | xargs nvim and the alias… alias v='fd --type f --hidden --exclude .git | fzf-tmux -p --reverse | xargs nvim'
@ulissescruz5540
@ulissescruz5540 Жыл бұрын
great short! But why use fd instead of ls?
@ElijahManor
@ElijahManor Жыл бұрын
Good question, `fd` is more of an alternative to `find` github.com/sharkdp/fd It can do some advanced searching of nested folders, etc. with many other flags and options
@d13gg0
@d13gg0 10 ай бұрын
what theme do you use ?
@DarrylHebbes
@DarrylHebbes 4 ай бұрын
FD? Ever heard of LS, does the same as what you did, and its native on Mac Os
@Zzznmop
@Zzznmop Жыл бұрын
Command “brew” not found - wat do?
@ElijahManor
@ElijahManor Жыл бұрын
What operating system are you using? `brew` was assuming you were on macOS brew.sh/ but there are other package managers for other operating systems. Are you on a flavor of linux or on windows?
@Zzznmop
@Zzznmop Жыл бұрын
@@ElijahManor I was just joking 🙃 Sudo apt install brew, right?
@freziyt223
@freziyt223 2 ай бұрын
Is there any way for that with powershell?
@ClariNerd
@ClariNerd 3 ай бұрын
You had me until uou mentioned brew. Are apt, dnf, pacman, etc not good enough for you?
@wnuggy
@wnuggy Жыл бұрын
you cant do that with ls (totally)
@ElijahManor
@ElijahManor Жыл бұрын
Thanks for watching!
@dnk70
@dnk70 3 ай бұрын
what's the difference between fzf and fd?
@potatoes_fall
@potatoes_fall 11 ай бұрын
you don't need fd just use find
@JoseRamonCanoYribarren
@JoseRamonCanoYribarren 9 ай бұрын
I was scrolling to find this. Thank you.
@DrJohn-qf1yi
@DrJohn-qf1yi Жыл бұрын
Is it greep behind all these commands ?
@ElijahManor
@ElijahManor Жыл бұрын
fd is an alternative to find and is written in rust and fzf is written in golang and is a generic fuzzy finder. As far as I can tell neither of them use grep under the covers. Unless you meant greep, which I don't know what that is
@va9iff
@va9iff Ай бұрын
why not use `find` instead of `fd` ?
@KpFriendly
@KpFriendly 8 ай бұрын
Eh, would rather just use fig autocomplete or inshellisense
@mikefdorst
@mikefdorst Жыл бұрын
Not the .zhsrc file!
@ElijahManor
@ElijahManor Жыл бұрын
what do you mean?
@Lucs-ku5cb
@Lucs-ku5cb Жыл бұрын
in tmux.conf: bind-key F send-keys 'fd --type f | fzf-tmux --border --margin=0,1 --preview "bat -f -P --plain {1}" | xargs -r nvim +' Enter
@ElijahManor
@ElijahManor Жыл бұрын
Nice! Well done
LazyVim: Linting and Formatting
9:26
Elijah Manor
Рет қаралды 42 М.
2-minute Tmux Tour
2:25
Elijah Manor
Рет қаралды 7 М.
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН
Looks realistic #tiktok
00:22
Анастасия Тарасова
Рет қаралды 106 МЛН
New model rc bird unboxing and testing
00:10
Ruhul Shorts
Рет қаралды 29 МЛН
Command Line Cheat Sheets
2:08
Elijah Manor
Рет қаралды 9 М.
Run and Debug TypeScript Unit Tests in Neovim
9:01
Elijah Manor
Рет қаралды 20 М.
Neovim Config Switcher
5:21
Elijah Manor
Рет қаралды 31 М.
Is this the best Neovim configuration?
0:57
typecraft
Рет қаралды 21 М.
Zero to IDE with LazyVim
16:59
Elijah Manor
Рет қаралды 301 М.
Why I Use Only 2 Vim Plugins
1:19
Nir Lichtman
Рет қаралды 17 М.
Effective Nerd Fonts in Multiple Terminals
12:28
Elijah Manor
Рет қаралды 63 М.
Use npm query and jq to dig into your dependencies
5:33
Elijah Manor
Рет қаралды 3 М.
New Zellij Features: Swap Layouts and Stacked Panes
4:44
Elijah Manor
Рет қаралды 13 М.
ЧУТЬ НЕ УТОНУЛ #shorts
00:27
Паша Осадчий
Рет қаралды 10 МЛН