blink.cmp icon indicating copy to clipboard operation
blink.cmp copied to clipboard

Don't show parent directory in cmdline path

Open jugarpeupv opened this issue 8 months ago • 4 comments

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

Image

jugarpeupv avatar Apr 09 '25 10:04 jugarpeupv

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

saghen avatar Apr 09 '25 16:04 saghen

Thank you for your quick response ^^

@Saghen with regards to the first point:

Image

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

Image

jugarpeupv avatar Apr 10 '25 07:04 jugarpeupv

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.

mcauley-penney avatar May 25 '25 23:05 mcauley-penney

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!

soifou avatar May 27 '25 22:05 soifou