On Monday 12 April 2010 17:23:02 Duane Johnson wrote:
> I'm a total newbie to Vim. I'd like to map a new command-line
> command (":vimrc") to open up my vimrc file (":e ~/.vimrc").
you are correct in thinking you don't really need a plugin for
this, unless of course you are interested in it mainly as a
learning exercise
here's an alternative method for editing your vimrc: put
nnoremap <Leader>e :call EditTry("~/.vimrc")<CR>
function! EditTry(what)
if &modified
execute "split " a:what
else
execute "edit " a:what
endif
endfunction
in your .vimrc -- if you have not otherwise defined <Leader>,
you can subsequently use
\e
in normal mode to edit your vimrc in a split window if you
have modified your current buffer, or in the same window if
your changes are saved
see
:h <Leader>
for more info on how the Leader commands work
one of the fun things about vim is there are usually dozens of
ways of performing the same task -- you get to pick the one
that makes the most sense to you
--
sc
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
To unsubscribe, reply using "remove me" as the subject.