• Get the Flash Player to see the slideshow.
  • Categories

  • Authors

  • Great Quotes

    Thirty spokes converge on a hub but it’s the emptiness that makes a wheel work — Lao Tzu - Tao Te Ching

Get in touch...

To have a chat about
your CMS needs...

Call us 0207 193 2014
or
Email us on

VIM Toolkit Functions

July 24th, 2008 by Richard Aldridge

General-purpose functions for building up more useful VIM scripts.

” Move the cursor up a line

func Up()
exe “normal k”
endf

” Move the cursor down a line
func Down()
exe “normal j”
endf

” Cut the selected buffer text to the windows clipboard
func! Cut()
exe “normal \”+x”
endf

” Copy the selected buffer text to the windows clipboard

func! Copy()
exe “normal \”+y”
endf

” Paste windows clipboard data to the current buffer

func! Paste()
exe “normal \”+gP”
endf

” Select all text in the editor’s current buffer
func! SelectAll()
exe “normal ggVG”
endf

” Wrapper function to write a string to the buffer

func! Print(str)
exe “normal o” . a:str . “”
endf

” Wrapper function to write a string to the buffer

func! P(str)
call Print(a:str)
endf

” Write a newline character to the buffer

func! NL()
call P(”")
endf
” Write a newline character to the buffer

func! CR()
call NL()
endf

Leave a Reply

You must be logged in to post a comment.