Vim Tutorial
Vim Tutorial
It is command-centric editor, so beginners might find it difficult to work with it. But once
you master it, you can solve many complex text-related tasks with few Vim commands.
After completing this tutorial, readers should be able to use Vim fluently.
Audience
This tutorial is targeted for both beginners and intermediate users. After completing this
tutorial, beginners will be able to use Vim effectively whereas intermediate users will
take their knowledge to the next level.
Prerequisites
This tutorial assumes that reader has basic knowledge of computer system. Additionally,
reader should be able to install, uninstall and configure software packages on given
system.
Conventions
Following conventions are followed in entire tutorial:
All the content and graphics published in this e-book are the property of Tutorials Point
(I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or
republish any contents or a part of contents of this e-book in any manner without written
consent of the publisher.
We strive to update the contents of our website and tutorials as timely and as precisely
as possible, however, the contents may contain inaccuracies or errors. Tutorials Point (I)
Pvt. Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of
our website or its contents including this tutorial. If you discover any errors on our
website or in this tutorial, please notify us at [email protected]
i
Vim
Table of Contents
About the Tutorial ............................................................................................................................................ i
Audience........................................................................................................................................................... i
Prerequisites..................................................................................................................................................... i
Conventions...................................................................................................................................................... i
Table of Contents............................................................................................................................................. ii
Introduction..................................................................................................................................................... 1
Vi ..................................................................................................................................................................... 5
Stevie ............................................................................................................................................................... 5
Elvis ................................................................................................................................................................. 5
nvi ................................................................................................................................................................... 5
Vim .................................................................................................................................................................. 6
Vile .................................................................................................................................................................. 6
Start Vim.......................................................................................................................................................... 7
Vim modes....................................................................................................................................................... 8
ii
Vim
Buffer ............................................................................................................................................................ 22
iii
Vim
Swap .............................................................................................................................................................. 22
Undo .............................................................................................................................................................. 23
Redo .............................................................................................................................................................. 23
Multiple files.................................................................................................................................................. 26
Play ................................................................................................................................................................ 33
iv
Vim
Smart indentation.......................................................................................................................................... 46
Bounce........................................................................................................................................................... 46
v
Vim
Indent code.................................................................................................................................................... 52
vi
1. Vim – Introduction Vim
Vim editor is one of the more popular text editors we use today. It is a clone of the Vi
editor and is written by Bram Moolenaar. It is cross platform editor and available on
most popular platforms like Windows, Linux, Mac and other UNIX variants. In this
chapter, we will discuss following items:
Introduction
Features of Vim
Why Vim was created?
Introduction
Vim is acronym for Vi IMproved. It is free and open source text editor written by Bram
Moolenaar. It was first released in 1991 for UNIX variants and its main goal was to
provide enhancement to the Vi editor, which was released way back in 1976.
Vim is considered as clone Vi editor. Like Vi, it is also command centric editor. One of the
advantage of learning Vim is – it is available everywhere. Take any UNIX variant like
Linux, Mac, HP-UX, AIX and many more, Vim is there by default. Vim traditionally does
not have GUI but now there is separate installer called gVim which provides GUI.
Features of Vim
This section discusses some of the important features of Vim:
1
2. Vim – Installation and configuration Vim
Vim is lightweight package and its installation is really simple. In this chapter, we will
discuss following items:
Installation on Windows platform
Installation on Debian based Linux
Installation on RPM based Linux
Installation
1. To download Vim visit vim.org
2. Click on Download option from left pane
3. Click on PC: MS-DOS and MS-Windows option
4. Download .exe installer from this page. At the time of writing this tutorial installer name
was gvim80.exe
5. Double click on installer and follow on screen instructions to complete installation
Configuration
Vim stores its configuration in simple text file namely _vimrc and it is located
under home directory of user.
$ echo %userprofile%
2. Navigate to home directory and create a new file namely _vimrc. Ensure that this file
doesn’t have any extension.
3. Open this file in text editor, enter following text and save it:
set nu
4. Now Vim will show line numbers when file is opened. We’ll add more options to this file
latter on.
2
Vim
Installation
1. Execute below command in terminal:
/usr/bin/vim
Configuration
Vim stores its configuration in simple text file namely .vimrc and it is located
under home directory of user.
$ echo $HOME
2. Navigate to home directory and create a new file namely .vimrc. Ensure that this file
doesn’t have any extension.
3. Open this file in text editor, enter following text and save it:
set nu
4. Now Vim will show line numbers when file is opened. We’ll add more options to this file
latter on.
Installation
1. Execute below command in terminal:
$ su -
$ yum install vim
/usr/bin/vim
3
Vim
Configuration
Vim stores its configuration in simple text file namely .vimrc and it is located
under home directory of user.
$ echo $HOME
2. Navigate to home directory and create a new file namely .vimrc. Ensure that this file
doesn’t have any extension.
3. Open this file in text editor, enter following text and save it:
set nu
4. Now Vim will show line numbers when file is opened. We’ll add more options to this file
latter on.
4
3. Vim – It’s friends Vim
Vim is clone of original Vi editor. In this chapter, we will discuss about other Vi clones.
Main purpose of this chapter to know other clones and its compatibility with original Vi
editor.
Vi
Stevie
Elvis
nvi
vile
Compatibility with original Vi
Vi
Vi is acronym for Visual. It is screen-oriented text editor originally created for UNIX. The
original code for Vi was written by Bill Joy in 1976 and first released on BSD platform. Vi
was extension of ed editor which was most common at that time.
Vim was the first editor to introduce multiple modes. There is a separate mode for
editing text, selecting text and executing command. Vim editor supports all these
modes. Later sections of this tutorial describe these modes.
Stevie
Stevie editor was developed for Atari ST platform. It was released in 1987 it is an
abbreviation for ST Editor for VI enthusiastic.
It was very simple and provided only very small subset of the original Vi editor.
However, it provided familiar environment to user moving on Atari ST platform.
Elvis
Elvis’s main intention was to remove Stevie editor limitation. Stevie used to load entire
file in RAM, Elvis removed this limitation by introducing buffers. Also it added some
functionality into it like syntax highlighting, multiple window support, networking support
and simple GUI.
nvi
nvi stands for new Vi. It was a result of license dispute between AT & T lab and
Computer Science Research Group(CSRC) at university of California, Berkeley. Vi was
based on ed editor and was under license of AT & T which restricted them to distribute Vi
with BDS. Hence they rewrote Vi and released it under BSD license.
5
Vim
Vim
Vim is improved version of Vi and it added many features where Vi was lagging. It added
many useful features like:
Multiple windows/tabs/buffers
Introduction of Vim scripting language
Syntax highlighting for more than 200 languages
Integration with compilers, interpreters and debuggers
Vile
Vile is an abbreviation which stands for Vi like Emacs and it was an attempt to bring
popular features from both editor and combine it into one. Few popular features of Vile
are:
6
4. Vim – Getting Familiar Vim
Beginning with this section we will get our hands dirty with Vim. In this chapter, we will
discuss following items:
Start Vim
Vim modes
Create new file
View file in read-only mode
Edit existing file
Start Vim
Vim is little bit different than today’s GUI based editor. It can be started and used from
GUI as well as terminal.
Use terminal
Using Vim from terminal will be identical on Windows as well as Linux platform.
Perform following steps to start and quit Vim from terminal:
$ vim
2. It will open Vim in terminal as follows:
7
Vim
3. To close this, press Esc key followed by colon(:) and q. In Vim q command stands for
quit. This command will be shown in bottom left corner of editor itself:
Vim modes
Vim supports multiple modes. This section discusses some of the important modes which
will be used on day-to-day basis.
1. Command mode
This is the default mode in which Vim starts. We can enter editor commands
in this mode. We can use variety of commands in this mode like copy, paste,
delete, replace and many more. We’ll discuss these commands in later
sections.
8
Vim
NOTE: Here onwards, any Vim command without colon indicates that
we are executing that command in command mode.
2. Insert mode
You can use this mode to enter/edit text. To switch from default command to
insert mode press i key. It will show current mode in bottom left corner of
editor.
We can enter any text once we are in insert mode. Below image shows this:
Use Escape key to switch back to command mode from this mode.
This mode is also used to enter commands. Commands in this mode starts
with colon(:). For instance, in previous section quit command was entered in
this mode. We can go to this mode either from command or insert mode.
9
Vim
NOTE: Here onwards, any Vim command starting with colon indicates
that we are executing that command in command line mode.
4. Visual mode
In this mode we can visually select text and run commands on selected
sections.
$ vim
:edit message.txt
10
Vim
Esc
:w
7. Quit Vim
:q
$ vim -R message.txt
$ view message.txt
$ vim message.txt
11
Vim
:q!
OR
:wq
12
5. Vim – Getting Help Vim
Vim is feature rich editor hence remembering everything about it will be difficult. But
there is no need to worry, we can always ask for help. Fortunately this help is provided
by Vim itself.
:help
:help <topic-name>
In above command replace <topic-name> with topic in which you are interested. For
13
Vim
:help modes
:helpgrep <phrase>
For instance, to access help about navigation in Vim execute below command:
:helpgrep navigation
14
Vim
15
6. Vim - Editing Vim
Vim provides many commands which make editing functionality really powerful. In this
chapter, we will discuss following items:
Insert
Append
Open new line
Substitute
Change
Replace
Join
Esc
This action will move cursor to the beginning of current line and switch Vim in insert
mode
Esc
This action will move cursor next by one position and switch Vim in insert mode.
16
Vim
Esc
This action will move cursor to the end of line and switch Vim in insert mode
Esc
This action will insert blank line below current line and switch Vim in insert mode
Esc
This action will insert blank line above current line and switch Vim in insert mode
Substitute text
Let us suppose you want to substitute single character then perform following steps:
Esc
17
Vim
This action will delete character under cursor and switch Vim in insert mode
This action will delete entire line and switch Vim in insert mode.
Change text
Let us suppose you want to change text in current line then perform following steps:
Esc
cc
This action will delete text after current cursor position and switch Vim in insert mode.
Replace text
To replace single character perform following steps:
Note that this command will not switch Vim in insert mode
18
Vim
Join text
To join two lines perform following steps:
Esc
19
7. Vim - Navigating Vim
Vim has great support for advanced navigation. In this chapter, we’ll discuss some of the
popular navigation techniques which help to improve productivity.
Basic navigation
In basic navigation we can navigate to left, right, up and down by position. Below
commands can be used for this:
Command Description
h Move cursor to left by one position
l Move cursor to right by one position
k Move cursor to upward direction by one line
j Move cursor to downward direction by one line
To perform multi-position navigation use number with these commands. For instance to
navigate cursor 10 line below from current line, execute following command:
10j
Command Description
0 Move cursor to the beginning of current line
$ Move cursor to the end of current line
Ctrl + f Scroll down entire page
Ctrl + b Scroll up entire page
Navigate to lines
Below command can be used to navigate to specific line:
Command Description
:n Jump to the nth line
:0 Jump to the start of file
:$ Jump to the end of file
20
Vim
Word navigation
We can use following commands for word navigation:
Command Description
w Move cursor to the beginning of the next word
e Move cursor to the end of the current word
b Move cursor to the beginning of the previous word
Using jumps
Vim keeps track of your navigation using a jump list. You can go backward and forward
through that list.
The jump list keeps tracks of all the places you’ve been to by tracking file name, line
number and column number.
:jumps
Command Description
Ctrl + o Jump back to the previous position
Ctrl + i Jump to the next position
21
8. Vim – Revisiting Editing Vim
We have seen basic editing earlier. Let us understand some other editing features of
Vim. In this section, we will discuss following items:
Buffer
Swap files
Cut, copy, delete, paste actions
Undo and redo actions
Buffer
Buffer is temporary memory used by Vim. When we open a file in editor, Vim loads its
contents from disk drive. These contents are stored in memory (RAM) whenever we edit
a file we are actually editing file from buffer. Once we finish editing and save file that
time only buffer contents are transferred to appropriate file.
Swap
Swap area is a file created by Vim to store buffer contents periodically. While editing file
our changes may be lost because of any reasons and Vim provides swap files to provide
data recovery.
:swapname
22
Vim
Command Description
x Delete character from cursor position
X Delete previous character from cursor position
y Copy single character from cursor position
p Paste character after cursor position
P Paste character before cursor position
Multi-position command
We can use cut, copy and paste commands with words and sentences as well. Below
table shows this:
Command Description
dw Delete word from cursor position
D Delete entire line from cursor position
dd Delete entire line
Y Copies entire line
yy Copies entire line
To perform multi-line/multi-word actions just use numbers with command. You can use
this syntax with other commands as well. For instance, to delete 3 words use :
3dw
Undo
We can undo single or multiple actions. To perform one time undo action execute:
To perform multiple undo action, use number with same command. For instance, below
command will undo last 3 actions:
3u
Redo
Redo is apposite action of undo. Execute any of the command to perform redo action.
Ctrl + r
OR
: red
23
9. Vim - Searching Vim
Search is very common action and it is one of the actions we use most of the time. In
this chapter we will see some command which will allow performing these actions
effectively.
Search settings
Search in current file
Search in multiple files
Search in help files
:set incsearch
:set hlsearch
This command will automatically highlight current matches. For instance in below image
fox word is highlighted:
:set noincsearch
:set nohlsearch
24
Vim
Command Description
/<expression> Search expression in forward direction
n Find next occurrence. This is same and find next
N Find previous occurrence. This is same as find previous
// Repeat previous forward search
Command Description
?<expression> Search expression in backward direction
n Find previous occurrence. This is same and find previous
N Find next occurrence. This is same as find next
?? Repeat previous backward search
Command Description
* Search next occurrence of current word
# Search previous occurrence of current word
Note that to go to next and previous occurrence we have to use following commands:
Command Description
:cn Go to next occurrence of expression
:cN Go to previous occurrence of expression
25
10. Vim – Working with multiple things Vim
Vim is very powerful editor. It supports many advanced features to work with multiple
files, buffer and windows. In this section, we will discuss following items:
Multiple files
Multiple buffers
Multiple tabs
Multiple windows
Multiple files
Let us suppose you are editing a file and you want to open another file in same Vim
session. In that case, you can use Vim’s edit command. Below table shows these
commands
Command Description
:e Load new file in buffer for editing
:edit Same as :e
:e <tab> List the files for editing from current directory
:edit <tab> Same as :e <tab>
Multiple buffers
We have already seen what Vim buffers are. Vim supports multiple buffers. Below
commands will be useful will working with buffers:
Command Description
:badd <file> Add file into new buffer
:bN Switch to Nth buffer. For instance to switch to 3rd buffer use :b3
:bnext Move to the next buffer in buffer list
:bprevious Move to the previous buffer in buffer list
:buffers List all buffers
:bfirst Move to the first buffer
:blast Move to the last buffer
:ball Load all buffers
26
Vim
Now, there are two files in buffer. Execute below command to show this:
:buffers
Multiple tabs
Like other editors we can also open multiple tabs in Vim. Below table describes tab
related commands:
Command Description
:tabnew Open new tab
27
Vim
Multiple windows
In Vim we can create new window using following commands:
Command Description
:new Open new window
:new <file> Open file in new window
In below image, we can see that current Vim window is split into 2 parts after executing
following commands:
$vim message.txt
:new
28
Vim
29
11. Vim - Markers Vim
Vim supports bookmark feature. Using this feature we can make navigation within file
really faster. In this chapter, we will discuss following items:
Create bookmark
Jump to bookmark
List all bookmarks
Delete bookmarks
Local bookmarks
Global bookmarks
Create bookmark
To create bookmark execute following command:
m{bookmark-name}
ma
Jump to bookmark
Once bookmark is created we can jump there. Following command can be use to jump to
bookmark:
Command Description
`{bookmark-name} Move to the exact location of bookmark. Please note that this
character is back quote
‘{bookmark-name} Jump to the beginning of bookmark line. Please note that this
character is single quote
:marks
30
Vim
Delete bookmark
To delete bookmarks execute following command:
:delmarks {bookmark-name}
:delmarks a
If the bookmark name is an upper case letter, then that is a global Bookmark. Above
discussed commands are applicable for both local and global bookmarks.
31
12. Vim - Macros Vim
Macro is record and play feature. When this is combined with Vim commands it becomes
really powerful combination. In this section, we will discuss following items:
Start recording
Perform Vim actions
Stop recording
Play recording
Start recording
To start recording press q followed by any lower case letter as a macro name. For
instance in below example I have used “a” as a macro name
:registers
For instance, below command shows that yank and delete actions were performed:
32
Vim
Stop recording
Once you are done with actions, press q again to stop recording. Now recording mode
will disappear as shown below:
Play
To play execute below command:
@{macro-name}
33
Vim
@a
To play same macro multiple times use numbers with it. For instance, to execute same
macro 10 times execute following command:
10@a
34
13. Vim - Registers Vim
Vim provides many registers. We can use these registers as multiple clipboards. This
feature is really useful while working with multiple files. In this chapter, we will discuss
following items:
“<register-name><command>
“ayy
“<register-name>p
“ap
:registers
Register types
Vim supports following types of registers:
Unnamed registers
Unnamed register is denoted by “”. Vim stores deleted or copied text in this
register
Named registers
We can use 26 named registers; we can use a-z or A-Z. By default vim doesn’t
uses these registers.
35
Vim
If we use lower case register name then contents will be overwritten and if we
use uppercase name then contents will be appended in that register.
Numbered registers
We can use 0 to 9 named registers. Vim fills these registers with text from yank
and delete command.
o Numbered register 0 contains the text from the most recent yank command.
o Numbered register 1 contains the text deleted by the most recent delete or change
command
Default registers
Register Description
% Name of the current file
# Name of the alternate file for the current window.
: Most recently executed command
. Contains the last inserted text
“ Last used register
36
14. Vim - Folding Vim
Fold functionality will be useful when file contents large text. Using this feature we can
only show selected potion of file. This feature is particularly useful while working with
programming languages. In this chapter, we will discuss following items:
:set foldenable
:set foldmethod=indent
:set nofoldenable
Fold actions
Close fold
To fold code, go to any method and execute following command:
zc
Open fold
37
Vim
zo
zM
38
Vim
Unfold all
To unfold all execute following command:
zR
39
15. Vim - Diff Vim
Similar to UNIX diff command we can use Vim to show diff in much better manner. It will
show diff in colorful manner. In this chapter, we will discuss following items:
Show difference
To show differences between files execute below command:
OR
40
Vim
diffsplit
Use below command to perform horizontal split:
:diffsplit filename
Above images shows that we are comparing two files namely message-1.txt and
message-2.txt.
Vertical diffsplit
To perform vertical split use following command:
Above images shows that we are comparing two files namely message-1.txt and
message-2.txt.
41
Vim
:set scrollbind
:set noscrollbind
If you edit file in this mode then use following command to update diff:
:diffupdate
Ctrl + w Ctrl + w
[c
]c
:diffget
For instance, if you are in left window and you want to take change from right
window to current window then you will execute above command.
:diffput
For instance, if you are in left window and you want apply change from current
window to right window then you will execute above command.
42
16. Vim – Plug-ins Vim
Using plug-ins, we can extends the functionality of Vim. Vim supports many plug-ins and
most of them are available freely. This chapter is about Vim plug-ins and we will discuss
following items:
Plug-in management
Some useful plug-ins
Plug-in management
This section discusses plug-in management. Vim provides various plug-ins managers but
we won’t be using any plug-in manager, instead we’ll be doing all these steps manually
for better understanding. Once you understand these steps, you can go with plug-in
manager.
Install plug-in
To install any plug-in perform following steps:
$ mkdir -p ~/.vim/bundle
$ cd ~/.vim/bundle/
:colorscheme badwolf
Update plug-in
If we observe carefully, plug-in is a just collection of files and if we want to
update that plug-in then just update appropriate plug-in directory from
~/.vim/bundle.
Remove plug-in
Removing plug-in in Vim is really simple. To remove plug-in perform following
steps:
43
Vim
Name Description
DumpX Disassemble C/C++ code
awk.vim Indenting for AWK script
Pathogen Vim package manager
git-switcher.vim Automatically save and load vim session based on switching of git
branch
Pyflakes Provide liniting for python files
44
17. Vim – Using Vim as IDE Vim
We can configure Vim to use it as an IDE. In this section, we will discuss following items:
Syntax highlighting
Smart indentation
Bounce
Execute shell commands
Configuring ctags and csope
Auto-completion and auto-suggestion
Syntax highlighting
Syntax highlighting is one of the important features of IDE. To enable syntax highlighting
use:
:syntax on
:syntax off
45
Vim
Smart indentation
To perform auto and smart indentation use following commands:
: set autoindent
: set smartindent
: set cindent
Bounce
If you are using programming language which uses curly braces to combine multiple
statements then % key will be your friend. This key will jump between start and end of
curly braces quickly.
For instance, you are at line 11 and execute % command then it will move cursor the
line 4. Below image shows this:
46
Vim
:!<command>
:!pwd
However, if you want to multiple shell commands then execute following command:
:shell
Above command will give you terminal access, where you can execute multiple
commands. Once you are done with it, just type exit command which will return back to
Vim session.
$ ctags <file>
3. Now move your cursor under function name and press Ctrl + ] to go to function definition.
4. Use Ctrl + t to come back to previous position
47
Vim
1. Install cscope
$ sudo apt-get install cscope
Command Description
Ctrl + x Ctrl + N Word completion
Ctrl + x Ctrl + L Line completion
Ctrl + x Ctrl + F File name completion
48
18. Vim – Remote File Editing Vim
Many times we need to work with remote servers. And often we edit files from those
remote servers. One of the obvious solution to edit those files is to log in to the remote
sever and edit files. But sometimes it is convenient to edit those files from local machine
because we might have installed and configured various plug-in on our local system. In
this chapter, we will discuss following items:
$vim scp://[email protected]/filepath
In above example vim will recognize that it has to use scp protocol and it will access file
using that protocol. For instance:
$ vim scp://[email protected]//tmp/message.txt
Above command will open /tmp/message.txt file from remote-server. It will use SCP
protocol and jarvis user’s credentials for authentication.
:Nread scp://jarvis@localhost//tmp/message.txt
In addition to reading we can also modify file on remote server directly. In that case use
Nwrite command as follows:
:Nwrite scp://jarvis@localhost//tmp/message.txt
1. FTP
2. SFTP
3. HTTP (read-only)
4. rsync
49
19. Vim – Tips and Tricks Vim
Now we got fair idea about Vim. Let us discuss few tips and tricks of Vim to improve
productivity. In this section, we will discuss following items:
:set expandtab
Note that, this command will not change existing tabs to spaces. To achieve this
execute following command:
:retab
:set noexpandtab
:retab!
:set spell
50
Vim
Word completion
Vim also provides word completion. For this execute following command in insert mode:
Ctrl + p
Command Description
Ctrl + y Copy and paste text located above the cursor
51
Vim
Indent code
If you have un-indented code to indent it execute following command:
=%
Then go to line 4 and execute =% command. It will indent code like this:
52
Vim
:set ff=unix
:set ff=dos
53
20. Vim - Personalization Vim
We can personalize Vim according to our requirement. In this section, we will discuss
following items:
Configuration files
Changing fonts
Changing color scheme
Personal highlighting
Status line
Configuration files
For Vim configuration files can be at user level or global level. User specific settings will
be stored in user level files while global settings will be stored in global level files.
Vimrc file
o Global vimrc
:echo $VIM
OR
:echo \%VIM\%
o Local vimrc
Local vimrc will be located under user’s home directory. For instance, on
Linux it will be under /home/<USER> directory while on Windows it will be
under C:\Documents and Setting\<USER>/ folder
Note that, on Windows file name will be _vimrc whereas on Linux it will be .vimrc.
Gvimrc
o Global gvimrc
o Local gvimrc
Local gvimrc will be located under user’s home directory. For instance, on
Linux it will be under /home/<USER> directory while on Windows it will be
under C:\Documents and Setting\<USER>/ folder
Note that, on Windows file name will be _gvimrc whereas on Linux it will be
54
Vim
.gvimrc.
exrc
exrc files are used for backward compatibility. These files are ignored if either
vimrc or gvimrc file is present.
o Global exrc
o Local exrc
Local exrc will be located under user’s home directory. For instance, on
Linux it will be under /home/<USER> directory while on Windows it will be
under C:\Documents and Setting\<USER>/_exrc folder
Changing fonts
To change font execute following command in gVim:
:set guifont=courier
Change colorscheme
To change color scheme execute following command:
:colorscheme <tab>
When you press tab character, it will show available color schemes for Vim.
Personal highlighting
55
Vim
Command Description
\%> Match after column
73 This is column number
V It should work for virtual columns only
.\+ Match one or more characters
:set number
:set nonumber
:set numberwidth=<num>
Spell check
To enable spell check execute following command:
:set spell
:set spelllang=<language>
56
Vim
:set spelllang=de
Abbreviation
Using abbreviation we can create shortcuts for long string. For instance below
command creates abbreviation namely “quick”.
If you type “quick” and press tab then it will be replaced by “the quick brown fox”
string
We can use this to correct some typos. For instance below command does this:
Status line
Status line is shown at the bottom of editor. To enable status line execute
following command:
:set laststatus=2
:set laststatus=0
57
21. Vim - Conclusion Vim
Vim is really powerful editor and now you can get your hands dirty with it. Mastering Vim
will really improve your productively. Using Vim you can solve many complex tasks with
few commands. You can refer following documentation to know more about Vim.
http://www.vim.org/
https://vim.sourceforge.io/scripts/index.php
Vim plug-ins
Vim plug-ins further extend its functionality and makes you more productive. You can
install, configure and even write plug-ins for Vim. You can refer documentation regarding
this from their official website.
58