airblade/vim-rooter

vim can no longer edit existing files under topdir

Closed this issue · 1 comments

with g:rooter_patterns=['.git'], if I cd into a subdir, type 'vim', then 'e my.existing.file', it will ignore files in current directory and open a (new) file in root dir(wherever .git is)

That is expected, isn't it?

This is how I tried to reproduce your example:

# shell
git init issue-131 && cd issue-131
mkdir subdir && cd subdir && touch my.existing.file
vim

" inside vim
:pwd
" => /path/to/issue-131
:e my.existing.file
" => creates new file /path/to/issue-131/my.existing.file (instead of opening existing file /path/to/issue-131/subdir/my.existing.file)

When you are in the subdirectory and open vim, vim-rooter changes vim's working directory to the top directory. Therefore when you do :edit my.existing.file it will be looking in the top directory for my.existing.file.