Vim
Vim is a powerful text editor, you can install it with some plugins
Installation
sh
sudo apt install -y vim
Configuration
Edit system configuration
sh
sudo vim /etc/vim/vimrc
sh
sudo tee -a /etc/vim/vimrc > /dev/null <<EOT
set nocompatible
set number
set background=dark
set tabstop=4
set smartindent
set autoindent
set backspace=indent,eol,start
set ignorecase
set ruler
set showcmd
set mouse=a
EOT
nocompatible
to use Vim instead of Vinumber
to display line numbersbackground=dark
to use dark themetabstop=4
to use 4 spaces for tabsmartindent
to use smart indentationautoindent
to use auto indentationbackspace=indent,eol,start
to use backspaceignorecase
to ignore caseruler
to display cursor positionshowcmd
to display command in bottommouse=a
to enable mouse
sh
set nocompatible
set number
set background=dark
set tabstop=4
set smartindent
set autoindent
set backspace=indent,eol,start
set ignorecase
set ruler
set showcmd
set mouse=a
/etc/vim/vimrc
Commands
Vim has two modes.
You can find a cheatsheet on https://vim.rtorr.com
- Insert mode (Where you can just type like normal text editor. Press
i
for insert mode) - Command mode (Where you give commands to the editor to get things done . Press
ESC
for command mode)
Insert mode
You can write text in this mode.
Command mode
x
: to delete the unwanted characteru
: to undo the last the command and U to undo the whole line CTRL-R to redoA
: to append text at the end:x
: to save and exit:q!
: to trash all changesdw
: move the cursor to the beginning of the word to delete that word2w
: to move the cursor two words forward.3e
: to move the cursor to the end of the third word forward.0
(zero): to move to the start of the line.d2w
: which deletes 2 words .. number can be changed for deleting the number of consecutive words liked3w
dd
: to delete the line and2dd
to delete to line .number can be changed for deleting the number of consecutive words:1,$d
: to delete all lines from the current line to the end
INFO
If copy/paste don't work in vim, check this link: https://coderwall.com/p/if9mda/automatically-set-paste-mode-in-vim-when-pasting-in-insert-mode