Hello World
Hello, world! I finally got my website up and running. As a first post, I will describe some of my favorite tools that I use for better software development.
ripgrep
I have to work on a very large codebase for my work, and it is sometimes beneficial to try and look for a particular string and if it appears anywhere in the entire codebase. However, when I do
$ grep --recursive "hello, world!" .
The command won’t find all of them for about a minute, and when it does, it often links some random strings that are found in a built binary, polluting my results.
Enter ripgrep. ripgrep, or rg for short,
bypasses these problems by ignoring all of my built files that are already
found in my .gitignore
, making my search 1000x faster. And the
best part is, it uses a very similar syntax to grep
, making switching between
the two almost no hassle at all.
Code example:
$ rg "hello, world!"
tldr
Another problem I face often is that I need to look up what a command does and the syntax for it as well. I sometimes go to the browser to look up what a command does, but this can be tedious, because i might get exactly what i want. I could also go to the man pages to look at it directly from the terminal, but this would take a lot of time to look for exactly what I wanted.
Here is where tldr
comes in to mitigate my two issues here. It directly outputs
a lot of code examples for the command in the terminal itself. For example, if I
run tldr tldr
:
$ tldr tldr
tldr
Displays simple help pages for command-line tools, from the tldr-pages project.
More information: https://tldr.sh.
- Show the tldr page for a command (hint: this is how you got here!):
tldr command
- Show the tldr page for `cd`, overriding the default platform:
tldr -p android|linux|osx|sunos|windows cd
- Show the tldr page for a subcommand:
tldr git-checkout
- Update local pages (if the client supports caching):
tldr -u
As one can see, it gives a lot of examples, one of which will most likely suit your needs.
It supports a lot of commands, and I now always look here instead of the internet first.
Neovim
Rather than talk about neovim and how I think that it is a great editor for its extensibility, simplicity, and not having to use the mouse, a better thing to focus on is how I use it and its capabilities to help me code.
ctrlp
This is a nice extension that allows you to open up new files quickly using fuzzy finding. A great tool that makes it possible to not have to close my editor at all when browsing between files.
Deoplete
This extension is my autocomplete extension. One can pair this up with a language server, and boom, you got (almost) IDE level completion.
NerdTree
This allows me to press <F2>
and see the project directory. A nice way to navigate
your project along with ctrlp
.
How to learn more tricks?
After I learned the basics, I struggled to find some place where I can learn some more tricks. However, I subscribed to the VimTricks blog, and here, they write a lot of tricks that even experienced vim users might not know. For example, one cool thing that I learned is that when making a find and replace expression, where the found chars are in the replaced string, like this:
:%s/hello/hello, world!/g
One can use the &
sign to copy what is to be replaced, so one can write this instead:
:%s/hello/&, world!/g
This becomes useful when, for example, I might want to edit some function signature in a particular part of the code.
Of course, there are probably other places to look as well, but I like this one because it brings me a new tip every week.