---
title: Vim
date: 2021-01-13
categories: [cheatsheets]
---

# Vim Cheatsheet

## paste from clipboard
insert> Ctr+R+

## indent
visual> v=


## undo and redo
normal> u           // u for undo
normal> Ctr+r       // redo previously undone change
normal> Ctr+R       // undo the undos


## Buffers
vim> ls             // list buffers
vim> bdelete <bn>   // delete buffer bn=buffer name oder buffer number
vim> badd fl.txt    // add a new buffer for fl.txt
vim> b4             // set hlsearchchoose buffer 4


## Splitting
vim> :spl            // split
vim> :vsplit         // vertical split
normal> Ctr-<HJKL>   // change selected split
normal> Ctr-W=       // layout all panes to equal size


## TPope Surround
normal> ysiw" ysiw( ysiw) ysiw'     // surround word by ")
normal> ds"                         // delete surrounding

visual>S <div>                      // replaces the selected with correct html tags