My personal Vim setup and useful commands.
" Show line numbers and relative numbers set number set relativenumber
" Enable mouse support in all modes set mouse=a
" Enable syntax highlighting and filetype detection syntax on filetype plugin indent on
" Other preferences set tabstop=4 set shiftwidth=4 set expandtab set ignorecase set smartcase
" Leader key let mapleader = " " " Use Space as leader
" Save file
nnoremap
" Quit window/buffer
nnoremap
" Easy escape in insert mode
inoremap jk
" Navigate splits
nnoremap
<span class="code-line">call plug#begin('~/.vim/plugged')</span>
<span class="code-line"> </span>
<span class="code-line">" Appearance</span>
<span class="code-line">Plug 'morhetz/gruvbox' " Theme</span>
<span class="code-line">Plug 'vim-airline/vim-airline' " Status line</span>
<span class="code-line"> </span>
<span class="code-line">" Functionality</span>
<span class="code-line">Plug 'tpope/vim-fugitive' " Git wrapper</span>
<span class="code-line">Plug 'tpope/vim-surround' " Surroundings</span>
<span class="code-line">Plug 'junegunn/fzf.vim' " Fuzzy finder</span>
<span class="code-line">Plug 'preservim/nerdtree' " File explorer</span>
<span class="code-line"> </span>
<span class="code-line">call plug#end()</span>
<span class="code-line"> </span>
<span class="code-line">" Theme setup</span>
<span class="code-line">if exists("+termguicolors")</span>
<span class="code-line"> set termguicolors</span>
<span class="code-line">endif</span>
<span class="code-line">colorscheme gruvbox</span>
Command | Mode(s) | Description |
---|---|---|
:w |
Normal | Write (save) the file |
:q |
Normal | Quit the current window |
:wq / :x |
Normal | Write and quit |
:q! |
Normal | Quit without saving |
dd |
Normal | Delete current line |
yy |
Normal | Yank (copy) current line |
p / P |
Normal | Paste after/before cursor |
u |
Normal | Undo |
<C-r> |
Normal | Redo |
/pattern |
Normal | Search forward for pattern |
?pattern |
Normal | Search backward for pattern |
n / N |
Normal | Next/Previous search match |
:NERDTree |
Normal | Open file explorer (plugin) |
:FZF |
Normal | Open fuzzy finder (plugin) |
Use
:help <command>
or:help <topic>
to get help on anything in Vim. Example::help motion
Visual mode (
v
,V
,<C-v>
) is powerful for selecting text to operate on.
" Last saved: {{formatDate}} {{formatTime}}
This document was styled using the vim
theme with stylemd
. Get the tool here: https://github.com/ddukbg/stylemd