if has('vim_starting')
set encoding=utf-8
endif
scriptencoding utf-8
if &compatible
set nocompatible
endif
set cmdheight=0
set laststatus=2
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-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/vim-vsnip'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit
" Setup global configuration. More on configuration below.
lua << EOF
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local cmp = require('cmp')
cmp.setup({
formatting = {
fields = { 'abbr', 'kind' }
},
snippet = {
expand = function(args)
vim.fn['vsnip#anonymous'](args.body)
end,
},
window = {
completion = {
border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' },
winhighlight = 'Normal:CmpItemMenu,FloatBorder:CmpItemMenuBorder,CursorLine:CmpItemMenuSel,Search:CmpItemMenuSearch'
}
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn['vsnip#available'](1) == 1 then
feedkey('<Plug>(vsnip-expand-or-jump)', '')
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn['vsnip#jumpable'](-1) == 1 then
feedkey('<Plug>(vsnip-jump-prev)', '')
end
end, { 'i', 's' }),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
},
{
{ name = 'buffer' },
})
})
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
},
{
{ name = 'cmdline' }
})
})
EOF
lua << EOF
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require'lspconfig'.cssls.setup {
capabilities = capabilities,
}
EOF
Description
When using cmdheight=0 and laststatus=2 the statusline will flash briefly in front of the cmdline when the completion menu is open.
Steps to reproduce
Type something into the cmdline that will pop a completion window up and you will notice sometimes how the statusline flashes. This does not happen all of the time but it certainly does happen most of the time.
This does not happen when running nvim --clean
Expected behavior
The statusline should not flash in front of the cmdline.
Actual behavior
The statusline flashes briefly in front of the cmdline when the completion menu is open.
FAQ
Announcement
Minimal reproducible full config
Description
When using
cmdheight=0
andlaststatus=2
the statusline will flash briefly in front of the cmdline when the completion menu is open.Steps to reproduce
Type something into the cmdline that will pop a completion window up and you will notice sometimes how the statusline flashes. This does not happen all of the time but it certainly does happen most of the time.
This does not happen when running
nvim --clean
Expected behavior
The statusline should not flash in front of the cmdline.
Actual behavior
The statusline flashes briefly in front of the cmdline when the completion menu is open.
https://user-images.githubusercontent.com/14960414/194352658-742e069a-91df-4fed-82f5-ff5b63c4128e.mp4
https://user-images.githubusercontent.com/14960414/194352734-9af4990a-2e8c-4d95-997f-7a73f2c7772d.mp4
Additional context
No response