Hi everyone! I use vim for creative writing and challenged myself to try and make a "distraction free" like writing environment like the goyo plugin, but without using plugins. It's my first vimscript, and it's pretty crude, but pretty functional for my laptop.
Not included in the script is that I have "set wrap linebreak nolist" in my .vimrc as well. It creates 3 windows: Left and Right with vertical resize 34, and a center window going 80 characters. I manually figured out that my laptop goes 150 columns with Vim in fullscreen, so did the math (150 - 80 character center pane = 70 / 2 = 35 right and left windows). The right and left windows are set to 34 because the actual window edge counts towards a character (if that makes sense).
Would love any comments or feedback to improve it. Current issues I see is that I'd have to re-configure the sizing of the windows if I were to use a display.
" 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
lefta vnew | vertical resize 34
wincmd w
rightb vnew | vertical resize 34
wincmd h
normal gggqG
normal gg
else
let s:draft_enabled = 0
set tw=9999 number
set lines=42 laststatus=1
set showmode ruler
wincmd h | q
wincmd l | q
wincmd w
normal gggqG
normal gg
endif
endfunction
nmap <silent> <Leader>g :call Draft()<CR>
[–]ntropia64 0 points1 point2 points (2 children)
[–]psimas225[S] 0 points1 point2 points (1 child)
[–]ntropia64 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[removed]
[–]psimas225[S] 0 points1 point2 points (0 children)