What is Vi?
Vi was the first screen-oriented text editor created for Unix, it was designed to be simple yet powerful for text manipulation.
What is Vim(Vi IMproved)?
Vim is not just any text editor, it is an open-source configurable text editor that we can program according to our needs. It is an extremely fast and powerful text editor.
Philosophy of Vim
When programming, you spend most of your time reading/editing, not writing. For this reason, Vim is a modal editor: it has different modes for inserting text vs manipulating text. Vim is programmable (with Vimscript and also other languages like Python), and Vim’s interface itself is a programming language: keystrokes (with mnemonic names) are commands, and these commands are composable. Vim avoids the use of the mouse because it’s too slow; Vim even avoids using the arrow keys because it requires too much movement.
The end result is an editor that can match the speed at which you think.
Advantages of VIM
- Vim is Always Available: Vim is available on most, if not all Linux distributions out there, you can install it from your distro’s official software repositories as follows:
apt-get install vim [On Debian/Ubuntu]
yum install vim [On RHEL/CentOS]
dnf install vim [Fedora 22+]
WSL and WSL2 can be used in Windows to be able to use VIM. Also, Vim GUI can be downloaded for Windows to use VIM. Click Here to download Vim GUI.
- Vim Is Very Customizable and Extensible
- Vim Uses Less Amount of System Resources
- Vim Supports All Programming Languages and File Formats
- Vim Has A Vibrant Community
Disadvantages of VIM
- Difficult learning curve
- High effort to customize
Modes in VIM
Vim’s design is based on the idea that a lot of programmer time is spent reading, navigating, and making small edits, as opposed to writing long streams of text. For this reason, Vim has multiple operating modes.
- Normal: for moving around a file and making edits
- Insert: for inserting text
- Replace: for replacing text
- Visual (plain, line, or block): for selecting blocks of text
- Command-line: for running a command
My Opinion on Vim:
Stick with using vim for all your text editing needs (even if it slows you down initially). If you can cross the initial learning period then it could be a boon for you.
Top comments (23)
Vim is pure awesomeness, Am very much happy with my current Vim customization.
I have recently switched to NeoVim and has everything pretty much set up like code autocompletion and stuff.
Once you overcome the learning curve, then it is a huge jump towards productivity. For over 3 years, I would try to use Vim and fail badly. But in 2020 just choose to give it a shot.
May I ask you how you got code autocompletion? Is there a neovim built-in plugin I'm not aware about? I've taken a look at coc, but it requires some configuration, so I always leave that for alter.
The configuration for COC is pretty simple. You can just copy and paste from the repository and them change as you use and learn what you like. However, if you prefer, neovim nightly has LSP. It that requires more configuration than COC, but it works using LUA
I am using coc-nvim plugin but never delved into any configuration. But everything works fine.
github.com/VishnuDileesh/dotfiles/...
can you elaborate more about your setup, i have heard of neovim, but havent got around to actually switch to it. what did you change about it? (or didnt ;) )
Neovim is great. You can use Lua to write plugins which is far more friendly, and in general the community is better. From a development perspective you won't notice much if any differences, but the idea behind neovim is to make it far more open source and provide features that the community want, not just the core maintainer of vim. I'd recommend making the move even if you don't have any immediate necessities for it, to at least support the movement.
Got any tutorials/articles suggestions to get started with building vim extensions?
I will be taking open source contribution seriously from 2021
I'd recommend checking out this dudes twitch and youtube channel twitch.tv/teej_dv - he's a maintainer of neovim and does some good lua plugin development. Other than that for me I haven't spent ages learning, other than googling and looking at other plugin repositories is potentially the best bet
Thanks, yep looking at the source code of few plugins I use is where am planning to get started
Have not done much customization, just installed a few plugins and made some tweaks here and there.
youtube.com/watch?v=gnupOrSEikQ
youtube.com/watch?v=65Wq4fjREUU
Both those videos were a great inspiration in the tweaking
I'm curious - did you have any particular best ways to learn VIM, or was it more a matter of just going for it and learning as you went along that worked best for you?
I recently started learning VIM as well. Amount of things you need to learn early on is rather scary, there's no two way about it. However,
vimtutor
(should already be installed alongside vim) walks you through step by step of what you can do with it. For common actions, vim command is rather easy to understand. It usually follow the three steps of "action" (modifier) "direction". This helps me the most with learning the keys.When I used it, if I get stuck not knowing what to do, I'd just google them then add those actions and keys into init.vim so I can easily remind myself of what it is. Usually after a few time your muscle would start to memorize it any way.
In the end, I don't think you need to learn vim. Lot's of great IDE is out there and provide easy extensions out of the box as well. I only learn it to be able to work faster inside a Docker container.
Definitely there are great IDEs like VSCode but they have their cons too. Their startup time is much greater than vim, so I don't really like IDEs. Though IDEs have great autocompletion but they are slower in file navigation and movements. Everyone has there own set of perferences, so no IDEs or text editor is bad.
Initially I learned some basic commands of vim and used those commands for making edits in my files. If I get stuck somewhere I Google the command for it and if the command is not in my comfort zone I make a keybinding for it. I use vim regularly so I keep on learning new things on the fly.
Sounds cliché but just use it every day. I swapped it to my main editor before I was more productive and I'd say I had about 2 weeks of being less productive and it was all up hill from there.
That's not too bad! Could be worth doing side exercises in a low-stakes environment w/ VIM and then switching to it from time to time for work.
Also, there is a great plugin twitch.tv/theprimeagen created which you can practice on github.com/ThePrimeagen/vim-be-good
like the nike guy, Just Do It!
its hard but will reward you even more with the mastery of text editing in full speed :)
ah, that's the dream!!
I love vim, but you are so right about high effort to customise. I've spent many hours coming to the setup I have today: github.com/haydenrou/dotfiles
But I've enjoyed the journey and learnt so much along the way.
If you like customising your setup and always striving to be faster - vim is for you. If you are looking for a generic code editor and don't necessarily want to spend time with it nor care about the internals, don't bother.
Your so right about vim/vi its the only text editor on my work servers, I can use it like the back of my hand, I've never had the luxury of a more "modern" editor so have never known any different, its always quite funny seeing people that have years of experince and cant use vim
Hi Rittik. Could I suggest you use something other than "click here" as your link text? It makes things more difficult for people using screen readers.
I have been using Vi / Vim for almost 15 years now. Cannot get over it. Plus, the plugins make it more awesome. For those who want to learn, vimtutor is the best.