Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 13, 2022 08:51 am GMT

[Chad tip] You know you wrote it,... but where ?!

Most extreme scenario

Doomer(Sitting at his desk):

I know I've already wrote a function like this. But can't remember in which file!!

I will have to open each potential file and seek for the line.
If this becomes recurrent, at this rate, I will hit the deadline soon.
I am an incompetent.
I bet my girlfriend is cheating on me.
This distro sucks.
I need to smoke a cigarette.

Chad(Coming from the sky):

I was just like you before! Let me help you!

Usage

ou <insert your text>

Example

You need to find where you used this function but your IDE stinks.

Type this in your terminal.

ou aggregate

Image description

"ou" means where in french but can be whatever alias you want

Reasons

A fuzzy finder is the search bar that browse through file name or file content when usually pressing (Ctrl-P, Ctrl-F...) in your IDE.

Why not using vscode finder?
I only have a AMD4700 CPU with 12 threads so it won't retrieve the code until the next day!

Why not using VIM finder?
I don't want to supercharge nvim/spacevim finder to browse through text.

Install

Beware !
You can only use it if you master the CLI.
For power users and very advanced linux users only.
I use arch btw.

...

The hard truth

It's nothing more than a "grep" with multiple arguments.

Just put this in your .bashrc , .zshrc or wherever you may source your aliases.

# .zshrcalias ou="grep -rn --exclude=\*.{png,jpg,lock,log} --exclude-dir={.git,node_modules,dist,build}"

grep options:
r -> recursive
n -> print line number

If you've been through all these steps you may be kind of a genius yourself.

Congrats.
Never loose hope.
Everyone has a chad in themselves.


Original Link: https://dev.to/areskul/chad-tip-you-know-you-wrote-it-but-where--2h10

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To