I have been using :Files to get a list of files using fzf.vim. Although whenever I hit enter to open a new file and the current file has not been saved I get an error message saying

No write since last change

In order to open a new file now I either need to save the file and search the new file again or I need to search the new file and open it in a split using ctrl+h or ctrl+v. Any way I can have the file open in a split or a new tab on hitting Enter if the current file has not been saved?

  • 2
    Does adding set hidden to your vimrc solve the problem?
    – statox
    May 3 at 12:32
  • Oh wasn't aware of this. This does help to a certain extent. But I would also like to know which and how many files have unsaved changes. Additionally does hitting :w save all the unsaved files or only the one which is currently open May 4 at 9:34
  • To know how many unsaved buffers you have you can use :ls the buffers with a + next to their name are unsaved (see :h :ls). And :w only works on the current buffer, if you want to save them all at one you could use :h :bufdo with something like :bufdo w
    – statox
    May 4 at 10:20

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.