Your issue is that functions cannot be redefined without !
(as in function!
). This is only partially true:
*E127* *E122*
When a function by this name already exists and [!] is
not used an error message is given. There is one
exception: When sourcing a script again, a function
that was previously defined in that script will be
silently replaced.
When [!] is used, an existing function is silently
replaced. Unless it is currently being executed, that
is an error.
NOTE: Use ! wisely. If used without care it can cause
an existing function to be replaced unexpectedly,
which is hard to debug.
I actually do not use !
anymore, but I believe in old versions of vim it was required to be able to re-source a script at runtime and have function/command definitions work. You might want to check on your version.
A more idiomatic way to accomplish your setup is to split the two (this is effectively what I do):
" ~/.vim/vimrc, or some other globally-sourced file
nnoremap <leader>fs :write<CR>
and
" ~/.vim/after/ftplugin/vim.vim
" two options: a dedicated map
nnoremap <buffer> <localleader>ef :source %<CR>
" or an autocommand
augroup SourceVim
autocmd! * <buffer>
autocmd BufWritePost <buffer> source %
augroup END
(I do something similar in clojure with fireplace's :Require
)
:h E127