indentLine icon indicating copy to clipboard operation
indentLine copied to clipboard

indentLine causing side effects for vim-notes plugin: conceal feature

Open naddeoa opened this issue 9 years ago • 9 comments

I'll start by saying thanks a lot for the plugin, I use it all the time and I love it!

That said, I also use vim-notes all the time. If the user has("conceal") on their vim, then the plugin will hide parts of urls and strings as the user types, but show them when the cursor is on the same line.

functional-vim-notes

When indentLine is installed, the plugin can only reveal the concealed parts of urls and strings when in visual mode, and it causes the cursor to think it's n characters ahead of where it actually is, where n is the number of concealed characters. In the case of a URL, http:// is concealed, so the cursor floats 7 characters ahead.

I tried to debug it, but I'm not sure what indentLines is doing. I could use a pointer. Also, adding let g:indentLine_fileTypeExclude = ["notes"] to my .vimrc doesn't seem to actually stop indentLines from running.

Steps to reproduce

  1. Start without having any plugins installed
  2. Install vim-notes
  3. Open a .notes file: vim test.notes
  4. Type a url, like http://github.com
  5. Move the cursor to a new line, notice that the http:// goes away
  6. Move the cursor back to the line with the url on it, the http:// reappears
  7. Install indentLines
  8. Open the test file: vim test.notes
  9. Place cursor on the line with the url on it. Notice that the http:// doesn't reappear like it should.
  10. Navigate horizontally using h and l. The cursor's path is erratic.

naddeoa avatar Feb 06 '15 07:02 naddeoa

I already installed vim-notes, why can't I get the filetype of notes when I open *.notes, i.e, vim test.notes? I find the root cause that if &concealcursor equal to empty, the issue will be fixed.

Yggdroot avatar Feb 06 '15 08:02 Yggdroot

Hmm, I'm not sure. For me, if I edit a file with vim test.notes and execute :set ft? then the response is filetype=notes. You're saying your vim doesn't do this?

You're right though. If I :set concealcursor= then the issue is fixed. Also, if I uninstall indentLines and open my test.notes file, then concealcursor is empty, like it should be for notes.

naddeoa avatar Feb 07 '15 01:02 naddeoa

As a follow up, it looks like the following function in after/plugin is setting the concealcursor option.

"{{{1 function! s:SetConcealOption()
function! s:SetConcealOption()
    if ! exists("b:indentLine_ConcealOptionSet")
        let b:indentLine_ConcealOptionSet = 1
        if ! exists("g:indentLine_noConcealCursor")
            setlocal concealcursor=inc
        endif
        setlocal conceallevel=2
    endif
endfunction

One solution might be to stop this function from getting called if the current file type is in the blacklist.

naddeoa avatar Feb 09 '15 01:02 naddeoa

I am seeing this problem with the scala conceal plugin, whenever I am editing a scala file with concealed operators.

hrj avatar Feb 15 '15 11:02 hrj

Scanning through the issues, it looks like many other issues are related to the conceal feature. For example: #78

@Yggdroot should probably consolidate all the related issues into a single issue that all of us can follow.

Aside, thanks for creating this very useful plugin!

hrj avatar Feb 15 '15 11:02 hrj

+1 on problems with the modification of conceal :)

jucor avatar Jul 05 '15 11:07 jucor

I'm getting the same problem with concealing from vimwiki

amacfie avatar Aug 28 '15 22:08 amacfie

Almost one year later. Do we have a solution now? I got stuck here, while i wanted to set my concealcursor and wondered, why is it overwritten. EDIT: Figured that out. Add to your vimrc file: let g:indentLine_concealcursor = "what ever you want"

If you are more fancy, wanting to have a "general" concealcursor(cocu), for example if you use/need it in other things: let &cocu = "nc" let g:indentLine_concealcursor = &cocu let someOtherThingWhichNeedsCocu = &cocu

I have tested it, if i disable the plugin and call ":verbose set cocu?" it shows, that it was set in the vimrc. Otherwise in the indenLine/after location.

m3m0ry avatar Jan 15 '16 12:01 m3m0ry

I have same issue with vim-markdown. I didn't know until now why markdown link braces not shown. indentLine plugin should not overwrite conceal options.

I added this to .vimrc as makeshift.

" Let indentLine use current conceal options
let g:indentLine_conceallevel  = &conceallevel
let g:indentLine_concealcursor = &concealcursor

aseom avatar May 13 '16 08:05 aseom