lukas-reineke / indent-blankline.nvim

Indent guides for Neovim
MIT License
4.19k stars 104 forks source link

Incremental substitution preview (inccommand) partially overridden by indent-blankline #434

Open Frederick888 opened 2 years ago

Frederick888 commented 2 years ago

Given file

int main() {
    int foo;
    int bar;
}

// vim: set expandtab tabstop=8 shiftwidth=4:

Type :%s/^ \+int/char but don't hit enter yet, by default (inccommand=nosplit) it looks like: image

Now use the vimrc below and do the same thing

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath

call plug#begin('~/.vim/plugged')
Plug 'lukas-reineke/indent-blankline.nvim'
call plug#end()

set nocompatible
set updatetime=300
set cmdheight=2

" indent-blankline.nvim
set list
set listchars=tab:\ \ ,trail:-,nbsp:+
highlight IndentBlanklineIndent1 guifg=#70363A gui=nocombine
highlight IndentBlanklineIndent2 guifg=#72603E gui=nocombine
highlight IndentBlanklineIndent3 guifg=#4C623C gui=nocombine
highlight IndentBlanklineIndent4 guifg=#2B5B61 gui=nocombine
highlight IndentBlanklineIndent5 guifg=#305878 gui=nocombine
highlight IndentBlanklineIndent6 guifg=#633C6E gui=nocombine
let g:indent_blankline_char_list = ['|', '¦', '┆', '┊']
let g:indent_blankline_char_highlight_list = ['IndentBlanklineIndent1', 'IndentBlanklineIndent2', 'IndentBlanklineIndent3',
      \ 'IndentBlanklineIndent4', 'IndentBlanklineIndent5', 'IndentBlanklineIndent6']
let g:indent_blankline_show_first_indent_level = v:false
let g:indent_blankline_show_trailing_blankline_indent = v:false
let g:indent_blankline_use_treesitter = v:true
let g:indent_blankline_filetype_exclude = ['man', 'help', 'fugitive']
let g:indent_blankline_buftype_exclude = ['terminal', 'quickfix', 'nowrite']
let g:indent_blankline_max_indent_increase = 1
let g:indent_blankline_indent_level = 8

It looks like: image

lukas-reineke commented 2 years ago

I don't think there is anything in the plugin I can do to fix this. This has to be addressed in Neovim core.

Frederick888 commented 2 years ago

@lukas-reineke Is there already a Neovim issue I can subscribe to? If not could you help file one? Thank you!

lukas-reineke commented 2 years ago

I don't think so. I'm not even sure how this could be solved. Indent blankline has no way to hook into what the preview is doing. And the built-in substitute preview doesn't know indent blankline exists.

You could just disable indent blankline when you enter cmdline mode.

au CmdlineEnter * IndentBlanklineDisable
au CmdlineLeave * IndentBlanklineEnable
Frederick888 commented 2 years ago

That's unfortunate. So instead of a bug report, do you think this can be a feature request to Neovim something along the lines of e.g. 'allow inccommand to override virtual texts' or 'make intermediate inccommand results visible to plugins'?

lukas-reineke commented 2 years ago

Yeah, probably the second one. But this would be pretty complex I imagine

Frederick888 commented 2 years ago

I'm probably asking too much for an edge case but could you outline what you need from Neovim in a feature request, just to see if it gets us somewhere?

Absolutely no rush of cos.