Skip to content

Instantly share code, notes, and snippets.

@omeroot
Last active December 7, 2016 13:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save omeroot/3cdf535675eda3c3dfd2 to your computer and use it in GitHub Desktop.
Save omeroot/3cdf535675eda3c3dfd2 to your computer and use it in GitHub Desktop.

#VIM

kntrl + o //open command line in vim

:colorschema =>press tab and select something
:syntax enable

:set number => show line number

if you want new schema copy schema to ~/.vim/colors directory

:match press tab select highlight type write pattern
:match Number /^Number/ =>if when type Number (as string) color is changing
:retab 2 => 2 spaces
:set cursorline => show cursor line colored
:set cursorcolumn => show cursor column colored
:set number => show line number

if you want your settings is default => crate ~/.vimrc file

under example vimrc

colorscheme evening
set autoindent
set tabstop=2
syntax enable
set number
set statusline=%F%m%r%h%w\ [TYPE=%Y]\ %l:%v:%L
set laststatus=2

##NAVIGATION

  • press ESC and go to normal mode
  • press { => jump to beginning of paragraph or empty line above it
  • press } => jump to end of paragraph or empty line under it
  • press ( => move to beginning of paragraph
  • press ) => move to end of paragraph
  • press w => move to beginning of next word
  • press b => move to beginning of previous word
  • press e => move to end of word
  • press % when on the bracket => move to where bracket is closed
  • press i and go to insert mode
  • press A => move to end of line
  • press I => move to begin of line

##SEARCH

? => find first
/ => find end

press ESC and n => move all matching words

##SELECT

  • press ESC
  • press V => select full line
  • press v => select step step
  • press d => delete selected
  • press y => copy selected
  • press u => undo
  • press ctrl + r => redo
  • press :%y => copy all
  • press :%d => delete all

##TAB

:vertical new filename // or without new
:split new filename // or without new

######MOVE

:b filename
:b# =>previous file
:b number =>buffer number

######MOVE OTHER SPLIT
ctrl + w

######AUTOCOMPLETE

ctrl + n //show used words

######SET DICTIONARY

set dictionary+=/../path

  • ctrl + x ctrl+k //open dictionary words
  • ctrl + x ctrl+l // open linde sentences

##MACRO RECORDING

  • press ESC
  • press qa //record starting with register a (what you want replace with a)
  • press i //switch insert mode write somethings
  • press ESC
  • press q //en record
  • press @a //execute record
  • press @@ //execute last record

##DIRECTORY

:Sexplore =>open current directory with split

##TERMINAL

:shell =>open terminal on current window
exit =>return to vim editor
:! command enter =>execute command whatever you want

##CLOSE

qa =>close all window
wqa =>write and close all window

##WINDOW SIZE

resize 20 =>set height to 20 lines
res +5 =>increase height 5 lines
res -5 =>decrease height 5 lines
vertical resize 20 =>make width 20 columns
vertical resize 20 =>make width 20 columns
vertical resize +5 =>increase height 5 lines
vertical resize -5 =>decrease height 5 lines
vim -S vim_file =>open vim with your saved session

  • can use res instead of resize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment