I have a script that is called when I open a file with fileA extension in vim:

autocmd BufWritePost *fileA !/usr/bin/named_check_vim %:p

script named_checkvim checks for errors in a file, if errors are found I want to go back to the vim buffer that is currently opened.

How do I do this from the script? I simply used vi fileA but I will get a file swap error.

  • 1
    Get rid of swap files all together by adding set noswapfile to your .vimrc? Also you might want to read :h 'makeprg' or check plugins like coc.nvim, ALE or syntastic. And finally if you didn't do it already, remember to use an augroup with your autocommand – statox Jul 7 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.