Skip to content

Instantly share code, notes, and snippets.

@oxyc
Created March 5, 2012 18:17
Show Gist options
  • Select an option

  • Save oxyc/1980107 to your computer and use it in GitHub Desktop.

Select an option

Save oxyc/1980107 to your computer and use it in GitHub Desktop.

Get off your ass and learn VIM

blabla

Getting started

  • Don't go in to deep
  • Start with an empty vimrc
  • Research!
  • Cheatsheet, write it!
  • Study!
  • Choose a colorscheme
  • Have fun!

The bare minimum

The .vimrc

set nocompatible
syntax on
filetype plugin indent on

set autoindent
set smartindent

Navigating

  • h, j, k, l
  • $, ^, 0, g, G
  • w, b

Survival

  • v, V
  • y, yy, p
  • i, A, O, o
  • dd, dt
  • u,
  • :vsp, :sp
  • :b,

Files

  • :e file
  • :e .
  • :w
  • :q, :qall, q!

Get comfortable

Searching

  • /, f, F

The .vimrc

set shiftwidth=2
set softtabstop=2
set tabstop=2
set expandtab

set autochdir

set backspace=indent,eol,start

set hidden

set number

Push through

The .vimrc

set mouse=a

Get organized

Mapping

The .vimrc

runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()

set backupdir=~/.vim/backup                       " backup directory
set directory=~/.vim/swap                         " swap directory
set dictionary+=~/.vim/dictionaries/dictionary    " custom auto-complete dictionary
set undodir=~/.vim/undo                           " undo directory

set backup                                        " make backup files
set autochdir                                     " switch to current file directory automatically
set undofile                                      " store all undos

Learn to love VIM

  • Folding
  • Persistent undo
  • Configurations, PHP
  • Map your leader
  • Filetype specific code conventions
  • Project specific code conventions!
  • Strip Whitespace
  • Tab or Complete
  • Writing your own conveniceny functions
  • Ctags

More to come

  • Directory structure
  • Basic Vimscript
  • Embrace the shell
  • Styling
  • Vimrc walkthrough
  • Object navigation

References

  • ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment