vim notes
DESCRIPTION
Getting started with the text editor vim- some notes and ideas about vim agile and what notTRANSCRIPT
Vim NotesJames Cox, smokeclouds
Tuesday, November 23, 2010
Starting with Vim
Get it at http://code.google.com/p/macvim/
Clone someone’s vim dot!les.
Mine: https://github.com/imajes/vim!les
Sam’s: https://github.com/idoru/idoru-vim-con!g
Install Macvim cli helpers.
Tuesday, November 23, 2010
Vim is modal
Insert (for typing)
Normal (editing, moving, changing text/structure)
Visual (selecting text)
Command (running commands. duh.)
Tuesday, November 23, 2010
Key Mode Operators
Bare letters to change mode (e.g. i for insert)
Backslash to execute searches
Forward slash for leader (default, can be remapped)
Colon for commands (e.g. :wq for save, quit)
Tuesday, November 23, 2010
Basic Navigation
h,l,k,j (left, right, up line, down line)
^ - !rst character (or, ctrl-a on OS X)
$ - last character (or, ctrl-e on OS X)
cursor keys. (ignore the purists)
G, <n>G (go to line, go to numbered line)
Tuesday, November 23, 2010
Opening Files
vim <path/to/!le> - open a !le
:tabe <path/to/!le> - to open a !le in a tab
:split <path/to/!le> - open a !le and split with the current
:vsplit <path/to/!le> - open a !le and vertical split with current
Tuesday, November 23, 2010
Writing (Saving) files
:w (existing)
:w <path/to/save> (new)
:w! forces it
Tuesday, November 23, 2010
Quitting The Buffer
:q - quit
:q! - force quit. :)
Usual behavior: :wq
Tuesday, November 23, 2010
Fun Stuff
:ct <char> - Cut to character, also: :yt, :dt
:%s/a/b/ - Buffer search and replace
:noh - remove highlights which are annoying
gt/gT - move between tabs
Tuesday, November 23, 2010
Fun stuff 2: my .vimrc.local
https://github.com/imajes/vim!les/blob/master/.vimrc.local
Tuesday, November 23, 2010
Plugins: Gist
Source - http://www.vim.org/scripts/script.php?script_id=2423 (drop this in your plugins dir)
Be careful of settings:
let g:gist_clip_command = 'pbcopy'
let g:gist_open_browser_after_post = 1
let g:gist_detect_!letype = 1
Tuesday, November 23, 2010
Plugins: Endwise
Tim Pope’s - https://github.com/tpope/vim-endwise
‘Wisely’ adds an ‘end’ where appropriate
Tuesday, November 23, 2010
Plugins: Fugitive
Tim Pope - https://github.com/tpope/vim-fugitive
Git wrapper.
Git activities in hackable buffers = awesome
Fave tool: :Gblame
Tuesday, November 23, 2010
Plugins: Rails
Oh, Tim Pope. https://github.com/tpope/vim-fugitive
Where might one begin?
Tuesday, November 23, 2010
Pairing with vim
Vim is a serious text editor. In the way that Schubert has a serious movember ‘tache.
Pairing is !ne, but I think it makes sense to only have one driver at a time - it’s hard to ‘share’ typing.
A common env is not impossible but it’s de!nitely ‘personal’ - fortunately it’s easy to switch ~/.vim
Tuesday, November 23, 2010
Pontifications
Vim is easy enough to learn if you’re willing to spend two weeks looking at a cheat sheet or bugging someone - or pair with someone.
Textmate hasn’t changed signi!cantly in forever, we all know it’s failings. Old and creaky.
Rubymine takes 6 weeks to boot.
Emacs. sigh, Godwin’s law, you win.
Tuesday, November 23, 2010
More Resources:
http://vim.runpaint.org/ - looks ok
http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html
http://vim.wikia.com/
http://www.vim.org/scripts/index.php
Tuesday, November 23, 2010