Snippets Linux / Vim Cheat Sheet

Vim Cheat Sheet

By Marcelo Fernandes Oct 1, 2017

Vim CheatSheet

This is a guide through my personal cheat sheet in vim

Basic Commands


# Run any bash command from vim, just apprend '!'
:!python manage.py runserver

# Open file
:e file/path

# Open file in vertical
:vs file/path

# Closing tabs
CTRL + W

# Changing tabs
CTRL h - Left
CTRL j - Down
CTRL k - Up
CTRL l - Right

# Selecting
v

# Selecting a whole line
V

# Copying
y

# Pasting
p

# Searching (Press n to go to the next occurence)
?WORD

# Remove search highlight temporary (is gonna turn-on in the next searc)
:noh

# Searching for a selected word (Cursor over the word)
* or #



# Quiting
:q
CTRL W

# Saving
:w
CTRL S 

# Goto function declaration
F12

# Show syntax errors
F7

# Browsing Files
CTRL P

# Grep words in folder
:Ack WORD

# Jumping lines
:LINE_NUMBER

# Folding Function
SPACE_BAR

# List Buffers
:ls

# Changing buffers
:b BUFFER_NUMBER


NerdTree


# Opening NerdTree
CTRL + T

# Open NerdTree command
m

# Create a new file from NerdTree command
m a

# Open file in vertical
s

# Open file in horizontal
i

Git stuff (gitgutter and vim-fugitive)


# Blaming
:Gblame

# Status
:Gstatus

# Enabling
:GitGutterEnable


Notes


References:


link 1