startify.vim 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. " vim: et sw=2 sts=2
  2. " Plugin: https://github.com/mhinz/vim-startify
  3. " Description: A fancy start screen for Vim.
  4. " Maintainer: Marco Hinz <http://github.com/mhinz>
  5. if exists('g:autoloaded_startify') || &compatible
  6. finish
  7. endif
  8. let g:autoloaded_startify = 1
  9. " Init: values {{{1
  10. let s:numfiles = get(g:, 'startify_files_number', 10)
  11. let s:show_special = get(g:, 'startify_enable_special', 1)
  12. let s:delete_buffers = get(g:, 'startify_session_delete_buffers')
  13. let s:relative_path = get(g:, 'startify_relative_path') ? ':.' : ':p:~'
  14. let s:session_dir = resolve(expand(get(g:, 'startify_session_dir',
  15. \ has('win32') ? '$HOME\vimfiles\session' : '~/.vim/session')))
  16. let s:skiplist = get(g:, 'startify_skiplist', [
  17. \ 'COMMIT_EDITMSG',
  18. \ fnamemodify($VIMRUNTIME, ':p') .'/doc',
  19. \ 'bundle/.*/doc',
  20. \ ])
  21. " Function: #get_separator {{{1
  22. function! startify#get_separator() abort
  23. return !exists('+shellslash') || &shellslash ? '/' : '\'
  24. endfunction
  25. let s:sep = startify#get_separator()
  26. " Function: #get_lastline {{{1
  27. function! startify#get_lastline() abort
  28. return s:lastline + 1
  29. endfunction
  30. " Function: #insane_in_the_membrane {{{1
  31. function! startify#insane_in_the_membrane() abort
  32. if &insertmode
  33. return
  34. endif
  35. if !empty(v:servername) && exists('g:startify_skiplist_server')
  36. for servname in g:startify_skiplist_server
  37. if servname == v:servername
  38. return
  39. endif
  40. endfor
  41. endif
  42. setlocal
  43. \ bufhidden=wipe
  44. \ buftype=nofile
  45. \ nobuflisted
  46. \ nocursorcolumn
  47. \ nocursorline
  48. \ nolist
  49. \ nonumber
  50. \ noswapfile
  51. if empty(&statusline)
  52. setlocal statusline=\ startify
  53. endif
  54. if v:version >= 703
  55. setlocal norelativenumber
  56. endif
  57. if exists('g:startify_custom_header')
  58. call append('$', g:startify_custom_header)
  59. endif
  60. if s:show_special
  61. call append('$', [' [e] <empty buffer>', ''])
  62. endif
  63. let s:entry_number = 0
  64. if filereadable('Session.vim')
  65. call append('$', [' [0] '. getcwd() . s:sep .'Session.vim', ''])
  66. execute 'nnoremap <silent><buffer> 0 :call startify#session_delete_buffers() <bar> source Session.vim<cr>'
  67. let s:entry_number = 1
  68. let l:show_session = 1
  69. endif
  70. if empty(v:oldfiles)
  71. echohl WarningMsg
  72. echomsg "startify: Can't read viminfo file. Read :help startify-faq-02"
  73. echohl None
  74. endif
  75. let b:startify_section_header_lines = []
  76. let s:lists = get(g:, 'startify_list_order', [
  77. \ [' Most recently used files:'],
  78. \ 'files',
  79. \ [' Most recently used files in the current directory:'],
  80. \ 'dir',
  81. \ [' My sessions:'],
  82. \ 'sessions',
  83. \ [' My bookmarks:'],
  84. \ 'bookmarks',
  85. \ ])
  86. for item in s:lists
  87. if type(item) == 1
  88. call s:show_{item}()
  89. else
  90. let s:last_message = item
  91. endif
  92. unlet item
  93. endfor
  94. silent $delete _
  95. if s:show_special
  96. call append('$', ['', ' [q] <quit>'])
  97. endif
  98. " compute first line offset
  99. let s:firstline = 2
  100. " increase offset if there is a custom header
  101. if exists('g:startify_custom_header')
  102. let s:firstline += len(g:startify_custom_header)
  103. endif
  104. " no special, no local Session.vim, but a section header
  105. if !s:show_special && !exists('l:show_session') && type(s:lists[0]) == 3
  106. let s:firstline += len(s:lists[0]) + 1
  107. endif
  108. let s:lastline = line('$')
  109. if exists('g:startify_custom_footer')
  110. call append('$', g:startify_custom_footer)
  111. endif
  112. setlocal nomodifiable nomodified
  113. call s:set_mappings()
  114. call cursor(s:firstline + (s:show_special ? 2 : 0), 5)
  115. autocmd startify CursorMoved <buffer> call s:set_cursor()
  116. set filetype=startify
  117. silent! doautocmd <nomodeline> User Startified
  118. endfunction
  119. " Function: #session_load {{{1
  120. function! startify#session_load(...) abort
  121. if !isdirectory(s:session_dir)
  122. echomsg 'The session directory does not exist: '. s:session_dir
  123. return
  124. elseif empty(startify#session_list_as_string(''))
  125. echomsg 'There are no sessions...'
  126. return
  127. endif
  128. call inputsave()
  129. let spath = s:session_dir . s:sep . (exists('a:1')
  130. \ ? a:1
  131. \ : input('Load this session: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string'))
  132. \ | redraw
  133. call inputrestore()
  134. if filereadable(spath)
  135. if get(g:, 'startify_session_persistence')
  136. \ && exists('v:this_session')
  137. \ && filewritable(v:this_session)
  138. call startify#session_write(fnameescape(v:this_session))
  139. endif
  140. call startify#session_delete_buffers()
  141. execute 'source '. fnameescape(spath)
  142. else
  143. echo 'No such file: '. spath
  144. endif
  145. endfunction
  146. " Function: #session_save {{{1
  147. function! startify#session_save(...) abort
  148. if !isdirectory(s:session_dir)
  149. if exists('*mkdir')
  150. echo 'The session directory does not exist: '. s:session_dir .'. Create it? [y/n]'
  151. if (nr2char(getchar()) == 'y')
  152. call mkdir(s:session_dir, 'p')
  153. else
  154. echo
  155. return
  156. endif
  157. else
  158. echo 'The session directory does not exist: '. s:session_dir
  159. return
  160. endif
  161. endif
  162. call inputsave()
  163. let sname = exists('a:1')
  164. \ ? a:1
  165. \ : input('Save under this session name: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string')
  166. \ | redraw
  167. call inputrestore()
  168. if empty(sname)
  169. echo 'You gave an empty name!'
  170. return
  171. endif
  172. let spath = s:session_dir . s:sep . sname
  173. if !filereadable(spath)
  174. call startify#session_write(fnameescape(spath))
  175. echo 'Session saved under: '. spath
  176. return
  177. endif
  178. echo 'Session already exists. Overwrite? [y/n]' | redraw
  179. if nr2char(getchar()) == 'y'
  180. call startify#session_write(fnameescape(spath))
  181. echo 'Session saved under: '. spath
  182. else
  183. echo 'Did NOT save the session!'
  184. endif
  185. endfunction
  186. " Function: #session_close {{{1
  187. function! startify#session_close() abort
  188. if exists('v:this_session') && filewritable(v:this_session)
  189. call startify#session_write(fnameescape(v:this_session))
  190. let v:this_session = ''
  191. endif
  192. call startify#session_delete_buffers()
  193. Startify
  194. endfunction
  195. " Function: #session_write {{{1
  196. function! startify#session_write(spath)
  197. let ssop = &sessionoptions
  198. try
  199. " if this function is called while being in the Startify buffer
  200. " (by loading another session or running :SSave/:SLoad directly)
  201. " switch back to the previous buffer before saving the session
  202. if &filetype == 'startify'
  203. let callingbuffer = bufnr('#')
  204. if callingbuffer > 0
  205. execute 'buffer' callingbuffer
  206. endif
  207. endif
  208. " prevent saving already deleted buffers that were in the arglist
  209. for arg in argv()
  210. if !buflisted(arg)
  211. execute 'argdelete' fnameescape(arg)
  212. endif
  213. endfor
  214. set sessionoptions-=options
  215. execute 'mksession!' a:spath
  216. catch
  217. execute 'echoerr' string(v:exception)
  218. finally
  219. let &sessionoptions = ssop
  220. endtry
  221. if exists('g:startify_session_remove_lines')
  222. \ || exists('g:startify_session_savevars')
  223. \ || exists('g:startify_session_savecmds')
  224. execute 'split' a:spath
  225. " remove lines from the session file
  226. if exists('g:startify_session_remove_lines')
  227. for pattern in g:startify_session_remove_lines
  228. execute 'silent global/'. pattern .'/delete'
  229. endfor
  230. endif
  231. " put existing variables from savevars into session file
  232. if exists('g:startify_session_savevars')
  233. call append(line('$')-3, map(filter(copy(g:startify_session_savevars), 'exists(v:val)'), '"let ". v:val ." = ". strtrans(string(eval(v:val)))'))
  234. endif
  235. " put commands from savecmds into session file
  236. if exists('g:startify_session_savecmds')
  237. call append(line('$')-3, g:startify_session_savecmds)
  238. endif
  239. setlocal bufhidden=delete
  240. silent update
  241. silent hide
  242. endif
  243. endfunction
  244. " Function: #session_delete {{{1
  245. function! startify#session_delete(...) abort
  246. if !isdirectory(s:session_dir)
  247. echo 'The session directory does not exist: '. s:session_dir
  248. return
  249. elseif empty(startify#session_list_as_string(''))
  250. echo 'There are no sessions...'
  251. return
  252. endif
  253. call inputsave()
  254. let spath = s:session_dir . s:sep . (exists('a:1')
  255. \ ? a:1
  256. \ : input('Delete this session: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string'))
  257. \ | redraw
  258. call inputrestore()
  259. echo 'Really delete '. spath .'? [y/n]' | redraw
  260. if (nr2char(getchar()) == 'y')
  261. if delete(spath) == 0
  262. echo 'Deleted session '. spath .'!'
  263. else
  264. echo 'Deletion failed!'
  265. endif
  266. else
  267. echo 'Deletion aborted!'
  268. endif
  269. endfunction
  270. " Function: #session_delete_buffers {{{1
  271. function! startify#session_delete_buffers() abort
  272. if !s:delete_buffers
  273. return
  274. endif
  275. let n = 1
  276. while n <= bufnr('$')
  277. if buflisted(n)
  278. silent execute 'bdelete' n
  279. endif
  280. let n += 1
  281. endwhile
  282. endfunction
  283. " Function: #session_list {{{1
  284. function! startify#session_list(lead, ...) abort
  285. return map(split(globpath(s:session_dir, '*'.a:lead.'*'), '\n'), 'fnamemodify(v:val, ":t")')
  286. endfunction
  287. " Function: #session_list_as_string {{{1
  288. function! startify#session_list_as_string(lead, ...) abort
  289. return join(map(split(globpath(s:session_dir, '*'.a:lead.'*'), '\n'), 'fnamemodify(v:val, ":t")'), "\n")
  290. endfunction
  291. " Function: #open_buffers {{{1
  292. function! startify#open_buffers()
  293. " markers found; open one or more buffers
  294. if exists('s:marked') && !empty(s:marked)
  295. enew
  296. setlocal nobuflisted
  297. for val in values(s:marked)
  298. let [path, type] = val[1:2]
  299. let path = fnameescape(path)
  300. if has('win32')
  301. let path = substitute(path, '\[', '\[[]', 'g')
  302. endif
  303. if line2byte('$') == -1
  304. " open in current window
  305. execute 'edit' path
  306. elseif type == 'S'
  307. " open in split
  308. execute 'split' path
  309. elseif type == 'V'
  310. " open in vsplit
  311. execute 'vsplit' path
  312. elseif type == 'T'
  313. " open in tab
  314. execute 'tabnew' path
  315. else
  316. " open in current window
  317. execute 'edit' path
  318. endif
  319. call s:check_user_options()
  320. endfor
  321. " remove markers for next instance of :Startify
  322. if exists('s:marked')
  323. unlet s:marked
  324. endif
  325. else " no markers found; open a single buffer
  326. call s:set_mark('B')
  327. return startify#open_buffers()
  328. endif
  329. endfunction
  330. " Function: s:display_by_path {{{1
  331. function! s:display_by_path(path_prefix, path_format) abort
  332. let oldfiles = call(get(g:, 'startify_enable_unsafe') ? 's:filter_oldfiles_unsafe' : 's:filter_oldfiles',
  333. \ [a:path_prefix, a:path_format])
  334. if !empty(oldfiles)
  335. if exists('s:last_message')
  336. call s:print_section_header()
  337. endif
  338. for [absolute_path, entry_path] in oldfiles
  339. let index = s:get_index_as_string(s:entry_number)
  340. call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . entry_path)
  341. if has('win32')
  342. let absolute_path = substitute(absolute_path, '\[', '\[[]', 'g')
  343. endif
  344. execute 'nnoremap <buffer><silent>' index ':edit' absolute_path '<bar> call <sid>check_user_options()<cr>'
  345. let s:entry_number += 1
  346. endfor
  347. call append('$', '')
  348. endif
  349. endfunction
  350. " Function: s:filter_oldfiles {{{1
  351. function! s:filter_oldfiles(path_prefix, path_format) abort
  352. let path_prefix = '\V'. escape(a:path_prefix, '\')
  353. let counter = s:numfiles
  354. let entries = {}
  355. let oldfiles = []
  356. for fname in v:oldfiles
  357. if counter <= 0
  358. break
  359. endif
  360. let absolute_path = fnamemodify(resolve(fname), ":p")
  361. " filter duplicates, bookmarks and entries from the skiplist
  362. if has_key(entries, absolute_path)
  363. \ || !filereadable(absolute_path)
  364. \ || s:is_in_skiplist(absolute_path)
  365. \ || (exists('g:startify_bookmarks') && s:is_bookmark(absolute_path))
  366. \ || match(absolute_path, path_prefix)
  367. continue
  368. endif
  369. let entry_path = fnamemodify(absolute_path, a:path_format)
  370. let entries[absolute_path] = 1
  371. let counter -= 1
  372. let oldfiles += [[fnameescape(absolute_path), entry_path]]
  373. endfor
  374. return oldfiles
  375. endfun
  376. " Function: s:filter_oldfiles_unsafe {{{1
  377. function! s:filter_oldfiles_unsafe(path_prefix, path_format) abort
  378. let path_prefix = '\V'. escape(a:path_prefix, '\')
  379. let counter = s:numfiles
  380. let entries = {}
  381. let oldfiles = []
  382. for fname in v:oldfiles
  383. if counter <= 0
  384. break
  385. endif
  386. let absolute_path = glob(fnamemodify(fname, ":p"))
  387. if empty(absolute_path)
  388. \ || has_key(entries, absolute_path)
  389. \ || s:is_in_skiplist(absolute_path)
  390. \ || match(absolute_path, path_prefix)
  391. continue
  392. endif
  393. let entry_path = fnamemodify(absolute_path, a:path_format)
  394. let entries[absolute_path] = 1
  395. let counter -= 1
  396. let oldfiles += [[fnameescape(absolute_path), entry_path]]
  397. endfor
  398. return oldfiles
  399. endfun
  400. " Function: s:show_dir {{{1
  401. function! s:show_dir() abort
  402. return s:display_by_path(getcwd(), ':.')
  403. endfunction
  404. " Function: s:show_files {{{1
  405. function! s:show_files() abort
  406. return s:display_by_path('', s:relative_path)
  407. endfunction
  408. " Function: s:show_sessions {{{1
  409. function! s:show_sessions() abort
  410. let sfiles = split(globpath(s:session_dir, '*'), '\n')
  411. if empty(sfiles)
  412. if exists('s:last_message')
  413. unlet s:last_message
  414. endif
  415. return
  416. endif
  417. if exists('s:last_message')
  418. call s:print_section_header()
  419. endif
  420. for i in range(len(sfiles))
  421. let index = s:get_index_as_string(s:entry_number)
  422. call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fnamemodify(sfiles[i], ':t'))
  423. execute 'nnoremap <buffer><silent>' index ':SLoad' fnamemodify(sfiles[i], ':t') '<cr>'
  424. let s:entry_number += 1
  425. endfor
  426. call append('$', '')
  427. endfunction
  428. " Function: s:show_bookmarks {{{1
  429. function! s:show_bookmarks() abort
  430. if !exists('g:startify_bookmarks') || empty(g:startify_bookmarks)
  431. return
  432. endif
  433. if exists('s:last_message')
  434. call s:print_section_header()
  435. endif
  436. for fname in g:startify_bookmarks
  437. let index = s:get_index_as_string(s:entry_number)
  438. call append('$', ' ['. index .']'. repeat(' ', (3 - strlen(index))) . fname)
  439. execute 'nnoremap <buffer><silent>' index ':edit' fnameescape(fname) '<bar> call <sid>check_user_options()<cr>'
  440. let s:entry_number += 1
  441. endfor
  442. call append('$', '')
  443. endfunction
  444. " Function: s:is_in_skiplist {{{1
  445. function! s:is_in_skiplist(arg) abort
  446. for regexp in s:skiplist
  447. if (a:arg =~# regexp)
  448. return 1
  449. endif
  450. endfor
  451. endfunction
  452. " Function: s:is_bookmark {{{1
  453. function! s:is_bookmark(arg) abort
  454. for foo in map(filter(copy(g:startify_bookmarks), '!isdirectory(v:val)'), 'resolve(fnamemodify(v:val, ":p"))')
  455. if foo == a:arg
  456. return 1
  457. endif
  458. endfor
  459. endfunction
  460. " Function: s:set_cursor {{{1
  461. function! s:set_cursor() abort
  462. let s:oldline = exists('s:newline') ? s:newline : 5
  463. let s:newline = line('.')
  464. " going up (-1) or down (1)
  465. let movement = 2 * (s:newline > s:oldline) - 1
  466. " skip section headers lines until an entry is found
  467. while index(b:startify_section_header_lines, s:newline) != -1
  468. let s:newline += movement
  469. endwhile
  470. " skip blank lines between lists
  471. if empty(getline(s:newline))
  472. let s:newline += movement
  473. endif
  474. " don't go beyond first or last entry
  475. let s:newline = max([s:firstline, min([s:lastline, s:newline])])
  476. call cursor(s:newline, 5)
  477. endfunction
  478. " Function: s:set_mappings {{{1
  479. function! s:set_mappings() abort
  480. nnoremap <buffer><silent> e :enew<cr>
  481. nnoremap <buffer><silent> i :enew <bar> startinsert<cr>
  482. nnoremap <buffer><silent> <insert> :enew <bar> startinsert<cr>
  483. nnoremap <buffer><silent> b :call <sid>set_mark('B')<cr>
  484. nnoremap <buffer><silent> s :call <sid>set_mark('S')<cr>
  485. nnoremap <buffer><silent> t :call <sid>set_mark('T')<cr>
  486. nnoremap <buffer><silent> v :call <sid>set_mark('V')<cr>
  487. nnoremap <buffer><silent> <cr> :call startify#open_buffers()<cr>
  488. nnoremap <buffer><silent> <2-LeftMouse> :call startify#open_buffers()<cr>
  489. nnoremap <buffer><silent> q :call <sid>close()<cr>
  490. " Prevent 'nnoremap j gj' mappings, since they would break navigation.
  491. " (One can't leave the [x].)
  492. if !empty(mapcheck('h', 'n'))
  493. nnoremap <buffer> h h
  494. endif
  495. if !empty(mapcheck('j', 'n'))
  496. nnoremap <buffer> j j
  497. endif
  498. if !empty(mapcheck('k', 'n'))
  499. nnoremap <buffer> k k
  500. endif
  501. if !empty(mapcheck('l', 'n'))
  502. nnoremap <buffer> l l
  503. endif
  504. endfunction
  505. " Function: s:set_mark {{{1
  506. "
  507. " Markers are saved in the s:marked dict using the follow format:
  508. " - s:marked[0]: ID
  509. " - s:marked[1]: path
  510. " - s:marked[2]: type (buffer, split, vsplit)
  511. "
  512. function! s:set_mark(type) abort
  513. if !exists('s:marked')
  514. let s:marked = {}
  515. endif
  516. let [id, path] = matchlist(getline('.'), '\v\[(.{-})\]\s+(.*)')[1:2]
  517. let path = fnamemodify(path, ':p')
  518. if path =~# '\V<empty buffer>\|<quit>' || path =~# '^\w\+$'
  519. return
  520. endif
  521. setlocal modifiable
  522. " set markers
  523. if id =~# '[BSTV]'
  524. " replace marker by old ID
  525. execute 'normal! ci]'. remove(s:marked, line('.'))[0]
  526. else
  527. " save ID and replace it by the marker of the given type
  528. let s:marked[line('.')] = [id, path, a:type]
  529. execute 'normal! ci]'. repeat(a:type, len(id))
  530. endif
  531. setlocal nomodifiable nomodified
  532. endfunction
  533. " Function: s:check_user_options {{{1
  534. function! s:check_user_options() abort
  535. let path = expand('%')
  536. let session = path . s:sep .'Session.vim'
  537. " change to VCS root directory
  538. if get(g:, 'startify_session_autoload') && filereadable(session)
  539. execute 'source' session
  540. elseif get(g:, 'startify_change_to_vcs_root')
  541. call s:cd_to_vcs_root(path)
  542. " change directory
  543. elseif get(g:, 'startify_change_to_dir', 1)
  544. if isdirectory(path)
  545. lcd %
  546. else
  547. lcd %:h
  548. endif
  549. endif
  550. endfunction
  551. " Function: s:cd_to_vcs_root {{{1
  552. function! s:cd_to_vcs_root(path) abort
  553. let dir = fnamemodify(a:path, ':p:h')
  554. for vcs in [ '.git', '.hg', '.bzr', '.svn' ]
  555. let root = finddir(vcs, dir .';')
  556. if !empty(root)
  557. execute 'cd '. fnamemodify(root, ':h')
  558. return
  559. endif
  560. endfor
  561. endfunction
  562. " Function: s:close {{{1
  563. function! s:close() abort
  564. if len(filter(range(0, bufnr('$')), 'buflisted(v:val)'))
  565. if bufloaded(bufnr('#')) && bufnr('#') != bufnr('%')
  566. buffer #
  567. else
  568. bnext
  569. endif
  570. else
  571. quit
  572. endif
  573. endfunction
  574. " Function: s:get_index_as_string {{{1
  575. function! s:get_index_as_string(idx) abort
  576. if exists('g:startify_custom_indices')
  577. let listlen = len(g:startify_custom_indices)
  578. return (a:idx < listlen) ? g:startify_custom_indices[a:idx] : string(a:idx - listlen)
  579. else
  580. return string(a:idx)
  581. endif
  582. endfunction
  583. " Function: s:print_section_header {{{1
  584. function! s:print_section_header() abort
  585. $
  586. let curline = line('.')
  587. for lnum in range(curline, curline + len(s:last_message) + 1)
  588. call add(b:startify_section_header_lines, lnum)
  589. endfor
  590. call append('$', s:last_message + [''])
  591. unlet s:last_message
  592. endfunction