Vim won't load file in buffer (when executed from specific working directories)

848 views Asked by At

Sometimes when opening file(s) in the Vim editor (in the traditional way: by invoking it from the command line with the filename passed as an argument), the application fails to create the respective buffer(s) for them and load the content in these buffers. Instead, it opens with only the empty (new) file buffer loaded.

I have observed a link between this situation occurring and Vim being run from a specific directory (which is not necessarily the directory in which the file being opened is located). As long as I'm running Vim from that directory, it won't open any files even if they are in different directories.

Such is the case with my user's home directory but it's not limited to that one. Sometimes the glitch appears after simply editing some file from a directory for no visible reason.

Plugins I use:

  • Pathogen
  • MiniBufExplorer
  • SingleCompile
  • ctrlp
  • NERDTree
  • vim-pipe
  • vim-sensible

You can also take a look at my .vimrc file.

1

There are 1 answers

0
Ingo Karkat On

This is likely caused by a misbehaving plugin.

Often, a binary search where you disable half of your plugins, then only one half of that (when the problem is still there), or the other half (when the problem vanished) lets you get to the problematic script quickly. The same can be done with the configuration in your ~/.vimrc (by commenting out blocks).

Also, you can capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine the vimlog log file for suspect commands.