Skip to content

Instantly share code, notes, and snippets.

@Endika
Last active May 25, 2016 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Endika/24bfd2d13f2efafae14a59207079956b to your computer and use it in GitHub Desktop.
Save Endika/24bfd2d13f2efafae14a59207079956b to your computer and use it in GitHub Desktop.
[DUMMIES] Basic Vi comand and config
.##.....##.####
.##.....##..##.
.##.....##..##.
.##.....##..##.
..##...##...##.
...##.##....##.
....###....####
.########..#######..########.
.##.......##.....##.##.....##
.##.......##.....##.##.....##
.######...##.....##.########.
.##.......##.....##.##...##..
.##.......##.....##.##....##.
.##........#######..##.....##
.########..##.....##.##.....##.##.....##.####.########..######.
.##.....##.##.....##.###...###.###...###..##..##.......##....##
.##.....##.##.....##.####.####.####.####..##..##.......##......
.##.....##.##.....##.##.###.##.##.###.##..##..######....######.
.##.....##.##.....##.##.....##.##.....##..##..##.............##
.##.....##.##.....##.##.....##.##.....##..##..##.......##....##
.########...#######..##.....##.##.....##.####.########..######.
# Text DEMO
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aenean commodo ligula eget dolor. Aenean massa.
Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
Nulla consequat massa quis enim.
Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.
Nullam dictum felis eu pede mollis pretium.
# Search "massa"
/massa
# Search without case sensitive
/\cmassa
/\cin
# Go to next result
n
# Copy line
yy
# Paste line
p
# Cuts line
dd
# Move down
j
# Move up
k
# Go to first line
gg
# Go to last line
G
# Go to 3 line
3G
# Select words
v
# Select lines
V
# Copy selected text
y
# Move the cursor to the last character of the word
e
# Move the cursor to the first character of the word
b
# Move the cursor to the next word
w
# Open new file
:e /home/endika/text.txt
:e /home/endika/text2.txt
# Go to first file
:bf
# Go to last file
:bl
# Go to next file
:bn
# Go to previus file
:bp
# Close file
:bw
# Explore files
:Explore
# Open horizontal window
:split file.txt
# Open vertical window
:vsplit file2.txt
# Navigate for windows
CTRL + W
# Basic Basic Basic Basic Basic Basic
# ===================================
# Insert text
i
# Insert text, the same to "i" because "a" move the cursor to next position
a
# Move the cursor to first position in the line
^
# Move the cursor to last position in the line
$
# Save
:w
# Save with expecific file name
:w /home/endika/text_copy.txt
# Quit
:q
# Force Quit
:q!
# My basic config
# Copy this text in .vimrc file
vim ~/.vimrc
syntax on # Show code syntax
set number # Show line number
highlight LineNr ctermfg=7 ctermbg=8 # Line number color
set hlsearch! # Show search text
autocmd BufWritePre * :%s/\s\+$//e # Trim text without final spaces
set tabstop=4 # Transform TAB to 4 spaces
set shiftwidth=4 # Transform TAB to 4 spaces
set expandtab # Transform TAB to 4 spaces
# INSTALL Vundle, airline and configure
# git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
# git clone https://github.com/vim-airline/vim-airline ~/.vim/bundle/vim-airline
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
call vundle#end()
filetype plugin indent on
Plugin 'VundleVim/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
set laststatus=2
let g:airline_powerline_fonts = 1
let g:airline_section_z = 1
let g:airline_theme='lucius'
let g:solarized_base16 = 1
# Configure vim colors http://vimcolors.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment