DEV Community

Discussion on: My editor journey: sublime, vim, emacs, vscode

Collapse
 
dmfay profile image
Dian Fay

This won't be changing your mind at all but you can in fact hot-reload config changes in vim with :so $MYVIMRC, or even configure your vimrc to auto-reload by adding an autocommand group:

augroup myvimrc
  au!
  au BufWritePost .vimrc,vimrc so $MYVIMRC
augroup END
Collapse
 
lucasprag profile image
lucasprag

Awesome! I knew is was possible but not that it is that easy. Thanks
As I see, when I write a .vimrc or vimrc buffer it will also run the command to load my vimrc. Nice.

Collapse
 
dmfay profile image
Dian Fay

Right -- I have ~/.vimrc symlinked from ~/.dotfiles/vimrc so the buffer could have either name, if you don't have that setup you can obviously adjust the name detection as needed.

Collapse
 
lucasprag profile image
lucasprag

btw, I ended up doing like this:

" reload vim configuration (aka vimrc)
" :e reloads buffer to trigger the FileType event, useful if you don't want to put files into ftplugin
command! ReloadVimConfig so $MYVIMRC
  \| execute 'e'
  \| echo 'config reloaded!'

github.com/lucasprag/vimlociraptor...

Thanks