Search

vim

Copy, Cut, Paste

yy - Yank (copy) the current line, including the newline character. 3yy - Yank (copy) three lines, starting from the line where the cursor is positioned.

dd - Delete (cut) the current line, including the newline character. 3dd - Delete (cut) three lines, starting from the line where the cursor is positioned.

p - Paste

How to map save to Ctrl+s

Why? To avoid freezing the terminal by mistake.

in .vimrc

noremap <silent> <C-S>          :update<CR>
vnoremap <silent> <C-S>         <C-C>:update<CR>
inoremap <silent> <C-S>         <C-O>:update<CR>

in .bashrc or .zshrc

stty -ixon

When VIM is frozen, don’t accept input, and you can’t close it?

Probably you did Ctrl+S by mistake - it freezes your terminal, type Ctrl+Q to get it going again.

vim