diff vim/autoload/ludo.vim @ 483:1a54ffbc3b15

Remove goyo stuff, add quicklist toggle.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 24 Sep 2020 23:07:10 -0700
parents b7682004288d
children 232351531855
line wrap: on
line diff
--- a/vim/autoload/ludo.vim	Sat Feb 15 22:23:16 2020 -0800
+++ b/vim/autoload/ludo.vim	Thu Sep 24 23:07:10 2020 -0700
@@ -97,46 +97,24 @@
     call ludo#trace("Exclude list: ".join(g:pathogen_disabled, ', '))
 endfunction
 
-" Goyo writing mode tweaks
+" Toggle quicklist window
 "
-let s:ludo_revert = {}
+function! ludo#toggle_quicklist() abort
+	let l:qlwin = -1
+	let l:wincount = winnr('$')
+	for l:winidx in range(1, l:wincount)
+		let l:winbuftype = getwinvar(l:winidx, '&buftype', '')
+		if l:winbuftype == 'quickfix'
+			let l:qlwin = l:winidx
+			break
+		endif
+	endfor
 
-function! ludo#on_goyo_enter()
-    let s:ludo_revert = {
-                \'spell': &spell,
-                \'copyindent': &copyindent,
-                \'smartindent': &smartindent,
-                \'autoindent': &autoindent,
-                \'list': &list,
-                \'showmode': &showmode,
-                \'showcmd': &showcmd,
-                \'scrolloff': &scrolloff,
-                \'complete': &complete,
-                \'background': &background
-                \}
-    set spell 
-    set nocopyindent nosmartindent noautoindent nolist noshowmode noshowcmd
-    set scrolloff=999
-    set complete+=s
-    set bg=light
-    if !has('gui_running')
-        let g:solarized_termcolors=256
-    endif
-endfunction
-
-function! ludo#on_goyo_leave()
-    if len(s:ludo_revert) == 0
-        call ludo#error("Can't revert settings!")
-        return
-    endif
-    for [key, val] in items(s:ludo_revert)
-        execute 'let &'.key.' = '.string(val)
-    endfor
-    let s:ludo_revert = {}
-endfunction
-
-function! ludo#writingmode()
-    Goyo
+	if l:qlwin < 0
+		copen
+	else
+		cclose
+	endif
 endfunction
 
 " Better tags browser using FZF