junegunn / goyo.vim

:tulip: Distraction-free writing in Vim
MIT License
4.52k stars 116 forks source link

Weird vertical bar in Distraction-Free mode #67

Closed halfo closed 9 years ago

halfo commented 9 years ago

Problem

In DF (Distraction-Free) mode, a weird vertical bar is appearing. I'm sure it is a vertical split bar. However, if I enter in insert mode it is gone. It reappears when I enter in DF mode again!

Screenshot

oie_q4joxo0litvp

Background

I wanted to set SignColumn always visible in DF mode. So I'm adding a dummy sign whenever I'm entering in DF mode and removing it whenever I leaves. Here is the code

function! s:goyo_enter()
:sign define dummy
:execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
endfunction

function! s:goyo_leave()
:execute 'sign unplace 9999 buffer=' . bufnr('')
:sign undefine dummy
endfunction

autocmd User GoyoEnter nested call <SID>goyo_enter()
autocmd User GoyoLeave nested call <SID>goyo_leave()

That weird bar stops appearing if I remove this code segment from my vimrc.

junegunn commented 9 years ago

Must be caused by another plugin or some configuration. Cannot reproduce with the following vimrc:

set rtp+=~/.vim/plugged/goyo.vim
function! s:goyo_enter()
  sign define dummy
  execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
endfunction

function! s:goyo_leave()
  execute 'sign unplace 9999 buffer=' . bufnr('')
  sign undefine dummy
endfunction

autocmd User GoyoEnter nested call <SID>goyo_enter()
autocmd User GoyoLeave nested call <SID>goyo_leave()
vim -Nu mini-vimrc

if I enter in insert mode it is gone

You should probably check :autocmd InsertEnter and :autocmd InsertLeave.

halfo commented 9 years ago

With that mini-vimrc, this is what it looks like now...

screenshot

BTW, I've managed to overcome this by setting LineNr's colors to my colorscheme's background color:

function! s:goyo_enter()
:sign define dummy
:execute 'sign place 9999 line=1 name=dummy buffer=' . bufnr('')
hi LineNr gui=none guibg=#1c1c1c guifg=#1c1c1c cterm=none ctermbg=234 ctermfg=234
endfunction

function! s:goyo_leave()
:execute 'sign unplace 9999 buffer=' . bufnr('')
:sign undefine dummy
endfunction

autocmd User GoyoEnter nested call <SID>goyo_enter()
autocmd User GoyoLeave nested call <SID>goyo_leave()

And this works iff that hi LineNr gui... is inside goyo_enter() function!

junegunn commented 9 years ago

l d

Well, this is what I see on my terminal (iterm2 with dark and light color themes). You probably should check your terminal configuration or try different terminal emulator.

halfo commented 9 years ago

Yeah, I also think it's something terminal related. Well, thanks for your time and such awesome plugin!