Let's say I have a text file opened in vim. I'd like to be able to edit this file from bash, let's say with the command echo "text" >> file while the file is already opened in vim. Ideally, vim would just refresh the new content and wouldn't bother with a .swp file, asking for what version I want to restore. Any idea how to do this?


I believe the option you're looking for is autoread. To use it put this in your vimrc:

set autoread

From :h 'autoread':

When a file has been detected to have been changed outside of Vim and it has not been changed inside of Vim, automatically read it again. When the file has been deleted this is not done.


Not the answer you're looking for? Browse other questions tagged or ask your own question.