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

GNS3: Notes

As usual, notes is for myself and might be useful and also save time for beginners start using GNS3 .

Linux: compound commands

command1 ; command2 ; command3 command1 is executed, then command2, and then command3 command1 && command2 && command3 command2 is executed only if command1 run successfully (exit code is 0), command3 is executed only if command2 run successfully (exit code is 0) command1 || command2 || command3 command2 is executed only if command1 exit code is 0 (failure), command3 is executed only if command2 exit code is 0 (failure)

Commonly used shortcut keys

Learn and use common shortcuts. Shortcuts for all Windows applications Shortcut Action CTRL + C Copy CTRL + X Cut CTRL + V Paste CTRL + Z Undo Shortcuts in Microsoft Outlook Shortcuts in Microsoft Outlook Shortcut Action CTRL + Q Mark as read CTRL + SHIFT + K New task CTRL + SHIFT + J New journal Shortcuts in notepad++ Shortcuts in notepad++ Shortcut Action CTRL + L Delete current line CTRL + Q Comment block Shortcuts in Google Docs, Google Sheets Shortcuts in Google Docs, Google Sheets Shortcut Action CTRL + / Display keyboard shortcuts