Hello,

Jared <[EMAIL PROTECTED]> wrote:

> I'd like to map a hotkey to re-source my vimrc files (system + user).  I
> originally tried this simple approach:
>
> nmap <buffer> <S-F9> :source $VIM\vimrc<CR>
>       \ :source $VIM\_vimrc<CR>
>       \ :source $HOME\_vimrc<CR>

Your .vimrc knows its own filename. Here is an exerpt from my .vimrc
(vimrc_core.vim actually).

" ----------------------- >% ------------------
" VIM - Editing and updating the vimrc: {{{
" As I often make changes to this file I use these commands
" to start editing it and also update it:
  let vimrc=expand('<sfile>:p')
:VimrcHelp '     ,vu = "update" by reading this file                          
[N]
  nnoremap ,vu :source <C-R>=vimrc<CR><CR>
:VimrcHelp "     ,ve = vimrc editing (edit this file)                         
[N]
  nnoremap ,ve :call <sid>OpenVimrc()<cr>

function! s:OpenVimrc()
  if (0==strlen(bufname('%'))) && (1==line('$')) && (0==strlen(getline('$')))
    " edit in place
    exe "e ".g:vimrc
  else
    exe "sp ".g:vimrc
  endif
endfunction
" }}}
" ----------------------- >% ------------------

HTH,

--
Luc Hermitte
http://hermitte.free.fr/vim/

Reply via email to