comparison vim/autoload/ludo.vim @ 430:71a080d4d83c

Vim stuff: Goyo writing mode, Ack with Ag.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 01 Apr 2018 22:44:59 -0700
parents 67f14a8c2304
children b7682004288d
comparison
equal deleted inserted replaced
429:52c2cfeed504 430:71a080d4d83c
14 echohl None 14 echohl None
15 endfunction 15 endfunction
16 16
17 " Error message. 17 " Error message.
18 function! ludo#error(msg) abort 18 function! ludo#error(msg) abort
19 let v:errmsg = "ludo: Error: ".a:msg
19 echohl ErrorMsg 20 echohl ErrorMsg
20 echomsg "ludo: Error: ".a:msg 21 echom v:errmsg
21 echohl None 22 echohl None
22 endfunction 23 endfunction
23 24
24 25
25 " Loads `pathogenrc` files in each bundle directory and, if found, 26 " Loads `pathogenrc` files in each bundle directory and, if found,
71 endfor 72 endfor
72 endfor 73 endfor
73 call ludo#trace("Exclude list: ".join(g:pathogen_disabled, ', ')) 74 call ludo#trace("Exclude list: ".join(g:pathogen_disabled, ', '))
74 endfunction 75 endfunction
75 76
77 let s:ludo_revert = {}
78
79 function! ludo#on_goyo_enter()
80 let s:ludo_revert = {
81 \'spell': &spell,
82 \'copyindent': &copyindent,
83 \'smartindent': &smartindent,
84 \'autoindent': &autoindent,
85 \'list': &list,
86 \'showmode': &showmode,
87 \'showcmd': &showcmd,
88 \'scrolloff': &scrolloff,
89 \'complete': &complete,
90 \'background': &background
91 \}
92 set spell
93 set nocopyindent nosmartindent noautoindent nolist noshowmode noshowcmd
94 set scrolloff=999
95 set complete+=s
96 set bg=light
97 if !has('gui_running')
98 let g:solarized_termcolors=256
99 endif
100 endfunction
101
102 function! ludo#on_goyo_leave()
103 if len(s:ludo_revert) == 0
104 call ludo#error("Can't revert settings!")
105 return
106 endif
107 for [key, val] in items(s:ludo_revert)
108 execute 'let &'.key.' = '.string(val)
109 endfor
110 let s:ludo_revert = {}
111 endfunction
112
113 function! ludo#writingmode()
114 Goyo
115 endfunction
116