Vim Tips
revised 16 Feb 2010
Copyright © 2003–2008 by Stan Brown, Oak Road Systems
Contents:
:h zonk<Ctrl-D>
finds all help topics whose names contain “zonk”.
There’s also :helpg[rep] searches all
files for a given text, and :cn visits each one in
turn.
(August 2009)
:s/\(.\{68}\)foo/\1bar/
reference: :help \{
(August 2009)
You can’t use a variable on the right-hand side of a
set command. Instead, use either
let &path=g:desktop_path
or
execute "set path=".g:desktop_path
Either way, if the variable contains spaces, you’ll have to escape them, for example by
execute "set path=".escape(g:desktop_path, ' ')
source: Usenet article “How do you parameterize your vimrc for different machines?” by Gary Johnson (g0sikh0lj5@enews5.newsguy.com, 2008-05-19)
(February 2010)
if has("...")
set ...
endif
:h feature-list lists features that can be tested
by has( ), including operating systems.
In Windows XP, at least, the environment variable
$COMPUTERNAME can be tested to identify a particular
computer. It might be
$HOSTNAME in UNIX.
(February 2010)
Question:
“ On Windows XP Pro SP2, ... whenever I launch Gvim I get a message box with title bar ‘Initialisation error’ and with text ‘annotregisterapplicationobject’. If I click OK then GVim seems to run normally, but it's a nuisance. (There's no apparent problem in command-prompt Vim.)”
“I experimented with restarting the DCOM service, and when I did that GVim opened without trouble. But DCOM is widely deprecated as being a security problem, so I am not happy about running with it enabled.”
Response:
“Answer is to disable DCOM and set the DCOM process to automatic.
regtool -s set '/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Ole/ EnableDCOM' "N"
net 'start' 'DCOM Server Process Launcher'
sc 'config' 'DcomLaunch' 'start=' 'auto'
“I know what you mean about DCOM but what you can try is to set it to automatic but disable it by setting the registry key to N. This is what I do with my Cygwin regtool command above. You can just use regedit to do it, if you're not using Cygwin.”
source: Usenet article “GVIM 6.3: Cannot register application object” by Malcolm Boekhoff, 21 Feb 2009
(Februyary 2010)