DEV Community

Cover image for On Learning Vim

On Learning Vim

Sindbad_X on October 26, 2024

A year ago (I still do), I would get so amazed and overwhelmed watching ThePrimeagen navigate the Vim editor. I wanted to do it as well. But I was ...
Collapse
 
tsolan profile image
Eugene

Once upon a time, I’ve decided to learn vim, mostly because of generic key binds which I wanted to apply to vscode via vim plugin (years of using vscode with my own custom ones left me unhappy each time I encountered different environments) and, additionally, some utilities also uses vi by default. I started with vim plugin in vscode, but quickly found myself confused due to muscle memory associated with vscode. Thought to switch to nvim for the time of learning. Having installed nvim, I picked up some tutorials on youtube that carried me through basic setup and explained basics of lua and nvim apis, so I was able to begin practicing. Days were passing by, more and more I was getting used to it as well as bringing more modifications to the interface to fit my needs. Finally, it ended up with almost perfect setup, a great command over the functionality, and a strong desire never ever again to return to vscode at all.

Collapse
 
sindbad_x profile image
Sindbad_X

@tsolan yeah, i couldn't and still find it hard to switch to nvim because the environment is so different out of sudden. I put the one dark theme, and now i feel a little bit less foreign in this new environment. i haven't made the switch entirely to nvim but i can see myself, as you have to reach a perfect setup where i may not want to leave to vs code at all.

Collapse
 
tsolan profile image
Eugene

By now, I have been using nvim for more than a year and since then never launched vscode…

Thread Thread
 
sindbad_x profile image
Sindbad_X

@tsolan go daawg!!!

Collapse
 
rc2168st profile image
rc2168st

Now start using emacs.

Collapse
 
sindbad_x profile image
Sindbad_X

@rc2168st what's that? sound devilish 😈😈😈

Collapse
 
pengeszikra profile image
Peter Vivo • Edited

Increase your productivity by use VIM motions in shell with this command:

set -o vi
Enter fullscreen mode Exit fullscreen mode

Great to add ~/.bashrc or ~/.zshrc

Need press to ESC to turn normal mode.

Usable moves: 0 jump to first, A jump to end and insert mode. dd delete line, yy copy line, p paste.

Detailed information:
How to use vim motions in shell

Collapse
 
sindbad_x profile image
Sindbad_X

@pengeszikra added it, thanks for the recommendation.

Collapse
 
acudworth3 profile image
acudworth3

Don't be afraid to use a distribution like Astro, lazy or Chad neovim. It's a bit of a short cut but will keep you using neovim quicker. After a while you'll want to do the configs yourself to get it just right (in my experience).

Configuring for front end won't be much trouble if you go that route .

Collapse
 
sindbad_x profile image
Sindbad_X

@acuwebservices so i did started with nvchad, but i felt too much of the overkill and i didn't understand lot of underneath thing. currently, i'm using kickstart.nvim, which uses lazy.

Collapse
 
ddebajyati profile image
Debajyati Dey

I remember more than 1.5 year ago I was stumbled upon the videos of NVChad by Dreams of code(Elliott Minns) on YouTube. I was fascinated by how a terminal emulated text editor be so beautifully elegant, aesthetic yet incredibly efficient, powerful and customizable. I used to use VSCode and Pycharm before that and they had a huge start up time which was annoying. I felt I really need to try Neovim, though I never used vanilla vim before that. I was enrolled in a UG CS degree program and was new to the programming world. I felt it really exciting that a text editor has its own programming language, and the scriptable configurations serve as the settings for it.
Also, git installation wizard tempted me to try Vim by prompting, Vim though very powerful, can be hard to use for beginners something like that. That was the first time I heard about vim. I started with Neovim with NVChad but didn't learn lua even a little bit (at that time) which made it impossible for me to debug the config, when something crashed. After then switched to several preconfigured distributions out there, Astronvim, Lunarvim, Lazyvim, nyoom.nvim, spacevim. Every Config had a different learning curve and at some point, there were different bugs (like error at opening Telescope or opening a file with attached LSP installed) which were not getting fixed for a long time.

I started learning how to be productive in vanilla vim without any plugins, (like opening tabs with :tabnew or :tabe, Texplore and navigating with Ctrl+PageUp Ctrl+PageDown etc. Don't need plugin for managing buffers). Learned the vim motions by keep checking out the cheat sheets sometimes. Still learning. Slowly started configuring it step by step from built-in options to extending with plugins, (setting up LSP with Coc.nvim) and had fun along the way. If you want, I can show my vim config in a comment.

But there was something missing. In the vim plugin ecosystem, there was no terminal plugin like we have toggleterm in Neovim plugin ecosystem. So, I had dived deep in vimscript and wrote my first vim plugin - turboterm.vim. Very minimal but works as per my needs. And I think I need to implement some more features. Will try when I will have time.

After few months I found some interesting Neovim plugins and none-ls came out in way making me really excited to try Neovim once again and build my own config from scratch (I wanted to have Neovim like a full-blown IDE while vanilla vim will be minimal editor). I was watching ThePrimeagen and TJDevries on YouTube from months. Watched two videos of ThePrimeagen from the vim playlist. Went through full the tutorial ( 0 to LSP from scratch ). He was using Packer while I was using Lazy.nvim. When I was almost satisfied with my config, I wanted to keep it as my own pre-configured distro in my GitHub. I named it Efficienvim.

Overall, I'm pretty much content and satisfied with my config.

I have a desire to learn Lua properly so that I can make some unique plugins in the future.

Collapse
 
sindbad_x profile image
Sindbad_X

@ddebajyati you are waaaaay ahead boi! i'm still a timmy. thanks for sharing your story, great read. perhaps turn this long ass comment into a full blog post with all the things you have learned and build. looking forward to it!

i too thinking of diving into Lua, but right now i'm already wrestling with Golang. anyway, learning vim and configuration is on my long term plans, so i've no rush.

Collapse
 
ddebajyati profile image
Debajyati Dey • Edited

Yoh!
Thanks, I may write posts like these in future ✌️🙌

And yes you will be tempted to write plugins in future, if not currently.

You have already done ✅ great work too, learning vim motions is a valuable skill and its universal, available everywhere.

Collapse
 
ezpieco profile image
Ezpie

I have one small tip. Configure vim by yourself, take help from youtube videos or documentation if needed, I know it can be a bit overwhelming but mind my words, you will realize just how crazy it can get, because you made it you know it, as simple as that, at first you might get problems while configuring, but once it's all done using the editor will be a blaze.

Collapse
 
sindbad_x profile image
Sindbad_X

@ezpieco yes that's the right way. i'm actually planning to do that. but before that, i'll need to look at some lua.

Collapse
 
diso profile image
Wayne Rockett

💡Is the reason people in Vim Club always talk about Vim, because they don't know how to quit Vim Club?
Image description

Collapse
 
sindbad_x profile image
Sindbad_X

@diso are you also part of the vim club?

Collapse
 
pratapkute profile image
Pratap kute

You're doing great! I'm still battling with Vim—loving the experience, though; it's like a video game, except I occasionally win!

Collapse
 
sindbad_x profile image
Sindbad_X

@pratapkute haha! awesome

Collapse
 
tigga73 profile image
tigga73

Read the book practical vim: edit text at the speed of thought, 20 minutes every day during 1 month mades me more faster than the last 9 months using exclusively Neovim

Collapse
 
sindbad_x profile image
Sindbad_X

@sirbabyface thanks, found a pdf version on github. hope i get time to read it.

Collapse
 
joeschr profile image
JoeSchr

Configuring frontend is no Biggie. I use it every day, with the help of lazy and mason.

Also check out oil.nvim as netrw replacement.

Yazi for Filemanager with vim keys

Collapse
 
sindbad_x profile image
Sindbad_X

@joeschr i'll definitely check that out. I did came across oil.nvim, but again, as I said earlier, I'm trying to stick to default for now. so, for another day for sure.

Collapse
 
martinbaun profile image
Martin Baun

Once you get the binds to your memory, you won’t be able to use anything else :P

Collapse
 
sindbad_x profile image
Sindbad_X

@martinbaun yes 100%. i'm already using vim keybindings outside vim: obsidian.

Collapse
 
mannuelf profile image
Mannuel

Nice, congrats on two accounts switching to Linux and using VIM. I keep this cheatsheet nearby vim.rtorr.com/

Collapse
 
sindbad_x profile image
Sindbad_X

@mannuelf thanks man. although i haven't mentioned this cheat-sheet here, this is my default reference. i didn't list it because it will probably overwhelm newbies. but once you are past the newbie phase, this cheat-sheet is very very handy.

Collapse
 
kurealnum profile image
Oscar

Well written! I always enjoy seeing people join the vim cult fanclub.

Collapse
 
sindbad_x profile image
Sindbad_X

@kurealnum i haven't sold my soul to the cult yet

Collapse
 
moopet profile image
Ben Sinclair

Oh you have, you just don't know it yet.

Thread Thread
 
sindbad_x profile image
Sindbad_X

👀👀👀👀👀

Collapse
 
navneet_verma profile image
Navneet Verma

Nice article, your experience motivated me to learn vim myself! But is Vim for everyone, What do you think ?

Collapse
 
pengeszikra profile image
Peter Vivo

My opinion is vim is great for every one, because more or less on certain point we are facing a terminal -> shell, during our works. If we are forcing to use windows as developer environment, then I suggest to select gitBash as termina, that is give a near same experience as linux or MacOs shell does.
VIM are installed!
But at the old days I am don't spend time to understund this great editor. Which are seems wierd at first moment compared to nano. But if we spen a bit time to understand the basic movement, than that is good starting point at least to use as side editor, when we don't want to leave a shell.

best movement:

o -> turn to insert mode and we get a new line under current one to write
: -> back to normal mode
:q! -> back to normal mode and close without save
:wq -> back to normal mode save our modification and quit
:e start-typing-filename -> back to normal mode and open any file to read or edit, you get all helps as OS give. Mainly tab help is good at this point.

So I recommended to learn vim to every one.

Collapse
 
sindbad_x profile image
Sindbad_X • Edited

@pengeszikra agree! at some point, you will be greeted with vi in shell and i remember first time, wondering if this program is broken or what. nothing happened on pressing any keystroke, so i killed the terminal and going to bed in confusion. I wish i had took some time to understand what it was, because now i feel i missed an amazing tool that i would like to carry with myself throughout this programming journey. And you know what, it's not even that hard. Just takes a little time to get used to this mode of thinking and navigating the cursor and editing text.

Collapse
 
sindbad_x profile image
Sindbad_X

@navneet_verma i don't know if vim is for everyone but if you have some time, you can try it out and find it yourself.

Collapse
 
kasir-barati profile image
Mohammad Jawad (Kasir) Barati

IDK what you were doing with vscode since I am also using it but without crashing. My laptop is not that high on hardware and my OS is Manjaro.

But sure I am also thinking of moving away from VSCode to something lightweight.

Collapse
 
sindbad_x profile image
Sindbad_X

@kasir-barati i think it's something related to wayland. also, when i start vscode, i see massive spike in ram(reaches upto 80% for first 5-10 seconds). I tried disabling all the extensions, the issue still persist.

Collapse
 
dhan profile image
Dhanush K • Edited

Opening vim
In cmd type nvim to open vim

Closing vim
press :q to exit vim

Thank me later🙂

Collapse
 
shakilnwz profile image
Shakil Nawaz

Long press the power button.