Please avoid using this tool at all costs, I have become so dependant on it that I no longer remember the file tree of the main project I'm working on.
not (yet) a linux user but i feel you, ctrl+t is how i find files and scripts in VS/VScode, and after maintaining a codebase for 3 years i to this day do not know which subfolder contains exporter.cs
I used to cd around like a mad man whenever I want to move around projects, but with a simple zsh function I can just search and open any projects I want using fzf. God tier command
Made my own alias variants based on this vid, super helpful thanks! Fuzzy - fuzzy find and open with nvim, using xargs to open the file only if one is selected (prevent nvim creating a blank file if you try to ESC out) SuperCD - navigate to the directory of the file selected inside the CLI. alias fuzzy='fzf --preview="cat {}" | xargs -r nvim' alias supercd='cd "$(fzf --preview="if [ -d {} ]; then ls -la {}; else cat {}; fi" | xargs -r dirname)"'
I used chatGPT to help update your supercd to account for file paths with spaces in the name. I noticed it wasn't handling it correctly. Here's the full command: cd "$(fzf --preview="if [ -d '{}' ]; then ls -la '{}'; else bat '{}'; fi" | xargs -r -I {} dirname "{}")" According to chatGPT, xargs -r -I {} dirname "{}" ensures that xargs correctly handles paths with spaces. -I {} tells xargs to replace {} with the input, preserving spaces. dirname "{}" uses the replaced input in a way that handles spaces correctly.
Then there's 'exa' which is better 'ls'. Then 'zoxide' which let's you jump around your most/recently used dirs. If I had to pick one, zoxide is the one I would pick out of all of them
Never heard of this before and I can never remember the syntax of regular find. Learn something new every day I guess.
4 дня назад
You can also pipe other outputs through fzf, like git commands. I have “git cof”, which gives me a fuzzy search for branch names, and then checks out that branch . Also “cofr”, which fetches remote first and then lets me fuzzy search that for branch names 🤩
This is really cool! Although, one tiny "problem" I found with this is that, if you don't find the file you're looking for and exit with control+c or esc, the vim command runs anyway and it puts you on an empty file. I wrote a small bash script to solve that: #!/bin/bash FILE=$(fzf --preview='cat {}') # Check if fzf exited successfully and if the file exists if [ $? -eq 0 ] && [ -n "$FILE" ] then vim "$FILE" fi
At least with Fish shell, ctrl-w will immediately open fzf and stick the path where your cursor is. It'll also accept a prefix if your cursor is on a space-delimited word, cutting down the search space.
The problem with doing `nvim $(fzf)` is that if you cancel the search/kill fzf, nvim still opens. I would use `fzf --bind "enter:become($EDITOR {})"` instead. 👍 That opens the editor only if you press enter on a file.
Nano ~/.bashrc Save this line of code to it then : alias bashedit="nvim $(fzf --preview='cat {}')" Press Ctrl + O to write buffer Enter to save And Ctrl + X to quit nano Then update terminal configuration by source ~/.bashrc Then you could also recheck if your bashrc is modified successfully by using cat ~/.bashrc If setup properly , you should also consider restarting your terminal and a new command would be added named bashedit , you can ofcourse make more commands sets off this etc.
@@flowingcode8069 if you're on mac you can edit (or create) ~/.zshrc to create custom bash / zsh command. if you're on ubuntu derivatives it usually ~/.bashrc or ~/.bash_profile
Or use windows and you no longer need to remember exactly and to the letter command lines and switches. Right-click open and search the opened folder. From ui, in an intuitive and easy to remember way. And it works on system folders as well FROM THE GUI.
But you’re trading away fine controls and granularity while taking on a shit ton of bloatware. Windows is a fantastic generalist OS for everyday casual computer users. The people who this is meant for are generally not that and are probably very comfortable with running a CLI.
Maybe someone can find this useful: in order to have constant fzf preview without having to type that every time, I added this in the .bashrc ` export FZF_DEFAULT_OPTS="--preview 'batcat --color=always {}'" `. So everytime you open fzf you have your nice preview by default
In Sublime Text I can organise a set of repositories into a project, so I might have infrastructure, gitops, apps… This is useful management how can I recreate this functionality in neovim?
When I have to write again and again slugs or project id, i like to have a slugs.txt file. I would 'cat' the file then pipe into fzf in order to search between each line, then pipe into clipboard. For me it look like this `cat filename | fzf | clip` In a complex project structure I would also use fzf to open a file inside my current VSCode instance, using the -r flag. `code -r $(fzf)` 😊
@@prateekkarn9277 Answer: The clown who made this youtube short that has grossed over 100k+ hits in less than 3 days is telling you, prateek, this short is just recycled dog-water XD
Please avoid using this tool at all costs, I have become so dependant on it that I no longer remember the file tree of the main project I'm working on.
Felt 😂, cannot remember last time I pisted files in my projects folder
that's what the tree command is for...
not (yet) a linux user but i feel you, ctrl+t is how i find files and scripts in VS/VScode, and after maintaining a codebase for 3 years i to this day do not know which subfolder contains exporter.cs
I used to cd around like a mad man whenever I want to move around projects, but with a simple zsh function I can just search and open any projects I want using fzf. God tier command
I also want to know what his ternmal is
Try z_oxide
Still want to know what the terminal is
@@Sir_Trollmanare you asking about his ZHS theme? It’s probably PowerLevel10k.
@@Sir_Trollman zsh (z shell) probs
Made my own alias variants based on this vid, super helpful thanks!
Fuzzy - fuzzy find and open with nvim, using xargs to open the file only if one is selected (prevent nvim creating a blank file if you try to ESC out)
SuperCD - navigate to the directory of the file selected inside the CLI.
alias fuzzy='fzf --preview="cat {}" | xargs -r nvim'
alias supercd='cd "$(fzf --preview="if [ -d {} ]; then ls -la {}; else cat {}; fi" | xargs -r dirname)"'
I used chatGPT to help update your supercd to account for file paths with spaces in the name. I noticed it wasn't handling it correctly. Here's the full command:
cd "$(fzf --preview="if [ -d '{}' ]; then ls -la '{}'; else bat '{}'; fi" | xargs -r -I {} dirname "{}")"
According to chatGPT, xargs -r -I {} dirname "{}" ensures that xargs correctly handles paths with spaces.
-I {} tells xargs to replace {} with the input, preserving spaces.
dirname "{}" uses the replaced input in a way that handles spaces correctly.
you have totally aced the art of turning boring tutorials into interesting shorts. very cool!
Jaw dropped.. cant believe I didnt know this command already. Thank you
I've been using Linux since 2006, and my eyes got absolutely huge watching this video.
I love this short content, full of great examples
Very happy to see a fellow `setxkbmap -option ctrl:nocaps` enjoyer!
its the only way....
This channel is a blessing for new linux users.
Myy man! Thanks for sharing this just added some new commands in my arsenal of FZF.
These tutorials are a godsent. The populace demands MOAR
Your content is top notch, glad I stumbled across your channel.
Thats an awesome tip! Installing fzf now
Earned a sub just based on this alone!
Im slightly more interested in the sound of that sweet keyboard sound 😂
Commenting to get more of these shorts. This would help so much with navigating project files
Thank you. I’m pretty new to Linux so this makes CTF a lot easier.
You can use the "bat" instead of cat, is just a super power version of cat with colors
Then there's 'exa' which is better 'ls'. Then 'zoxide' which let's you jump around your most/recently used dirs.
If I had to pick one, zoxide is the one I would pick out of all of them
@@XxZeldaxXXxLinkxXexa is deprecated, use eza
@@konstantink07 u right, I have it aliased to ls so I can never remember whether eza or exa was the deprecated one 😂
This is a neat tool thank you for sharing
Dude this made more sense than the 30 min tutorial I watched.
i use fzf-tab plugin for zsh, it provides better autocomplete
thanks nerd
Never heard of this before and I can never remember the syntax of regular find. Learn something new every day I guess.
You can also pipe other outputs through fzf, like git commands. I have “git cof”, which gives me a fuzzy search for branch names, and then checks out that branch . Also “cofr”, which fetches remote first and then lets me fuzzy search that for branch names 🤩
This one is a banger!
Can I upvote this more than once?
My man, this is a great tip!
Glad you think so!
linux ecosystem always full of amazing new free stuff
this is a super big hell ya moment
This is really cool! Although, one tiny "problem" I found with this is that, if you don't find the file you're looking for and exit with control+c or esc, the vim command runs anyway and it puts you on an empty file.
I wrote a small bash script to solve that:
#!/bin/bash
FILE=$(fzf --preview='cat {}')
# Check if fzf exited successfully and if the file exists
if [ $? -eq 0 ] && [ -n "$FILE" ]
then
vim "$FILE"
fi
that's nerdy :) loving it!
I had a friend do this for me about 4 years before I used nvim. Now I use it all the time
Nice never heard of it before
I made a wrapper around fd + fzf to navigate through my files xor my directories. It's really an amazing tool.
Good God, you’re my hero 😮
here I am building an index in /tmp using find, then egrep'ing through it like a caveman on my ancient boxes
this is great
At least with Fish shell, ctrl-w will immediately open fzf and stick the path where your cursor is. It'll also accept a prefix if your cursor is on a space-delimited word, cutting down the search space.
I think Telescope's fuzzy search is much more convenient when trying to search and open files
Cool but if you cancel fzf neovim still opens. You could fix this by piping fzf’s output into xargs -r … instead.
that *IS* cool
Add the cli completions with the eval command in your zshrc
mind blown
Better than windows search
You know someone has drunk all the koolaide when they use any vim variant.
The problem with doing `nvim $(fzf)` is that if you cancel the search/kill fzf, nvim still opens. I would use `fzf --bind "enter:become($EDITOR {})"` instead. 👍 That opens the editor only if you press enter on a file.
Thanks bro, also, nice mustache
Thanks brother
It’s so underrated
Is the bar with your username and time from the shell or the terminal emulator? That looks real nice.
you could try zsh with omz for that
@@poetranoegraha6641 thank you!
Is there a Theme for it or is it customized?
@@Swagseneyer there's a theme for it, but you could try to customize it as well
I ran FZF in my home directory in a video on RUclips, and people found my... uh... secret folders...
neovim's telescope plugin does this for you also
so finally a "search everything", but not for windows and dependant on NTFS journal?
🥰
What terminal is that? It looks VERY beautiful!
What is your keyboard brand, and what keys do you use?
Hi typecraft! Are you using a topre keyboard?
I am!! Happy hacking keyboard
What keyboard are you using in this video?
can you then save that command to a keyboard shortcut somehow?
Nano ~/.bashrc
Save this line of code to it then :
alias bashedit="nvim $(fzf --preview='cat {}')"
Press Ctrl + O to write buffer
Enter to save
And Ctrl + X to quit nano
Then update terminal configuration by source ~/.bashrc
Then you could also recheck if your bashrc is modified successfully by using
cat ~/.bashrc
If setup properly , you should also consider restarting your terminal and a new command would be added named bashedit , you can ofcourse make more commands sets off this etc.
@@VOID_4487!nano🙅, vim🤙
nice, i made it a custom function so I can just type fzfnv to trigger the command. Cheers nerds!
How?
@@flowingcode8069 add this to your zshrc or bashrc:
fzfnv() {
nvim $(fzf --preview='cat {}')
}
@@flowingcode8069 if you're on mac you can edit (or create) ~/.zshrc to create custom bash / zsh command.
if you're on ubuntu derivatives it usually ~/.bashrc or ~/.bash_profile
subscribed
broot is pretty cool too, content search.
What's your ZSH theme? I like it
Or use windows and you no longer need to remember exactly and to the letter command lines and switches. Right-click open and search the opened folder. From ui, in an intuitive and easy to remember way.
And it works on system folders as well FROM THE GUI.
But you’re trading away fine controls and granularity while taking on a shit ton of bloatware. Windows is a fantastic generalist OS for everyday casual computer users. The people who this is meant for are generally not that and are probably very comfortable with running a CLI.
why are you 'losing' files on your system?
I suppose it helps devops when they configurate servers
trust me, when you're working on large codebases or with multiple machines, stuff like this can be very useful
Omg thanks
More commands like these pleease
Hi my nerd lord ❤ Do you use i3 or sth else like,.. Hyprland?
I’m an i3 guy
What are some good beginner projects for someone who just got into bash and only knows the basics?
Thanks nerd, nice tool! How I can install fzf, any docs or guides?
sudo pacman -Suy fzf
@@Ziggurat1 thank you, on Ubuntu should be same way I guess
Maybe someone can find this useful: in order to have constant fzf preview without having to type that every time, I added this in the .bashrc ` export FZF_DEFAULT_OPTS="--preview 'batcat --color=always {}'" `. So everytime you open fzf you have your nice preview by default
whenever I eat something I should have, I think about vi and vim related programs. it is like when cats eat house plants.
How’d you get that colored bit with the time there 👀
How have you dropped your command line below the status line?
Now put it in a while loop, and if it's a directory, cd into it 🤓 it works!
Does anyone know what PS1 variable that is? Or is it not even bash?
What command prompt are you using
There was a comment that suggested using windows instead.
I reported it for promoting terrorism
What's your keyboard?
Happy hacking keyboard!
I've made some aliases that cd or edit the file that I'm searching for. I called them fcd and fed for home directory and FED/FCD for root directory
comment for the Algo
what if I want entries of my bash history to not suddenly disappear?
What OS terminal makes it look like that?
Just subbed. This is cool
welcome, brother!
What is your keyboard/key switch
Happy hacking keyboard (topre switches)
Regarding neovim, I thought piping was the SOP in Unix? Shouldn’t it be fzf blah | neovim 🤔
Jeez make it an alias 😊
Of course!!! I’m just showing off what you’d put in the alias :)
@@typecraft_dev❤
literal, 100% literally, literal. wow. literally.
Holyyyyy thanks to fkin youtube recommendation
Insta subd
i can click folder, it's right there.
In Sublime Text I can organise a set of repositories into a project, so I might have infrastructure, gitops, apps…
This is useful management how can I recreate this functionality in neovim?
When I have to write again and again slugs or project id, i like to have a slugs.txt file.
I would 'cat' the file then pipe into fzf in order to search between each line, then pipe into clipboard.
For me it look like this
`cat filename | fzf | clip`
In a complex project structure I would also use fzf to open a file inside my current VSCode instance, using the -r flag.
`code -r $(fzf)`
😊
I feel like a caveman after watching this 😮
I have been using fzf all the time. I have fv in my terminal aliassed to nvim $(fzf --preview="bat {}")
I'll scribe
what about telescope?
Yeah... thats what i was wondering
@@darknessraider624 what about it? Telescope is nvim related, you were just shown how it’s done beyond nvim.
Thanks nerd 🤓
Whoaaa what
What was wrong with cat, file globbing and grep?
I wanna know too so I'm leaving a comment here so I can get notification if there's an answer.
@@prateekkarn9277 Answer: The clown who made this youtube short that has grossed over 100k+ hits in less than 3 days is telling you, prateek, this short is just recycled dog-water XD
Why not just pipe to nvim? Works better if you interrupt fzf
what if... i wanted to click everything?
Telescope find_files?