Skip to content

Not taking .gitignore into account for files created after starting up vim #412

Closed
@johnnovak

Description

@johnnovak

Problem description

The gitignore settings are only taken into account for the files that existed when starting vim, not for files created afterwards.

Steps to reproduce

Setup a new repo for the tests:

mkdir test
cd test
touch a a~ b b~ c
git init
echo "*~" > .gitignore

Test 1

  1. Start vim
  2. :set backup (to make sure backup files get created in the same directory with ~ appended to the end of the filename)
  3. Open the file browser, observe that you can toggle with Shift-I whether the files a~ and b~ are shown.
  4. Open file c and save it while the file browser is open. Note that c~ gets created and it gets shown in the browser, but Shift+I won't hide it like the rest of the backup files; it is always shown.
  5. NvimTreeRefresh or opening/closing the browser doesn't help; c~ will be always shown.
  6. Restart vim and open the file browser again. Now c~ gets toggled correctly too with Shift-I.

Test 2

  1. Start vim
  2. Open the file browser, observe that you can toggle with Shift-I whether the files a~ and b~ are shown.
  3. Create a new file called x~ from another shell while vim is open.
  4. Press Shift+R in the file browser to refresh the view; note that x~ is now shown.
  5. Similarly to Test1, Shift+I will toggle the backup files that existed at startup, but not x~.

Conclusion

Somehow the gitignore is taken into account only for the state of the filesystem at startup (?), but not for files created from vim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions