====== Some vim-tips ======
"vim" is a great editor. It started out as another vi-clone but has become the most enhanced version of vi on the planet.
Here are some tips from https://box.matto.nl/vimtips.html :
* [[#Splitting windows]]
* [[#Pasting indented text]]
* [[#Selecting blocks]]
* [[#Showing all your bookmarks]]
* [[#Sort an part of your file in vim]]
* [[#Jump to the last insert position]]
* [[#Open a filebrowser]]
* [[#Edit your last shell command]]
* [[#Show word-count]]
* [[#Mapping for opening companion include file]]
* [[#Other sites]]
===== Splitting windows =====
Open more then one file at the same time and edit them both. First, split the screen and open a second file:
:split second_file_name
Now you have a screen splitted into two areas, one holding the first file and one holding the second file.
Moving from one window to the next
Ctrl-w Ctrl-w: rotate through the windows\\
Ctrl-w space: rotate through the windows\\
Ctrl-w j: go to window downwards\\
Ctrl-w k: go to window upwards\\
Ctrl-w _: maximize current window\\
Ctrl-w =: make all windows same size\\
===== Pasting indented text =====
When vim is autoindenting the results of pasting some text can be quite horrible. There is a simpel solution for this:
:set paste
< some pasting here >
:set nopaste
That is all!
now you cat paste text in vim too :)
===== Selecting blocks =====
A fast way to select bloks is with visual-a.
To select a block between ( and ) do:
vab
and to select a block between { and } do:
vaB
===== Showing all your bookmarks =====
Using marks in vim
You can easy set bookmarks in your text with the command: m