indent-blankline.nvim icon indicating copy to clipboard operation
indent-blankline.nvim copied to clipboard

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

Open Frederick888 opened this issue 2 years ago • 6 comments

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

Frederick888 avatar Jun 10 '22 13:06 Frederick888

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

lukas-reineke avatar Jun 11 '22 04:06 lukas-reineke

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

Frederick888 avatar Jun 11 '22 05:06 Frederick888

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

lukas-reineke avatar Jun 13 '22 01:06 lukas-reineke

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'?

Frederick888 avatar Jun 14 '22 03:06 Frederick888

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

lukas-reineke avatar Jun 14 '22 03:06 lukas-reineke

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.

Frederick888 avatar Jun 14 '22 05:06 Frederick888