cmp-fuzzy-path
cmp-fuzzy-path copied to clipboard
Path relative to current file instead of cwd
Thanks for making this great plugin! Can I make it insert the path relative to my current file? Perhaps easier to explain with an example.
Let's say I have the following folder structure:
├── src
│ ├── lib
│ │ ├── utils.js
│ ├── modules
│ ├── example
│ ├── index.js
I open .src/modules/example/index.js and type: import * from './utils.js'. Then it will correctly find the path of ./src/lib/utils.js, but when I hit enter it insert the path relative to the cwd (./src/lib/utils.js). Is there a way to instead insert the path relative to where I searched from(../../lib/utils.js)?
This has nothing to do with this plugin.
This plugin is just a connector between cmp and TabNine.
You have two options:
- contact
TabNine's team, and ask for this feature. - use a path completion plugin to
cmp. There are many, I am using mine: tzachar/cmp-fuzzy-path
- use a path completion plugin to cmp. There are many, I am using mine: tzachar/cmp-fuzzy-path
But isn't this tzachar/cmp-fuzzy-path? 🙂 Are you saying it should be possible using it?
My bad... Though this was opened in another plugin I maintain....
Will take a more in depth look.
The plugin currently runs fd in the working directory of nvim. Therefore, all paths will be relevant to that directory.
To support your request, you would need to transform the paths returned by fd to match the current buffer's path. This would require some code... It would be best to add it as a configuration option, such that the control of the plugin can be changed based on context (filetype, cmdline, etc).
I will accept such a PR.