[vim/vim] Add compl-filename as a possible value for complete (Issue #20392)

8 views
Skip to first unread message

Andrei Heidelbacher

unread,
May 30, 2026, 7:31:02 PMMay 30
to vim/vim, Subscribed
andreihh created an issue (vim/vim#20392)

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.Message ID: <vim/vim/issues/20392@github.com>

Mao-Yining

unread,
Jul 1, 2026, 11:30:13 PM (11 hours ago) Jul 1
to vim/vim, Subscribed
mao-yining left a comment (vim/vim#20392)

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:

  • paths cannot contain spaces, since they’re not in isfname.
  • menu is placed in different place

plugin:

default.png (view on web)

<C-X><C-F>

default.png (view on web)


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.Message ID: <vim/vim/issues/20392/4861915816@github.com>

Mao-Yining

unread,
6:38 AM (4 hours ago) 6:38 AM
to vim/vim, Subscribed
mao-yining left a comment (vim/vim#20392)

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.Message ID: <vim/vim/issues/20392/4864795987@github.com>

girish

unread,
9:48 AM (1 hour ago) 9:48 AM
to vim/vim, Subscribed
girishji left a comment (vim/vim#20392)

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.Message ID: <vim/vim/issues/20392/4866440452@github.com>

Reply all
Reply to author
Forward
0 new messages