I am using nvim v0.4.3. This is the latest version available in repository. I have an Arch build with the most up to date packages and kernel 5.6.4-arch1-1.
I have the below function in my
" function function! ReSource() let l:winview = winsaveview() :source ~/.vimrc<cr> call winrestview(l:winview) endfunction " function call nnoremap <leader>z :call ReSource()<cr>
It does not work.
When I call it, NeoVim complains about my re-sourcing the .vimrc file, but the file permissions for
~/.vimrc are OK.
The function should save the exact cursor position and screen buffer when I press
\z and then return to this exact layout after (re)sourcing my vimrc. That is why I use the function.
The error I get when I hit
\z to call the function is as follows:
Error detected while processing function ReSource: line 3: E484: Cannot open file ~/.vimrc<cr> Press ENTER or type command to continue
And yet when I use the below simple single line instead, without the function, it sources and re loads .vimrc perfectly.
nnoremap <leader>z :source ~/.vimrc<cr>
What's wrong with the function?
Within the function, if
- I remove the
- save my
- close it,
- reopen it,
- and press
I get this error:
Error detected while processing ~/.vimrc: line 399: E127: Cannot redefine function ReSource: It is in use Press ENTER or type command to continue
Line 399 is the