--
Learning to use vim as you default text editor can be very hard, especially in the beginning. Why is it so hard to learn vim and stick to it, well meanly because of vims steep learning curve which is different than most other stuff you try to learn. To learn vim, you need to create muscle memory, do not try to memorize every single command the first day, it is impossible.
Try to learn something new every day or week; this way, you do not burn out and quit. To give you an impression of how the learning curve of vim looks in comparison with most other text editors.
As you can see, it takes more time to master vim the most other editors.
But when you get the hang of it becomes second nature to you and you don’t even think about the commands you use, which is, in my opinion, the point of using vim.
The best thing you can do to speed up your learning process is to use vim for everything, and I mean for everything, even for regular text documents.
The only problem with this approach is that it ruins your workflow for weeks or even months, you are not nearly as fast as when you’re using a standard text editor. So this is where most people quit and go back to there old Routine. But if you stick to it, you have a great tool which improves your writing quite a bit.
Inner operations (normal mode)
Used when deleting, editing or copying a text object. You can do any of these operations when your cursor hovers over a text object.
A text object can be a word, paragraph, tag or something between quotes, brackets etc..
Some examples:
Words:
Change, delete, copy and select a word (does not select whitespace).
delete word
d i w
change word
c i w
yank (copy) word
y i w
select word
v i w
Tags (HTML):
change, delete, copy and select inside of an HTML tag.
delete the content of a Tag
d i t
change the content of a Tag
c i t
yank (copy) the content of a Tag
y i t
select the content of a Tag
v i w
Quotes
change, delete, copy and select inside quotes.
delete everything between quotes
d i t
change everything between quotes
c i t
yank (copy) everything between quotes
y i t
select everything between quotes
v i w
Its seem reasonable that if you can select the inside of a text object, you can also select the outside. I use this less than inside, but maybe you find it useful.
Differents between them:
Outer operations also get rid of the space outside the text object.
delete word + whitespace
d a w
Something often overlooked is that you can easily repeat the actions that you perform. The key to executing the last action is a period.
.
If you start out using vim, you probably using j & k a lot for navigation through up and down in your files. Which is not very efficient, I recommend the follow commands.
Jump one paragraph up or down (by far the most useful)
{ or }
Jump one screen backwards:
CTRL b
Jump one screen forward:
CTRL f
Jump to top of the document:
gg
Jump to the bottom of the document:
G
Jump to top of the screen:
H
Jump to the middle of the screen:
L
Jump to the bottom of the screen:
M
Something I found my self doing way too often was adding a blank line with “o”, and then I had to jump back to normal mode. So I made a little mapping for that.
Add this to your .vimrc file:
nnoremap <Leader>o o<Esc>nnoremap <Leader>O O<Esc>
Now you can use your leader key + 0
Add a blank line above the current line
Leader key o
Add a blank line beneath the current line
Leader key O
These where my tips to improve your workflow with vim, I hope it helped some of you.