Mercurial > vim-gutentags
comparison doc/gutentags.txt @ 207:20bfab5b054f
Status-line improvements.
- Fix `statusline` function so it does what the documentation says.
- Add new function that takes a callback.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 01 Apr 2018 11:52:13 -0700 |
parents | 30ac3583c902 |
children | 39547ffc8867 fcb0415dceac |
comparison
equal
deleted
inserted
replaced
206:1ffa9d58c2bb | 207:20bfab5b054f |
---|---|
192 Tag file generation can take a while if you're working on a project big | 192 Tag file generation can take a while if you're working on a project big |
193 enough. In that case, you may want to know when `ctags` is running, so you | 193 enough. In that case, you may want to know when `ctags` is running, so you |
194 have a heads up if some of the tags aren't recognized yet. | 194 have a heads up if some of the tags aren't recognized yet. |
195 | 195 |
196 *gutentags#statusline()* | 196 *gutentags#statusline()* |
197 You can display and indicator of tag generation progress in your |status-line| | 197 You can display an indicator of tag generation progress in your |status-line| |
198 with the following function: > | 198 with the following function: > |
199 :set statusline+=%{gutentags#statusline()} | 199 :set statusline+=%{gutentags#statusline()} |
200 | |
201 The function will, by default, print a list of modules in the status line. So | |
202 if the `ctags` module (see |g:gutentags_modules|) is currently generating | |
203 a tags file, you will see "ctags" printed in the status line. If nothing is | |
204 happening, nothing will be printed in the status line. | |
205 | |
206 You can pass some parameters to customize this: | |
207 | |
208 1. A prefix string (defaults to `""`). | |
209 2. A suffix string (defaults to `""`). | |
210 3. The text to print (defaults to the names of modules currently generating | |
211 something). | |
212 | |
213 So using `gutentags#statusline('[', ']')` would print `"[ctags]"` instead of | |
214 `"ctags"`. | |
200 | 215 |
201 Because Gutentags runs the tag generation in the background, the statusline | 216 Because Gutentags runs the tag generation in the background, the statusline |
202 indicator might stay there even after the background process has ended. It | 217 indicator might stay there even after the background process has ended. It |
203 would only go away when Vim decides to refresh the statusline. You can force | 218 would only go away when Vim decides to refresh the statusline. You can force |
204 refresh it in a callback on |GutentagsUpdating| and |GutentagsUpdated|. | 219 refresh it in a callback on |GutentagsUpdating| and |GutentagsUpdated|. |
208 augroup MyGutentagsStatusLineRefresher | 223 augroup MyGutentagsStatusLineRefresher |
209 autocmd! | 224 autocmd! |
210 autocmd User GutentagsUpdating call lightline#update() | 225 autocmd User GutentagsUpdating call lightline#update() |
211 autocmd User GutentagsUpdated call lightline#update() | 226 autocmd User GutentagsUpdated call lightline#update() |
212 augroup END | 227 augroup END |
228 | |
229 *gutentags#statusline_cb* | |
230 As an alternative to the previous function, `gutentags#statusline_cb` takes | |
231 a single parameter which should be a |Funcref| or a function name. This | |
232 function should take a list of active module names, and return a string. This | |
233 lets you completely control what the status line will print. | |
234 | |
235 For instance: | |
236 function! s:get_gutentags_status(mods) abort | |
237 let l:msg = '' | |
238 if index(a:mods, 'ctags') > 0 | |
239 let l:msg .= '♨' | |
240 endif | |
241 if index(a:mods, 'cscope') > 0 | |
242 let l:msg .= '♺' | |
243 endif | |
244 return l:msg | |
245 endfunction | |
246 | |
247 :set statusline+=%{gutentags#statusline_cb( | |
248 \function('<SID>get_gutentags_status'))} | |
249 | |
250 By default, the callback function doesn't get called if no tags generation is | |
251 currently happening. You can pass `1` as a second argument so that the | |
252 callback function is always called. | |
213 | 253 |
214 | 254 |
215 ============================================================================= | 255 ============================================================================= |
216 4. Global Settings *gutentags-settings* | 256 4. Global Settings *gutentags-settings* |
217 | 257 |