Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
The :h compl-filename completion can be triggered manually in insert mode with <C-X><C-F>. However, there is no way to make this work with autocomplete.
Describe the solution you'd like
Add p (for "paths") as a possible option to complete, similarly to f for buffer names.
Alternatively, provide a Vim function that we could use (and possibly customize with complete-items) as F{func}.
Describe alternatives you've considered
Triggering file completion manually with inomap <C-F> <C-X><C-F>.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
I had a quick look at Vim's source code today. The simplest way to implement this feature is with the script below — the logic matches Vim's internals. I've also tweaked directory handling to make continuous path completion smoother. Give it a try.
export def Path(findstart: number, base: string): any if findstart > 0 var col = col('.') - 1 var pos = col - 1 var line = getline('.')->strpart(0, col) while pos > 0 && line[pos] =~ '\f' --pos endwhile if pos == 0 && line[pos] =~ '\f' return 0 elseif pos == col - 1 return -2 else return pos + 1 endif endif var res = getcompletion(base, 'file')->mapnew((_, v) => { return {word: v->trim('/\', 2), abbr: v} }) return empty(res) ? v:none : res enddef
Known issues:
plugin:
default.png (view on web)<C-X><C-F>
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
Emm '{' is in 'isfname' on win32. But it will throw error when getting completion getcompletion('{', 'file'), maybe this error canbe omitted on win32?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
I think this feature should not be implemented in source: There is no reliable way to back-off when filename search takes a long time (or hangs). Autocomplete timeouts will not help since this task is handled outside of Vim currently, and Vim does not interrupt until the relevant tree is enumerated. Changing this is not trivial.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()