Don't show parent directory in cmdline path
Feature Description
Hello, thanks for this wonderful plugin
I was wondering if this 2 things are possible:
-
Enable cmdline only for / and ? modes, i want blink cmp to show buffer completions for searching, but i want to use builtin cmdline completion with :e
. Is it possible? -
In case cmdline is enabled, is there an option to cut the previous inserted path? For example, here i dont want to see what i already selected in the cmdline, you can see 'dist' is repeated in the image
Enable cmdline only for / and ? modes, i want blink cmp to show buffer completions for searching, but i want to use builtin cmdline completion with :e . Is it possible?
Sure, disable the cmdline source by eithere changing cmdline.sources or setting sources.providers.cmdline.enabled = false
In case cmdline is enabled, is there an option to cut the previous inserted path? For example, here i dont want to see what i already selected in the cmdline, you can see 'dist' is repeated in the image
Makes sense, will leave this open until that's fixed
Thank you for your quick response ^^
@Saghen with regards to the first point:
I already tried what you suggested, but still the blink cmdline configuration and keymaps are still applying. I would like to use builtin completion with : command
I've looked into implementing the change for the second point. lua/blink/cmp/sources/cmdline/init.lua, line 145, has
if not is_first_arg and not is_file_completion then
Simply removing the is_file_completion condition makes this change. If the user is interested in keeping the original behavior, we could gate this behind an option. I personally feel that deduplicating the path suggestions based on what is already in the command line should be the default, though, because this is how Neovim works when using the built-in tab completion and this mirrors the path completion blink users get when typing a path in a buffer.
I’m also in favor of making this match the default cmdline completion and blink’s path provider, it just feels more natural and user-friendly. I don’t really see a reason to keep the old behavior, so adding another option for this seems like overkill. @Saghen, any thoughts on this?
You’re definitely on the right track with your change, but just dropping the is_file_completion check isn’t quite enough. For example, with :e ~/.<Tab>, you lose the dot prefix, so hidden files and directories don’t show up as expected.
I’ve actually already got a local branch where I fixed these issues, and I haven’t run into any problems so far. I can push it up soon to take a look!