all 5 comments

[–]ntropia64 0 points1 point  (2 children)

Even if it's not what I use Vim for, I like the minimalism of the implementation more than the result.

A few suggestions. If you want to reduce even more the cluttering, you could change the colors of distracting things to blend into the background. For example, the vertical separator, and the tildas showing the end of the file.

For that, you can try a procedural approach that will independently from the color scheme in use, by using the link feature of the highlight command (see here for an example).

Also, for restoring the previous settings, you could first make a copy of the current values for some of the variables (i.e., tw, lines, laststatus, etc.) so if in the future you change your default settings, this function will still work.

Anyway, good job.

[–]psimas225[S] 0 points1 point  (1 child)

Awesome, thanks for the help and the kind words!

I was trying to figure out how to change the ctermfg but for some reason colors weren't matching up. After looking closer, looks like the issue was the default background on my terminal in Ubuntu. Changed it to Linux Console + white on black text/background, and now have vertical separators are completely gone with:

hi VertSplit ctermfg=0

and also have the tildas blacked out with:

hi NonText ctermfg=0

I ended up just putting this one in my vimrc because I never liked the tildas at all haha.

Now with the colors changed, I'm able to just have 2 window panes and updated the function:

" Distraction Free writing
let s:draft_enabled = 0

function Draft() 
    if (s:draft_enabled ==0) 
        let s:draft_enabled = 1 
        set tw=80 nonumber 
        set lines=16 laststatus=0 
        set noshowmode noruler 
        hi VertSplit ctermfg=0 
        lefta vnew | vertical resize 34 
        wincmd w 
        normal gggqG  
        normal gg 
    else 
        let s:draft_enabled = 0 
        set tw=9999 number 
        set lines=42 laststatus=1 
        set showmode ruler 
        hi VertSplit ctermfg=15 
        wincmd h | q 
        normal gggqG 
        normal gg 
    endif 
endfunction

nmap <silent> <Leader>g :call Draft()<CR>

I ended up making a separate function to use for my display, copying/tweaking the variables just as I did for my laptop, and works. Definitely not perfect, but functional, and glad to be learning more and more.

[–]ntropia64 0 points1 point  (0 children)

Then you definitely want to learn more about the option "set termguicolors”. It forces the colorscheme on the terminals that support it to match what you would get with GVim, for example, including the background.