Open tom-kuca opened 2 months ago
if has('vim_starting') set encoding=utf-8 endif scriptencoding utf-8 if &compatible set nocompatible endif let s:plug_dir = expand('/tmp/plugged/vim-plug') if !filereadable(s:plug_dir .. '/plug.vim') execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir) end execute 'set runtimepath+=' . s:plug_dir call plug#begin(s:plug_dir) Plug 'hrsh7th/nvim-cmp' Plug 'hrsh7th/cmp-cmdline' call plug#end() PlugInstall | quit " Setup global configuration. More on configuration below. lua << EOF local cmp = require "cmp" cmp.setup({}) -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). cmp.setup.cmdline(':', { mapping = cmp.mapping.preset.cmdline(), sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }), matching = { disallow_symbol_nonprefix_matching = false } }) EOF
Expanding % on cmdline keeps the percent sign after expansion. The behavior is different when nvim-cmp is not installed.
%
nvim-cmp
hrsh7th/cmp-cmdline
/tmp/hello.txt
:e %<Tab>
cmdline expands to :e /tmp/hello.txt
:e /tmp/hello.txt
cmdline expands to :e %/tmp/hello.txt
:e %/tmp/hello.txt
Without any plugin ( nvim --noplugin --clean), percent expands to /tmp/hello.txt.
nvim --noplugin --clean
FAQ
Announcement
Minimal reproducible full config
Description
Expanding
%
on cmdline keeps the percent sign after expansion. The behavior is different whennvim-cmp
is not installed.Steps to reproduce
hrsh7th/cmp-cmdline
and cmdline configuration from README./tmp/hello.txt
:e %<Tab>
Expected behavior
cmdline expands to
:e /tmp/hello.txt
Actual behavior
cmdline expands to
:e %/tmp/hello.txt
Additional context
Without any plugin (
nvim --noplugin --clean
), percent expands to/tmp/hello.txt
.