On Di, 21 Aug 2018, Oleksii Vilchanskyi wrote:
> However, if I try wrapping it in a function, E127 occurs:
> > set nocompatible
> > filetype plugin indent on
> > syntax on
> >
> > augroup vimrc
> > autocmd!
> > autocmd BufWritePost testvimrc call s:ReloadRC("testvimrc")
> > augroup END
> >
> > function! s:ReloadRC(rc)
> > exec 'source ' . a:rc | echom "Reloaded " . a:rc
> > endfunction
>
> Whenever I do :w, I see:
> > E127: Cannot redefine function <SNR>1_ReloadRC: It is in use
Yes, what happens when you execute the function is, you reload your
.vimrc which will redefine your function, while the function is
executed. This is not allowed and causes the error message. Either do
not use a function, or define your function inside e.g.
~/.vim/plugins/reload.vim or similar.
Best,
Christian
--
Jeder Mensch ist einzigartig.
-- Benedetto Croce
--
--
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
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment