embear / vim-localvimrc

Search local vimrc files (".lvimrc") in the tree (root dir up to current dir) and load them.
http://www.vim.org/scripts/script.php?script_id=441
GNU General Public License v3.0
484 stars 28 forks source link

Problems finding lvimrc file on Windows #43

Closed tjpotts closed 7 years ago

tjpotts commented 8 years ago

I'm fairly new to Vim, and having trouble getting this working under gvim 7.4 on Windows 7. At first the plugin wasn't able to find my _lvimrc files at all (I have g:localvimrc_name set to look for both _ and . prefixed files).

Eventually I was able to get it partially working by changing changing lines 181 & 183 (let l:directory = ...) to remove the calls to fnameescape(). However, the plugin still only seems to find _lvimrc files in the current directory, not in any parent directories.

My localvimrc settings are:

let g:localvimrc_event = ["VimEnter"]
let g:localvimrc_name = [".lvimrc","_lvimrc"]
let g:localvimrc_sandbox = 0
let g:localvimrc_persistent = 1
let g:localvimrc_debug = 100

It's probably also worth noting that I'm using the plugin through pathogen, and the project folder I'm working with is at a location which contains spaces in it's path.

I'm not sure if the problem is with the plugin, my setup or Vim itself, but let me know if you need more info. I will try to do some more investigation when I get a chance to see if another plugin or setting is possibly interfering with things somehow.

embear commented 8 years ago

I tried to reproduce the problem. For me it works even with spaces in path. No need to remove fnameescape(). I used your settings except the g:localvimrc_event which I changed to BufEnter because VimEnter is only a single event on startup.

Can you please supply the localvimrc debug output (command :messages)

tjpotts commented 8 years ago

After some more experimenting, it looks like the problem isn't the spaces in the path, but the fact that one of the folders in the path has a , in the name.

Using the following _vimrc:

set nocompatible

let g:localvimrc_name = [".lvimrc","_lvimrc"]
let g:localvimrc_debug = 100

execute pathogen#infect()

colorscheme molokai

With the only plugins installed being pathogen, localvimrc, and a couple color schemes, I created a folder C:\test, folder with the following _lvimrc containing only colorscheme solarized and a subfolder C:\test, folder\subfolder. Both folders have an empty file test.txt. The _lvimrc file is loaded correctly in test, folder, but not in subfolder.

The following is the :messages output for the (working) test folder:

localvimrc: ==================================================
localvimrc: localvimrc.vim 1
localvimrc: searching directory "C:\test,\ folder"
localvimrc: found files: ['C:\test, folder\_lvimrc']
localvimrc: candidate files: ['C:\test, folder\_lvimrc']
localvimrc: processing "C:\test, folder\_lvimrc"
localvimrc: stored information: answer = '' sandbox answer = '' checksum = ''
localvimrc: checksum calc -> C:\test,\ folder\_lvimrc : 25rw-rw-rw-1458133324
localvimrc: checksum mismatch, no answer reuse
localvimrc: need to ask
localvimrc: answer is "y"
localvimrc: g:localvimrc_file = C:\test, folder\test.txt, g:localvimrc_file_dir = C:\test, folder
localvimrc: g:localvimrc_script = C:\test, folder\_lvimrc, g:localvimrc_script_dir = C:\test, folder
localvimrc: g:localvimrc_sourced_once = 0, g:localvimrc_sourced_once_for_file = 0
localvimrc: using sandbox
localvimrc: unable to use sandbox on 'C:\test, folder\_lvimrc'
localvimrc: need to ask
localvimrc: sandbox answer is "y"
localvimrc: sourced C:\test, folder\_lvimrc
localvimrc: checksum calc -> C:\test,\ folder\_lvimrc : 25rw-rw-rw-1458133324
localvimrc: ==================================================

And for the (non-working) subfolder:

localvimrc: ==================================================
localvimrc: localvimrc.vim 1
localvimrc: searching directory "C:\test,\ folder\subfolder"
localvimrc: found files: []
localvimrc: candidate files: []
localvimrc: ==================================================

Note that this is with the original plugin code (i.e. with fnameescape() still in place).

embear commented 8 years ago

OK, I can confirm the bug now. The problem seems be the , in the path. It is treated as a special character in argument path to funtcion findfile(). I suspect that ; and * in the path name will also make problems. Currently I don't really know how to fix this. I need to think about that this weekend.

I wish back good old 8.3 ASCII only filenames and paths :-)

embear commented 8 years ago

The mentioned thinca/vim-localrc is a different project. Please create issues for this project at https://github.com/thinca/vim-localrc/issues

If it is a problem with this project, please provide more informations. This issue has nothing to do with symlinks (you mentioned NTFS links in the original issue) but with using characters in filenames that have a special meaning in vim functions.

embear commented 7 years ago

No response in 6 months ... closed