nvim-cmp source for filesystem paths.
support path alias, But don't start too much at a time, or there will be performance issues
require'cmp'.setup {
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{
name = 'path',
option = {
pathMappings = {
['@'] = '${folder}/src',
-- ['/'] = '${folder}/src/public/',
-- ['~@'] = '${folder}/src',
-- ['/images'] = '${folder}/src/images',
-- ['/components'] = '${folder}/src/components',
},
},
},
{ name = 'buffer' },
{ name = 'luasnip' },
}),
}
The below source configuration options are available. To set any of these options, do:
cmp.setup({
sources = {
{
name = 'path',
option = {
-- Options go into this table
},
},
},
})
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.
Default: true
Specify if directory names in the completion menu should include a trailing slash.
Default: returns the current working directory of the current buffer
Specifies the base directory for relative paths.