Vim is an editor built on vi, at the moment it's my favorite shell editor. It is very tweakable and there are many plugins to autocomplete words and functions. In this post I will discuss some features of vim and how they work. Vim is more than just a basic editor.
You can easily navigate with vim.
^ or home-button
$ or end-button
You can do find and replace. A vim substitution regex looks like this:
ranges this is the first character after the ":" :
Johnny was a little boy but Johnny is no more, for what Johnny thought was H2O was H2SO4!So if we want to replace "Johnny" with "Bobby" we need to type:
This means, replace, in the whole file, all character sequences that match "Johnny" with "Bobby" ignoring capitalization. If these words were in the text they would match:
johnny Johnny Johnnytonny
You may also write the previous expression like this:
Here we replace "/" to ":". If we want only words to match, so no character sequences (e.g. Johnny but not Johnnytonny). We need to use the word boundary:
If you want to learn about patterns and regexes visit vimregex.com.
:ab rtfm read the fine manual
Whenever you type 'rtfm' followed by punctuation such as a space or comma, the 'rtfm' will be expanded to 'read the fine manual'. This also happens if you type 'rtfm' then press Esc or Enter. To remove one abbreviation:
To clear all abbreviations:
You can use Ctrl+k after typing a few characters to complete a word. First of all you will need to add a directory. On Debian machines you can find a dictionary here:
To add the american-english dictionary to vim:
in your homefolder. All of the commands like:
set background=dark syntax on
can be defined in here (every one on a new line). They will automatically be enabled when you start vim.
filetype plugin on set ofu=syntaxcomplete#Complete ab rtfm read the fine manual
You will also needing special files to load auto completion for your specific language. These can be downloaded from vim.org. You will need to place them in your home folder under:
Or for global enable on Debian:
To enable auto complete for python: