Skip to main content

Text editor: vim

VIM is really powerful text editor. VIM stands for Vi IMproved. It is originally written by Bram Moolenaar.

Install vim

apt-get install vim
yum install vim
vimtutor

Display line number

Press Esc, then type :set number

:set number

Make it permanent by editting ~/.vimrc file

$ echo "set number" >> ~/.vimrc

Hide line number

Press Esc, then type :set nonumber

:set nonumber

Display new line character

Press Esc, then type :set list

:set list
:set list - Display new line character in vi editor

Set tab stop space

:set tabstop=4

Common settings in ~/.vimrc file

syntax on
set number
set tabstop=4

Open file and go to linne number

Open listfile.c and go to line 19

$ vim +19 listfile.c

Common commands

Command Action
gg Go to the beginning of file
G Go to the last line of file
GA Go to the end of file
:24 Go to the 24th line
x Delete current character
dw Delete current word
d0 Delete from current cursor to the begin of LINE
d$ Delete from current cursor to the end of LINE
dG Delete from current cursor to the end of FILE
r Replace current character
u Undo
ZZ Quit Vim

Free courses to learn VIM

Toolbox: Vim | TryHackMe

Popular posts from this blog

MSSQL: Fix error 'Consistency validation for SQL Server registry keys'

While installing Microsof SQL Server 2012, I ran into the following error. "The SQL Server registry keys from a prior installation cannot be modified. To continue, see SQL Server Setup documentation about how to fix registry keys." How to fix Replace the D:\x64\FixSqlRegistryKey_x86.exe file with the original file from the ENU\SQLFULL_ENU.iso file downloading from Microsoft Download Center. This ISO file is 4.2GB. So you can click FixSqlRegistryKey_x86.exe to download this file only. After replacing that file, press Re-run to check. All rules are passed.

Ansible on Fedora Workstation 30

RedHat acquired Ansible in 2015 .

Install Microsoft .NET Core SDK

.NET Core Software Development Kit (SDK) is a set of libraries and tools that allow developers to create .NET Core applications and libraries.