1
9
Fork
You've already forked cmp-async-path
4
nvim-cmp source for filesystem paths with async processing
  • Lua 100%
Felipe Lema 98185a91d4 update zsh handling to latest version
not sure if backwards-compatible
2026年06月09日 13:26:12 -04:00
lua update zsh handling to latest version 2026年06月09日 13:26:12 -04:00
plugin Drop after/, check if already loaded ( #9 ) 2024年10月21日 20:32:22 +00:00
.editorconfig correct .editorconfig tag 2024年03月25日 09:53:32 -03:00
LICENSE Create LICENSE 2021年11月10日 20:30:12 +09:00
README.md avoid using vim module 2026年06月09日 11:45:49 -04:00

https://codeberg.org/FelipeLema/cmp-async-path

cmp-async-path

nvim-cmp source for filesystem paths with async processing (neovim won't block while reading from disk).

forked from https://github.com/hrsh7th/cmp-path/

Setup

require'cmp'.setup {
 sources = {
 { name = 'async_path' }
 }
}

Configuration

The below source configuration options are available. To set any of these options, do:

cmp.setup({
 sources = {
 {
 name = 'async_path',
 option = {
 -- Options go into this table
 },
 },
 },
})

trailing_slash (type: boolean)

Default: false

Specify if completed directory names should include a trailing slash. Enabling this option makes this source behave like Vim's built-in path completion.

label_trailing_slash (type: boolean)

Default: true

Specify if directory names in the completion menu should include a trailing slash.

get_cwd (type: function)

Default: returns the current working directory of the current buffer

Specifies the base directory for relative paths.

show_hidden_files_by_default (type: boolean)

Default: false

Specify if hidden files should appear in the completion menu without the need of typing . first.

Order in completion

You may want to sort the entries coming from this source. Personally, I like the latest entry (file or directory) at the top.

To achieve this ordering, you can append the following config

require'cmp'.setup {
 -- the rest of the config
 sorting = {
 comparators = vim.list_extend({
 ---@param l cmp.Entry
 ---@param r cmp.Entry
 ---@return boolean|nil
 function(l, r)
 --- Try to compare file/dir entries, give up and delegate if any entry isn't
 ---@param i cmp.Entry
 ---@return uv.fs_stat.result?
 local function stat(i)
 local d = i.completion_item.data or {}
 return (d.stat or d.lstat) or nil
 end
 local ls = stat(l)
 if not ls then
 return nil
 end
 local lr = stat(r)
 if not lr then
 return nil
 end
 return lr.mtime.sec < ls.mtime.sec
 end,
 }, 
 -- ↓ the rest of the default comparators
 require "cmp.config.default"().sorting.comparators)
 }
}
## luatexts
Lua source code for luatexts was embedded. Code originally comes from https://github.com/agladysh/luatexts/