ncm2 / ncm2-path

MIT License
21 stars 1 forks source link

Treat the directory of current file as base directory for directory completion #5

Closed uorbe001 closed 6 years ago

uorbe001 commented 6 years ago

Hi, I just setup this plugin and the autocompletion is acting in a way I find unexpected.

If I'm on a buffer located at foo/bar.txt, and type ./, the autocompletion tries to fill paths from foo's parent (project directory), instead of picking up the paths relative to the file. I know I can set autochdir but that makes other plugins (and my brain, tbh) unhappy.

I tried googling a bit and found other vim autocompletion plugins have had similar issues https://github.com/Shougo/deoplete.nvim/issues/109, and specifically, deoplete solved it by adding an option to use the local buffer's path instead of getcwd (https://github.com/Shougo/deoplete.nvim/commit/58ab778d00348035f95d51a2363849d249cd804c).

I looked at the code and I couldn't find a similar option here, is there one I'm missing?

roxma commented 6 years ago

There're three ncm2 sources in this plugin. (bufpath, cwdpath and rootpath defined in https://github.com/ncm2/ncm2-path/blob/master/autoload/ncm2_path.vim)

You could use :help ncm2#override_source to change their options respectively.

uorbe001 commented 6 years ago

@roxma I just found out looking at the help page that I was being dumb. For some reason the buf source wasn't working for me, but I got it working now and it does what I was asking here. Sorry I wasted your time :(.