Skip to content

Instantly share code, notes, and snippets.

@roblogic
Last active July 19, 2017 01:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roblogic/e7e6d1bf15176e2714af925166f31885 to your computer and use it in GitHub Desktop.
Save roblogic/e7e6d1bf15176e2714af925166f31885 to your computer and use it in GitHub Desktop.
Notes to self, some common vim use cases

installer

Self installing executable https://ftp.nluug.nl/pub/vim/pc/gvim80-586.exe

Or, use one of the mirrors on the vim.org site. http://www.vim.org/mirrors.php

Avoid the "cream" version on sourceforge as it uses a different installer that doesn't play so well with Windows.

vimrc

Some nice settings for gVim on Windows. Copy to "C:\Program Files\Vim\vimrc"

https://gist.github.com/papesch/283bdb4adb90c9592520ba72615dd000

wombat color scheme

Copy the file wombat.vim to "C:\Program Files\Vim\vim80\colors"

https://github.com/vim-scripts/Wombat/blob/master/colors/wombat.vim

Tidy up excess whitespace and dashes

vimscript -- handy for copying carina screenshots to ET

save to d: drive then run it with command :source d:\exb.vim

exb.vim
%s/----/-/g   'cut down the number of dashes
%s/^\s\+//    'remove leading whitespace
%s/ \s\+/ /g  'replace internal whitespace with 1 space char
%s/\s\+$//    'remove trailing white space

Delete a sequence of N spaces

Example, N=70 (tidies output from sql*plus)

:%s/ \{70}//g

Remove all the namespace guff from XML RQ or RS

:%s/ xmlns:.\{-}>/>/g

Replace annoying hex characters <91> <92> with straight single quote

:%s/[\x91\x92]/'/g

Replace curly double quotes

:%s/[“”]/"/g 

Greedy vs Non Greedy Match

Greedy Match: get everything between <FTI> and </FTI> tags in a CAML Event Message

/<FTI.*\/FTI>

Non Greedy Match: find the first match for <FTI> and </FTI> tags then stop matching & restart the search

/<FTI.\{-}\/FTI>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment