How to approach learning Vim - tips from two monks

Vim is a powerful text editor and can be used for data wrangling. Two monks shared resources and their thoughts on how to learn this tool.
opensource
fastaicourse
terminal
Author

Kurian Benoy

Published

June 27, 2022

Early morning, the disciple woke up to learn from a monk’s session at 6:30 AM to advance his skills. Today the monk was teaching about how to use vim, which is a great text editor.

Monk said Vim is powerful and specifically data scientists should learn Vim because interactive text munching is what we do with input data files and output data files all the time.

💪Showing the power of Vim

The monk then went ahead and showed how he made Youtube chapter markers from the posts as shown below. The monk wanted to convert this comment to a format which is suitable for youtube to add chapter markers, so folks can easily watch it in future.

00:00 Create a total empty notebook
- How to be lazy and a great programmer? 03:02


04:13 Create an empty notebook and symlink from persistence storage
-  Why open a new window to use jupyter lab? to keep paperspace interface for shutting down when finished
-  Why should you read paperspace docs? What did Jeremy find out? 05:16
-  What are the interesting folders inside the root directory?
-  How is storage folder different from notebooks directory? Why both of them exist for good reason? 06:32
-  Should we worry about using pip install when paperspace uses conda a lot? 08:02
-  How to pip upgrade packages into the home directory with --user? pip install -U --user fastcore 13:14
-  What folder we want to be there next time when we open notebook? .local/
-  How to save this .local/ into persistence storage? mv .local /storage/

19:24 Create pre-run.sh from scratch to automate .local symlink from storage


-  How to create a python file to setup the symlink first before running jupyter lab 
-  Does Jeremy think paperspace is the way to have easy to use GPU for fastai in 
-  How to make a symlink from /storage/ back to this notebook’s /notebooks director
-  What does this step above do? to link the /storage/ folder back into /notebook
-  Why to access the /storage/ folder inside notebooks is useful?
-  How to create a text file, edit it and save it inside /storage/ with jupyter lab?

The monk opened his Vim editor and showed a bunch of ways he can easily do this task very quickly with ex commands as shown in the gif below.

Finally, the output will be like in this format:

00:00 Create an notebook
04:13 Symlink from persistence storage
19:24 Create pre-run.sh from scratch to automate .local symlink from storage

If you are curious to learn the trick, follow the below three steps:

Step 1: To delete and move to the start of the next digit type d /^tep 2: Then move down a row using j (or down arrow) and type dot ‘.’ to repeat the movement: j.

Step3: When it’s almost over with no more chapter markers, type dG to delete till the end of the file.

Disciple asks how to approach learning Vim❓

This disciple was really impressed, yet intimidated at the same time seeing this and asked to the monk how can someone learn Vim and lot’s of keyboard shortcuts he showed when someone is a beginner at this topic.

First Monk speaks

The trained monk replied as following:

The trick with learning something new is try and like learn in small chunks. So don’t expect to learn all of Vim. At this point:

Start by learning i to start inserting text, arrow keys to move around, escape to go back to command mode, and :wq to close and save. At that point you can use vim to edit your shell scripts and stuff. Then try and learn maybe one or two new commands each day like motion commands w and b are useful to move forward and backward a word.

There are lot of tutorials out there in internet like openvim.com is very helpful to learn Vim. You can work through tutorial like this.

Yeah honestly we all get intimidated, when we see an expert working with something that we don’t know yet and at first it’s like WOW that’s powerful I wish i could do that. You will be like my god you know how would i ever get to that point … the goal is not to be an expert at Vim the goal is to like be able to use Vim to like slowly do something that you want to be able to do.

This is one of the things the I really had to practice for myself in my late teens and early 20s was to repeatedly put myself in a position where I was intentionally doing things slowly by using a tool that I wanted to know and I was pretty sure at some point would be useful but I didn’t know it well enough to do it faster than with other than some other tools.

So I’ve always you know since like 16 been pretty good at using Lotus 1-2-3 and Excel spreadsheets. I tended to turn to them for everything and then I wanted to learn SQL databases. So I kind of forced myself to do things involving lists with databases for a while even though I got slower and then I was like … I’m going to start doing more stuff with VBA macros and stop doing stuff manually and again it was kind of slower for a while and then became faster.

Particularly like you know things like cleaning up that Youtube timestamp thing to create chapter markers. I could have done that manually you know and and the first ten times it would be faster to do it manually but don’t do it manually right because each time you do it manually you know you’re missing out on the opportunity to get better at the thing that’s going to make you faster.

The thing about practicing what you think might eventually be the fast way is that those fast ways accumulate together in kind of these multiplicative ways. So you know I’ve been kind of using this approach of always trying to do things the way I suspect would be the fastest if i was an expert at it. I have been doing that for like 30 years now.

Now most people who watch me work go WOW you’re very fast at doing stuff. You must be really smart you know. I am like Oh no I’m not really smart like you should have seen me when I started, I was terrible… Yet now these things have all accumulated right.

If anybody finds you know good tutorials let me know honestly it’s been a long time since I’ve run a vim tutorial. So I don’t know any good tutorials and don’t know the first one that came up in google is good or bad. I am sure though openvim.com is pretty good though.

Thoughts of Vim plugins

I recommend don’t install lots of plugins there’s lots of plugins you can install. After using vim for well over 20 years, I don’t use any plugins at all. It’s not to say that there are none that are of any use … but like they’re not that useful honestly and you can get lost in that whole like customizing things thing. I just wanted to make it clear to say that actually out of the box Vim works fine and you customize with vimrc configurations.

Second monk speaks

This when another monk who is working in NVIDIA chimed in with tips to learn vim.

According to me the best tutorial for learning Vim is in terminal. The vimtutor is a excellent tutorial. The first time I looked vimtutor is intimidating, it took me only on like third or fourth try does it start to make sense and was able to complete the entire thing.

When i was learning the basics of them I realized Vim has a steep learning curve. I like to make things appealing, attractive and simple for me. So there is this game called vim-adventures.com.

When I had my corporate job and instead of whatever people do on calls which is just you know browse Reddit. I would do play with website vim-adventures to learn more.

Another resource, which is really great is the Vim book: Practical Vim, Edit Text at the Speed of Thought. It is really well written and there’s a similar book for tmux so that’s that’s two book which made the really big difference for me personally.