startify.txt 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  1. *startify.txt* The fancy start screen.
  2. *startify*
  3. __ __ ___
  4. /\ \__ /\ \__ __ /'___\
  5. ____\ \ ,_\ __ _ __\ \ ,_\/\_\/\ \__/ __ __
  6. /',__\\ \ \/ /'__`\ /\`'__\ \ \/\/\ \ \ ,__\/\ \/\ \
  7. /\__, `\\ \ \_/\ \L\.\_\ \ \/ \ \ \_\ \ \ \ \_/\ \ \_\ \
  8. \/\____/ \ \__\ \__/.\_\\ \_\ \ \__\\ \_\ \_\ \/`____ \
  9. \/___/ \/__/\/__/\/_/ \/_/ \/__/ \/_/\/_/ `/___/> \
  10. /\___/
  11. \/__/
  12. by Marco Hinz~
  13. >
  14. If you use any of my plugins, please star them on github. It's a great way
  15. of getting feedback and gives me the kick to put more time into their
  16. development.
  17. If you encounter any bugs or have feature requests, just open an issue
  18. report on Github.
  19. Thank you for flying mhi^ airlines. Get the Vim on!
  20. <
  21. ==============================================================================
  22. CONTENTS *startify-contents*
  23. INTRO .......................................... |startify-intro|
  24. USAGE .......................................... |startify-usage|
  25. OPTIONS ........................................ |startify-options|
  26. AUTOCMD ........................................ |startify-autocmd|
  27. COMMANDS ....................................... |startify-commands|
  28. MAPPINGS ....................................... |startify-mappings|
  29. COLORS ......................................... |startify-colors|
  30. MISC ........................................... |startify-misc|
  31. FAQ ............................................ |startify-faq|
  32. EXAMPLE ........................................ |startify-example|
  33. ==============================================================================
  34. INTRO *startify-intro*
  35. Startify is a plugin that shows recently used files, bookmarks, commands and
  36. sessions that were saved to a certain directory.
  37. ==============================================================================
  38. USAGE *startify-usage*
  39. Startify basically provides two things:
  40. 1) If you start Vim without giving any filenames to it (or pipe stuff to it so
  41. it reads from STDIN), startify will show a small but pretty start screen
  42. that shows recently used files (using viminfo) and sessions by default.
  43. Additionally, you can define bookmarks (thus entries for files) and
  44. commands that always should be available on the start screen.
  45. You can either navigate to a certain menu entry and hit enter or you just
  46. key in whatever is written between the square brackets on that line. You
  47. can even double-click anywhere on the line now.
  48. In addition, 'e' creates an empty buffer, 'i' creates an empty buffer and
  49. jumps into insert mode, 'q' quits.
  50. Moreover, you can open several files at one go. Navigate to an entry and
  51. hit either 'b' (open in same window), 's' (open in split), 'v' (open in
  52. vertical split) or 't' (open in tab). You can do that for multiple entries.
  53. You can also mix them. The order of the selections will be remembered.
  54. Afterwards execute these actions via <cr>.
  55. When the selection is finished, Startify will close automatically. You can
  56. reopen the screen via :Startify.
  57. And you can define your own custom ascii art header now!
  58. 2) The plugin eases the handling of loading and saving sessions by putting
  59. sessions in a central directory.
  60. :SLoad load a session |startify-:SLoad|
  61. :SSave[!] save a session |startify-:SSave|
  62. :SDelete[!] delete a session |startify-:SDelete|
  63. :SClose close a session |startify-:SClose|
  64. If ! is given, you won't get prompted.
  65. It also supports session persistence, so once a session is loaded, it gets
  66. saved automatically when Vim is quit: |g:startify_session_persistence|
  67. ==============================================================================
  68. OPTIONS *startify-options*
  69. Put these variables into your vimrc. The shown assignments are also the
  70. default values.
  71. Most used options:~
  72. |g:startify_bookmarks|
  73. |g:startify_change_to_dir|
  74. |g:startify_change_to_vcs_root|
  75. |g:startify_custom_header|
  76. |g:startify_enable_special|
  77. |g:startify_list_order|
  78. |g:startify_lists|
  79. |g:startify_skiplist|
  80. |g:startify_update_oldfiles|
  81. Misc options:~
  82. |g:startify_commands|
  83. |g:startify_custom_footer|
  84. |g:startify_custom_header_quotes|
  85. |g:startify_custom_indices|
  86. |g:startify_disable_at_vimenter|
  87. |g:startify_enable_unsafe|
  88. |g:startify_files_number|
  89. |g:startify_fortune_use_unicode|
  90. |g:startify_padding_left|
  91. |g:startify_relative_path|
  92. |g:startify_skiplist_server|
  93. |g:startify_use_env|
  94. Sessions:~
  95. |g:startify_session_autoload|
  96. |g:startify_session_before_save|
  97. |g:startify_session_delete_buffers|
  98. |g:startify_session_dir|
  99. |g:startify_session_number|
  100. |g:startify_session_persistence|
  101. |g:startify_session_remove_lines|
  102. |g:startify_session_savecmds|
  103. |g:startify_session_savevars|
  104. |g:startify_session_sort|
  105. ------------------------------------------------------------------------------
  106. *g:startify_session_dir*
  107. >
  108. let g:startify_session_dir = '~/.vim/session'
  109. <
  110. The directory to save/load sessions to/from.
  111. The default for Windows systems is '$HOME\vimfiles\session'.
  112. ------------------------------------------------------------------------------
  113. *g:startify_list_order*
  114. This option is DEPRECATED in favor of |g:startify_lists|.
  115. ------------------------------------------------------------------------------
  116. *g:startify_lists*
  117. >
  118. let g:startify_lists = [
  119. \ { 'type': 'files', 'header': [' MRU'] },
  120. \ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
  121. \ { 'type': 'sessions', 'header': [' Sessions'] },
  122. \ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
  123. \ { 'type': 'commands', 'header': [' Commands'] },
  124. \ ]
  125. <
  126. Startify displays lists. Each list consists of a `type` and optionally a `header`
  127. and custom `indices`.
  128. The 'type' is either a string of a built-in type or a |Funcref|.
  129. The 'header' is a list of strings, whereas each string will be put on its own
  130. line in the header.
  131. The 'indices' is a list of strings, which act as indices for the current list.
  132. Opposed to the global |g:startify_custom_indices|, this is limited to the
  133. current list.
  134. Built-in types:~
  135. 'files'
  136. This lists the most recently used files using viminfo. The number of files
  137. is limited by |g:startify_files_number|.
  138. 'dir'
  139. This lists the files from the current directory sorted by modification
  140. time. The number of files is limited by |g:startify_files_number|.
  141. 'bookmarks'
  142. This lists bookmarks, thus hardcoded files or directories that will always
  143. be shown. Have a look at |g:startify_bookmarks|.
  144. 'sessions'
  145. This lists all the sessions saved in the directory |g:startify_session_dir|.
  146. 'commands'
  147. This lists commands defined in |g:startify_commands|.
  148. Funcref type:~
  149. The referenced function must return a list of dictionaries. Each dictionary
  150. is an entry that consists of these keys:
  151. 'line' The text to display for this entry. (required)
  152. 'cmd' The Vim command to execute when the entry gets chosen.
  153. (required unless 'path' is given)
  154. 'path' Points to a file. This way you can even use the standard markers
  155. like `s` or `v` etc. to open multiple entries at once.
  156. (required unless 'cmd' is given)
  157. Example #1:~
  158. >
  159. function s:foobar()
  160. return [
  161. \ { 'line': 'foo', 'cmd': 'echo "FOO!"' },
  162. \ { 'line': 'bar', 'cmd': 'echo "BAR!"' },
  163. \ ]
  164. endfunction
  165. let g:startify_lists = [
  166. \ { 'type': 'files', 'header': [' MRU:'] },
  167. \ { 'type': function('s:foobar'), 'header': ['foo', ' and', ' bar'] },
  168. \ ]
  169. <
  170. Example #2:~
  171. This more practical example assumes a git repo at ~/repo and vim-fugitive
  172. installed (for `:Git`).
  173. >
  174. function! s:list_commits()
  175. let git = 'git -C ~/repo'
  176. let commits = systemlist(git .' log --oneline | head -n10')
  177. let git = 'G'. git[1:]
  178. return map(commits, '{"line": matchstr(v:val, "\\s\\zs.*"), "cmd": "'. git .' show ". matchstr(v:val, "^\\x\\+") }')
  179. endfunction
  180. let g:startify_lists = [
  181. \ { 'header': [' MRU'], 'type': 'files' },
  182. \ { 'header': [' MRU '. getcwd()], 'type': 'dir' },
  183. \ { 'header': [' Sessions'], 'type': 'sessions' },
  184. \ { 'header': [' Commits'], 'type': function('s:list_commits') },
  185. \ ]
  186. <
  187. NOTE: Headers are context-senstive: If the list for a type is empty, the
  188. header won't be shown.
  189. NOTE: Headers use the StartifySection highlight group. See |startify-colors|.
  190. ------------------------------------------------------------------------------
  191. *g:startify_bookmarks*
  192. >
  193. let g:startify_bookmarks = []
  194. <
  195. A list of files or directories to bookmark. The list can contain two kinds of
  196. types. Either a path or a dictionary whereas the key is the custom index and
  197. the value the path.
  198. Example:
  199. >
  200. let g:startify_bookmarks = [ {'c': '~/.vimrc'}, '~/.zshrc' ]
  201. <
  202. NOTE: Avoid using keys from |startify-mappings| if providing custom indices.
  203. ------------------------------------------------------------------------------
  204. *g:startify_commands*
  205. >
  206. let g:startify_commands = []
  207. <
  208. A list of commands to execute on selection. Leading colons are optional. It
  209. supports optional custom indices and/or command descriptions.
  210. Example:
  211. >
  212. let g:startify_commands = [
  213. \ ':help reference',
  214. \ ['Vim Reference', 'h ref'],
  215. \ {'h': 'h ref'},
  216. \ {'m': ['My magical function', 'call Magic()']},
  217. \ ]
  218. <
  219. NOTE: Avoid using keys from |startify-mappings| if providing custom indices.
  220. ------------------------------------------------------------------------------
  221. *g:startify_files_number*
  222. >
  223. let g:startify_files_number = 10
  224. <
  225. The number of files to list.
  226. ------------------------------------------------------------------------------
  227. *g:startify_update_oldfiles*
  228. >
  229. let g:startify_update_oldfiles = 0
  230. <
  231. Usually |v:oldfiles| only gets updated when Vim exits. Using this option updates
  232. it on-the-fly, so that :Startify is always up-to-date.
  233. ------------------------------------------------------------------------------
  234. *g:startify_session_autoload*
  235. >
  236. let g:startify_session_autoload = 0
  237. <
  238. If this option is enabled and you start Vim in a directory that contains a
  239. `Session.vim`, that session will be loaded automatically. Otherwise it will be
  240. shown as the top entry in the Startify buffer.
  241. The same happens when you |:cd| to a directory that contains a `Session.vim`
  242. and execute |:Startify|.
  243. It also works if you open a bookmarked directory. See |g:startify_bookmarks|.
  244. This is great way to create a portable project folder!
  245. NOTE: This option is affected by |g:startify_session_delete_buffers|.
  246. ------------------------------------------------------------------------------
  247. *g:startify_session_before_save*
  248. >
  249. let g:startify_session_before_save = []
  250. <
  251. This is a list of commands to be executed before saving a session.
  252. Example:
  253. >
  254. let g:startify_session_before_save = [
  255. \ 'echo "Cleaning up before saving.."',
  256. \ 'silent! NERDTreeTabsClose'
  257. \ ]
  258. <
  259. ------------------------------------------------------------------------------
  260. *g:startify_session_persistence*
  261. >
  262. let g:startify_session_persistence = 0
  263. <
  264. Automatically update sessions in two cases:
  265. - Before leaving Vim
  266. - Before loading a new session via :SLoad
  267. This also works for sessions started with:
  268. >
  269. vim -S mysession.vim
  270. <
  271. ------------------------------------------------------------------------------
  272. *g:startify_session_delete_buffers*
  273. >
  274. let g:startify_session_delete_buffers = 1
  275. <
  276. Delete all buffers when loading or closing a session:
  277. - When using |startify-:SLoad|.
  278. - When using |startify-:SClose|.
  279. - When using |g:startify_session_autoload|.
  280. - When choosing a session from the Startify buffer.
  281. NOTE: Buffers with unsaved changes are silently ignored.
  282. ------------------------------------------------------------------------------
  283. *g:startify_change_to_dir*
  284. >
  285. let g:startify_change_to_dir = 1
  286. <
  287. When opening a file or bookmark, change to its directory.
  288. ------------------------------------------------------------------------------
  289. *g:startify_change_to_vcs_root*
  290. >
  291. let g:startify_change_to_vcs_root = 0
  292. <
  293. When opening a file or bookmark, seek and change to the root directory of the
  294. VCS (if there is one).
  295. At the moment only git, hg, bzr and svn are supported.
  296. ------------------------------------------------------------------------------
  297. *g:startify_skiplist*
  298. >
  299. let g:startify_skiplist = [
  300. \ 'COMMIT_EDITMSG',
  301. \ escape(fnamemodify(resolve($VIMRUNTIME), ':p'), '\') .'doc',
  302. \ 'bundle/.*/doc',
  303. \ ]
  304. <
  305. A list of Vim regular expressions that is used to filter recently used files.
  306. See |pattern.txt| for what patterns can be used.
  307. NOTE: Due to the nature of patterns, you can't just use "~/mysecret" but have
  308. to use "$HOME .'/mysecret.txt'". The former would do something entirely
  309. different: |/\~|. When using backslashes as path separators, escape them.
  310. Otherwise using "C:\this\vim\path\is\problematic" would not match what you
  311. expect, since |/\v| is a pattern, too.
  312. Example:
  313. >
  314. let g:startify_skiplist = [
  315. \ '\.vimgolf',
  316. \ '^/tmp',
  317. \ '/project/.*/documentation',
  318. \ escape(fnamemodify($HOME, ':p'), '\') .'mysecret.txt',
  319. \ ]
  320. <
  321. ------------------------------------------------------------------------------
  322. *g:startify_fortune_use_unicode*
  323. >
  324. let g:startify_fortune_use_unicode = 0
  325. <
  326. By default, the fortune header uses ASCII characters, because they work for
  327. everyone. If you set this option to 1 and your 'encoding' is "utf-8", Unicode
  328. box-drawing characters will be used instead.
  329. This is not the default, because users of East Asian languages often set
  330. 'ambiwidth' to "double" or make their terminal emulator treat characters of
  331. ambiguous width as double width. Both would make the drawed box look funny.
  332. For more information: http://unicode.org/reports/tr11
  333. ------------------------------------------------------------------------------
  334. *g:startify_padding_left*
  335. >
  336. let g:startify_padding_left = 3
  337. <
  338. The number of spaces used for left padding.
  339. ------------------------------------------------------------------------------
  340. *g:startify_skiplist_server*
  341. >
  342. let g:startify_skiplist_server = []
  343. <
  344. Do not create the startify buffer, if this is a Vim server instance with a
  345. name contained in this list.
  346. Example:
  347. >
  348. let g:startify_skiplist_server = [ 'GVIM' ]
  349. <
  350. ------------------------------------------------------------------------------
  351. *g:startify_enable_special*
  352. >
  353. let g:startify_enable_special = 1
  354. <
  355. Show <empty buffer> and <quit>.
  356. ------------------------------------------------------------------------------
  357. *g:startify_enable_unsafe*
  358. >
  359. let g:startify_enable_unsafe = 0
  360. <
  361. Enable the option only in case you think Vim starts too slowly (because of
  362. :Startify) or if you often edit files on remote filesystems.
  363. It's called unsafe because it improves the time :Startify needs to execute by
  364. reducing the amount of syscalls to the underlying operating system, but
  365. sacrifices the precision of shown entries.
  366. This could lead to inconsistences in the shown :Startify entries (e.g. the
  367. same file could be shown twice, because one time file was opened via absolute
  368. path and another time via symlink).
  369. Currently this option does this:
  370. - don't resolves symlinks (readlink(2))
  371. - don't check every file if it's readable (stat(2))
  372. - don't filter through the bookmark list
  373. ------------------------------------------------------------------------------
  374. *g:startify_session_remove_lines*
  375. >
  376. let g:startify_session_remove_lines = []
  377. <
  378. Lines matching any of the patterns in this list, will be removed from the
  379. session file.
  380. Example:
  381. >
  382. let g:startify_session_remove_lines = ['setlocal', 'winheight']
  383. <
  384. Internally this simply does:
  385. >
  386. :global/setlocal/delete
  387. :global/winheight/delete
  388. <
  389. So you can use any |pattern|.
  390. NOTE: Take care not to mess up any expressions within the session file,
  391. otherwise you'll probably get problems when trying to load it.
  392. ------------------------------------------------------------------------------
  393. *g:startify_session_savevars*
  394. >
  395. let g:startify_session_savevars = []
  396. <
  397. Include a list of variables in here which you would like Startify to save into
  398. the session file in addition to what Vim normally saves into the session file.
  399. For example, Vim will not normally save all-lowercase global variables, which
  400. are common for plugin settings. It may be advisable to include
  401. |g:startify_session_savevars| and |g:startify_session_savecmds| into this list
  402. so they are saved every time the session saves.
  403. Example:
  404. >
  405. let g:startify_session_savevars = [
  406. \ 'g:startify_session_savevars',
  407. \ 'g:startify_session_savecmds',
  408. \ 'g:random_plugin_use_feature'
  409. \ ]
  410. <
  411. ------------------------------------------------------------------------------
  412. *g:startify_session_savecmds*
  413. >
  414. let g:startify_session_savecmds = []
  415. <
  416. Include a list of cmdline commands which Vim will run upon loading the
  417. session. This can be useful to set various things (other than variables,
  418. |g:startify_session_savevars| above) which Vim may not normally save into the
  419. session file, as well as run external commands upon loading a session.
  420. Example:
  421. >
  422. let g:startify_session_savecmds = [
  423. \ 'silent !pdfreader ~/latexproject/main.pdf &'
  424. \ ]
  425. <
  426. ------------------------------------------------------------------------------
  427. *g:startify_session_number*
  428. >
  429. let g:startify_session_number = 999
  430. <
  431. The maximum number of sessions to display. Makes the most sense together with
  432. |g:startify_session_sort|.
  433. ------------------------------------------------------------------------------
  434. *g:startify_session_sort*
  435. >
  436. let g:startify_session_sort = 0
  437. <
  438. Sort sessions by modification time (when the session files were written)
  439. rather than alphabetically.
  440. ------------------------------------------------------------------------------
  441. *g:startify_custom_indices*
  442. >
  443. let g:startify_custom_indices = []
  444. <
  445. Use any list of strings as indices instead of increasing numbers. If there are
  446. more startify entries than actual items in the custom list, the remaining
  447. entries will be filled using the default numbering scheme starting from 0.
  448. Thus you can create your own indexing scheme that fits your keyboard layout.
  449. You don't want to leave the home row, do you?!
  450. Example:
  451. >
  452. let g:startify_custom_indices = ['f', 'g', 'h']
  453. <
  454. This would result in:
  455. [f] /most/recently/used/file1
  456. [g] /most/recently/used/file2
  457. [h] /most/recently/used/file3
  458. [0] /most/recently/used/file4
  459. [1] /most/recently/used/file5
  460. [2] /most/recently/used/file6
  461. etc.
  462. If you want numbers to start at 1 instead of 0, you could use this:
  463. >
  464. let g:startify_custom_indices = map(range(1,100), 'string(v:val)')
  465. <
  466. NOTE: There is no sanitizing going on, so you should know what you're doing!
  467. Avoid using keys from |startify-mappings|.
  468. ------------------------------------------------------------------------------
  469. *g:startify_custom_header*
  470. >
  471. let g:startify_custom_header = 'startify#fortune#cowsay()'
  472. <
  473. Define your own header.
  474. This option takes a `list of strings`, whereas each string will be put on its
  475. own line. If it is a simple `string`, it should evaluate to a list of strings.
  476. Helper functions:~
  477. startify#fortune#quote() random quote
  478. startify#fortune#boxed(...) random quote in a box
  479. startify#fortune#cowsay(...) random quote in a box + cow
  480. The last two functions optionally take a quote in the list of strings format.
  481. They also return a list of strings, suitable for this option.
  482. Example #1:~
  483. >
  484. let g:startify_custom_header = [
  485. \ ' ________ __ __ ',
  486. \ ' __ /\_____ \/\ \\ \ ',
  487. \ ' __ __ /\_\ ___ ___ \/___//''/''\ \ \\ \ ',
  488. \ ' /\ \/\ \\/\ \ /'' __` __`\ /'' /'' \ \ \\ \_ ',
  489. \ ' \ \ \_/ |\ \ \/\ \/\ \/\ \ /'' /''__ \ \__ ,__\',
  490. \ ' \ \___/ \ \_\ \_\ \_\ \_\ /\_/ /\_\ \/_/\_\_/ ',
  491. \ ' \/__/ \/_/\/_/\/_/\/_/ \// \/_/ \/_/ ',
  492. \ ]
  493. <
  494. Example #2:~
  495. >
  496. let g:startify_custom_header =
  497. \ map(split(system('fortune | cowsay'), '\n'), '" ". v:val')
  498. <
  499. Example #3:~
  500. Let's assume you like the default boxed random quote, but not the ASCII art
  501. cow. You'd rather have another small ASCII art come before the quote. No
  502. problem!
  503. >
  504. let g:ascii = [
  505. \ ' __',
  506. \ '.--.--.|__|.--------.',
  507. \ '| | || || |',
  508. \ ' \___/ |__||__|__|__|',
  509. \ ''
  510. \]
  511. let g:startify_custom_header = g:ascii + startify#fortune#boxed()
  512. <
  513. Looks great! But it's not on the same column as the indices below which makes
  514. it look awkward. Let's indent the header by 3 spaces:
  515. >
  516. let g:startify_custom_header =
  517. \ map(g:ascii + startify#fortune#boxed(), '" ".v:val')
  518. <
  519. Ah, much better! There's only one issue left. If you set
  520. g:startify_custom_header this way, it will only be done once. Hence spamming
  521. :Startify will always show the same quote.
  522. If you provide a string to it instead, Startify will evaluate it every time
  523. :Startify is run:
  524. >
  525. let g:startify_custom_header =
  526. \ 'map(g:ascii + startify#fortune#boxed(), "\" \".v:val")'
  527. <
  528. Happy customizing!
  529. Also have a look at |startify-faq-08|.
  530. ------------------------------------------------------------------------------
  531. *g:startify_custom_header_quotes*
  532. If you don't set |g:startify_custom_header|, the internal cowsay implementation
  533. with predefined random quotes will be used.
  534. To use your own quotes, set this option to a list of quotes. Each quote is
  535. either another list or a |Funcref| (see |expr-lambda|) that returns a list.
  536. Each element of the inner lists is put on an own line in the custom header.
  537. >
  538. let g:startify_custom_header_quotes = [
  539. \ ['quote #1'],
  540. \ ['quote #2', 'using', 'three lines'],
  541. \ {-> systemlist('echo quote #3')}
  542. \ ]
  543. <
  544. If you want the predefined quotes as well, use this:
  545. >
  546. let g:startify_custom_header_quotes =
  547. \ startify#fortune#predefined_quotes() + [['quote 1', 'quote 2']]
  548. <
  549. ------------------------------------------------------------------------------
  550. *g:startify_custom_footer*
  551. >
  552. let g:startify_custom_footer = ''
  553. <
  554. Same as the custom header, but shown at the bottom of the startify buffer.
  555. ------------------------------------------------------------------------------
  556. *g:startify_disable_at_vimenter*
  557. >
  558. let g:startify_disable_at_vimenter = 0
  559. <
  560. Don't run Startify at Vim startup. You can still call it anytime via
  561. :Startify.
  562. -----------------------------------------------------------------------------
  563. *g:startify_relative_path*
  564. >
  565. let g:startify_relative_path = 0
  566. <
  567. If the file is in or below the current working directory, use a relative path.
  568. Otherwise an absolute path is used. The latter prevents hard to grasp entries
  569. like `../../../../../foo`.
  570. NOTE: This only applies to the "files" list, since the "dir" list is
  571. relative by nature.
  572. -----------------------------------------------------------------------------
  573. *g:startify_use_env*
  574. >
  575. let g:startify_use_env = 0
  576. <
  577. Show environment variables in path, if their name is shorter than their value.
  578. See |startify-colors| for highlighting them.
  579. $PWD and $OLDPWD are ignored.
  580. ==============================================================================
  581. AUTOCMD *startify-autocmd*
  582. In certain situations Startify emits events which can be hooked into via
  583. |autocmd|s. Those can be used for further customization.
  584. StartifyReady~
  585. When the Startify buffer is ready.
  586. StartifyBufferOpened~
  587. For each buffer that got opened by Startify. When you open multiple files at
  588. once (see |startify-usage|), this event fires multiple times as well.
  589. StartifyAllBuffersOpened~
  590. No matter how many buffers you open, this event fires only once after the
  591. last buffer was opened.
  592. Example:
  593. >
  594. autocmd User StartifyReady let &l:stl = ' This statusline rocks!'
  595. <
  596. Or use it to disable single mappings: |startify-faq-16|.
  597. NOTE: Autocmds don't nest by default. If you use any command that triggers new
  598. events, be sure to add "nested": |autocmd-nested|.
  599. ==============================================================================
  600. COMMANDS *startify-commands*
  601. *startify-:Startify*
  602. >
  603. :Startify
  604. <
  605. Open the startify buffer.
  606. *startify-:SSave*
  607. *startify-:SDelete*
  608. >
  609. :SSave[!] [session]
  610. :SDelete[!] [session]
  611. <
  612. Save or delete a session. If you don't specify a session name, it will prompt
  613. you for one.
  614. Use `:SSave!` or `:SDelete!` to always overwrite or delete an existing session.
  615. *startify-:SLoad*
  616. >
  617. :SLoad [session]
  618. <
  619. Load a session. If you don't specify a session name, it will either prompt you
  620. for one (Windows) or load the last used session (Unix).
  621. Providing only a part of the session name works too, if you complete the
  622. argument with either <c-d> or <tab> afterwards.
  623. NOTE: This command is affected by |g:startify_session_delete_buffers|.
  624. *startify-:SClose*
  625. >
  626. :SClose
  627. <
  628. Save and close the current session, close all listed buffers, and open the
  629. Startify buffer.
  630. NOTE: This command is affected by |g:startify_session_delete_buffers|.
  631. ==============================================================================
  632. MAPPINGS *startify-mappings*
  633. Some things are remapped in the startify buffer..
  634. >
  635. q
  636. <
  637. Close startify. Also quit Vim if it is the only buffer.
  638. >
  639. e
  640. <
  641. Close startify and create a blank buffer.
  642. >
  643. i
  644. <insert>
  645. <
  646. Close startify, create a blank buffer and jump into insert mode right away.
  647. >
  648. <2-LeftMouse>
  649. <
  650. Use a simple mouse click to open the targeted entry.
  651. >
  652. [any number that is shown between square brackets]
  653. <
  654. Open the entry with the given number.
  655. >
  656. b
  657. s
  658. v
  659. t
  660. <
  661. Mark current entry to be opened in either the same window, in a split window,
  662. in a vertical split window or in a new tab.
  663. >
  664. <cr>
  665. <
  666. Open all marked entries. If nothing was marked beforehand, just open the
  667. current entry.
  668. If you want to use another key instead of <cr>, put this in your vimrc:
  669. >
  670. autocmd User Startified nmap <buffer> o <plug>(startify-open-buffers)
  671. <
  672. ==============================================================================
  673. COLORS *startify-colors*
  674. You can overwrite the highlight groups used by startify. The plugin defines
  675. these groups:
  676. Highlight group | Description | Default
  677. ------------------------------------------------------------------
  678. | |
  679. StartifyBracket | [,] | linked to Delimiter
  680. StartifyFile | the actual file | linked to Identifier
  681. StartifyFooter | the custom footer | linked to Title
  682. StartifyHeader | the custom header | linked to Title
  683. StartifyNumber | the numbers between [] | linked to Number
  684. StartifyPath | the path to a file | linked to Directory
  685. StartifySection | section headers | linked to Statement
  686. StartifySelect | selected entries | linked to Title
  687. StartifySlash | slashes in paths | linked to Delimiter
  688. StartifySpecial | <empty buffer>,<quit> | linked to Comment
  689. StartifyVar | environment variables | linked to StartifyPath
  690. Example: (my terminal emulator supports 256 colors)
  691. >
  692. highlight StartifyBracket ctermfg=240
  693. highlight StartifyFooter ctermfg=240
  694. highlight StartifyHeader ctermfg=114
  695. highlight StartifyNumber ctermfg=215
  696. highlight StartifyPath ctermfg=245
  697. highlight StartifySlash ctermfg=240
  698. highlight StartifySpecial ctermfg=240
  699. <
  700. ==============================================================================
  701. MISC *startify-misc*
  702. Changing the entry format:~
  703. You can create a function `StartifyEntryFormat()` which returns a string that
  704. gets evaluated in Startify. In that string, `entry_path` and `absolute_path`
  705. will be replaced by their respective values.
  706. `absolute_path` is self-explaining and `entry_path` is the same path but
  707. potentially shortened, depending on options like |g:startify_relative_path|.
  708. Let us assume you have vim-devicons installed. That plugin has a function
  709. `WebDevIconsGetFileTypeSymbol()` which returns an icon depending on the given
  710. file. Prepend the logo to each Startify entry by putting this in your vimrc:
  711. >
  712. function! StartifyEntryFormat()
  713. return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path'
  714. endfunction
  715. <
  716. ==============================================================================
  717. FAQ *startify-faq*
  718. |startify-faq-01| I don't want the start screen to use cursorline!
  719. |startify-faq-02| Recent files aren't shown!
  720. |startify-faq-03| I have broken colors when using sessions!
  721. |startify-faq-04| How to disable common but unimportant files?
  722. |startify-faq-05| Why is the Startify buffer not using buftype=nofile?
  723. |startify-faq-06| How do I get both NERDTree and Startify working at
  724. startup?
  725. |startify-faq-07| The session autoload feature is not working!
  726. |startify-faq-08| How do I center my header/footer?
  727. |startify-faq-09| tmux-resurrect?
  728. |startify-faq-10| Temporarily skip Startify at start?
  729. |startify-faq-11| How to use the output of a command as header?
  730. |startify-faq-12| There is an empty window with vim-plug!
  731. |startify-faq-13| How to disable random quotes header?
  732. |startify-faq-14| NERDTree with NERDTreeTabs does not work in gvim!
  733. |startify-faq-15| Startify is cluttered with help files!
  734. |startify-faq-16| How to disable single mappings?
  735. |startify-faq-17| Run Startify for each new tab!
  736. ------------------------------------------------------------------------------
  737. *startify-faq-01*
  738. I want to use cursorline!~
  739. Startify issues a User event when it's finished. It can be used to set
  740. buffer-local options etc.
  741. >
  742. autocmd User Startified setlocal cursorline
  743. <
  744. ------------------------------------------------------------------------------
  745. *startify-faq-02*
  746. Recent files aren't shown!~
  747. Perhaps the problem is that the viminfo file..
  748. - doesn't exist
  749. - is invalid
  750. - is empty
  751. - can't be read (check permissions)
  752. I suggest the following steps:
  753. 1) Create a new directory:
  754. >
  755. $ mkdir -p ~/.vim/files/info
  756. <
  757. 2) Put this into your vimrc:
  758. >
  759. set viminfo='100,n$HOME/.vim/files/info/viminfo
  760. <
  761. See |'viminfo'| for information about the second step and what it does
  762. exactly.
  763. ------------------------------------------------------------------------------
  764. *startify-faq-03*
  765. I have broken colors when using sessions!~
  766. Nothing this plugin could do about. Try playing around with 'sessionoptions'.
  767. NOTE: Startify removes 'options' from the session options automatically,
  768. because it's the source of many problems.
  769. Some people swear it works for them with these settings:
  770. >
  771. set sessionoptions=blank,curdir,folds,help,tabpages,winpos
  772. <
  773. ------------------------------------------------------------------------------
  774. *startify-faq-04*
  775. How to disable common but unimportant files?~
  776. Use |g:startify_skiplist|.
  777. ------------------------------------------------------------------------------
  778. *startify-faq-05*
  779. Why is the Startify buffer not using buftype=nofile?~
  780. Did you accidentally use |:write| in the Startify buffer and it was saved to
  781. an actual file on disk? It's because buftype=nofile is not used.
  782. This is done to improve compatibility with other plugins. When buftype=nofile
  783. was set, plugins like CtrlP or NERDTree would open splits instead of reusing
  784. the window showing the Startify buffer.
  785. If you understand this but want it anyway, put this in your vimrc:
  786. >
  787. autocmd User Startified setlocal buftype=nofile
  788. <
  789. ------------------------------------------------------------------------------
  790. *startify-faq-06*
  791. How do I get both NERDTree and Startify working at startup?~
  792. Put this in your vimrc:
  793. >
  794. autocmd VimEnter *
  795. \ if !argc()
  796. \ | Startify
  797. \ | NERDTree
  798. \ | wincmd w
  799. \ | endif
  800. <
  801. ------------------------------------------------------------------------------
  802. *startify-faq-07*
  803. The session autoload feature is not working!~
  804. Do you have NERDTree installed by any chance? If so, try this:
  805. >
  806. let NERDTreeHijackNetrw = 0
  807. <
  808. ------------------------------------------------------------------------------
  809. *startify-faq-08*
  810. How do I center my header/footer?~
  811. Try something along these lines:
  812. >
  813. function! s:filter_header(lines) abort
  814. let longest_line = max(map(copy(a:lines), 'strwidth(v:val)'))
  815. let centered_lines = map(copy(a:lines),
  816. \ 'repeat(" ", (&columns / 2) - (longest_line / 2)) . v:val')
  817. return centered_lines
  818. endfunction
  819. let g:startify_custom_header = s:filter_header(startify#fortune#cowsay())
  820. <
  821. ------------------------------------------------------------------------------
  822. *startify-faq-09*
  823. tmux-resurrect?~
  824. If you use tmux-resurrect to restore your tmux environment, you can use :SLoad
  825. to load your last used session right away:
  826. >
  827. set -g @resurrect-processes '"vim->vim +SLoad"'
  828. <
  829. ------------------------------------------------------------------------------
  830. *startify-faq-10*
  831. Temporarily skip Startify at start?~
  832. In some cases you might need to skip Startify at start. E.g.
  833. >
  834. vim +VimwikiMakeDiaryNote
  835. <
  836. Startify would interfere in this case. A simple way to avoid that would be:
  837. >
  838. vim --cmd 'let g:startify_disable_at_vimenter = 1' +VimwikiMakeDiaryNote
  839. <
  840. ------------------------------------------------------------------------------
  841. *startify-faq-11*
  842. How to use the output of a command as header?~
  843. >
  844. redir => test
  845. silent echo 'one'
  846. silent echo 'two'
  847. silent echo 'three'
  848. redir END
  849. let g:startify_custom_header =
  850. \ map(split(test), 'repeat(" ", 10) . v:val')
  851. <
  852. |:redir| puts a string into 'test'. Then we turn it into a list of strings.
  853. Then we shift each string to the right by 10 spaces. Afterwards we add an
  854. empty string to the list, which results in an empty line in the header.
  855. ------------------------------------------------------------------------------
  856. *startify-faq-12*
  857. There is an empty window with vim-plug!~
  858. After start there might be only the Startify buffer which is marked as
  859. |unlisted-buffer|. The problem arises if you use :PlugUpdate followed by 'D'
  860. to see the changes. An empty window!
  861. The actual problem is that Vim won't close the last listed buffer. Try this:
  862. >
  863. $ vim -u NONE -N
  864. :set nobuflisted
  865. :new
  866. :bd
  867. <
  868. It won't close the buffer and therefore the window. This also happens in
  869. vim-plug. Note that this is no bug in neither plugin, it's a Vim weirdness.
  870. Workaround #1:~
  871. >
  872. autocmd User Startified setlocal buflisted
  873. <
  874. In some cases this could break other plugins at start (I look at you
  875. NERDTree), but works well most of the time.
  876. Workaround #2:~
  877. >
  878. let g:plug_window = 'enew' " or maybe 'tabnew'
  879. <
  880. This will open the plug buffer in the current window instead of creating a new
  881. window on the left side. Mind that this will also close the Startify buffer
  882. since it will be hidden.
  883. ------------------------------------------------------------------------------
  884. *startify-faq-13*
  885. How to disable random quotes header?~
  886. >
  887. let g:startify_custom_header = []
  888. <
  889. See |g:startify_custom_header|.
  890. ------------------------------------------------------------------------------
  891. *startify-faq-14*
  892. NERDTree with NERDTreeTabs does not work in gvim!~
  893. Mind that `https://github.com/jistr/vim-nerdtree-tabs` is no longer maintained
  894. and has quite some issues.
  895. Anyway, this particular issue can be resolved in different ways. See:
  896. https://github.com/mhinz/vim-startify/issues/24
  897. ------------------------------------------------------------------------------
  898. *startify-faq-15*
  899. Startify is cluttered with help files!~
  900. Everytime you use |:h|, you open a file from the Vim runtime directory or of
  901. an installed plugin. By default, Startify detects these files and skips them.
  902. This works for most use cases, but not for all.
  903. If the default fails for you and the Startify buffer is cluttered with help
  904. files, add that path to the skiplist yourself: |g:startify_skiplist|.
  905. ------------------------------------------------------------------------------
  906. *startify-faq-16*
  907. How to disable single mappings?~
  908. Use |startify-autocmd|:
  909. >
  910. autocmd User Startified for key in ['b','s','t','v'] |
  911. \ execute 'nunmap <buffer>' key | endfor
  912. <
  913. ------------------------------------------------------------------------------
  914. *startify-faq-17*
  915. Run Startify for each new tab!~
  916. >
  917. if has('nvim')
  918. autocmd TabNewEntered * Startify
  919. else
  920. autocmd VimEnter * let t:startify_new_tab = 1
  921. autocmd BufEnter *
  922. \ if !exists('t:startify_new_tab') && empty(expand('%')) |
  923. \ let t:startify_new_tab = 1 |
  924. \ Startify |
  925. \ endif
  926. endif
  927. <
  928. ==============================================================================
  929. EXAMPLE *startify-example*
  930. >
  931. autocmd User Startified setlocal cursorline
  932. let g:startify_enable_special = 0
  933. let g:startify_files_number = 8
  934. let g:startify_relative_path = 1
  935. let g:startify_change_to_dir = 1
  936. let g:startify_update_oldfiles = 1
  937. let g:startify_session_autoload = 1
  938. let g:startify_session_persistence = 1
  939. let g:startify_skiplist = [
  940. \ 'COMMIT_EDITMSG',
  941. \ 'bundle/.*/doc',
  942. \ '/data/repo/neovim/runtime/doc',
  943. \ '/Users/mhi/local/vim/share/vim/vim74/doc',
  944. \ ]
  945. let g:startify_bookmarks = [
  946. \ { 'c': '~/.vim/vimrc' },
  947. \ '~/golfing',
  948. \ ]
  949. let g:startify_custom_header =
  950. \ startify#fortune#cowsay('', '═','║','╔','╗','╝','╚')
  951. let g:startify_custom_footer =
  952. \ ['', " Vim is charityware. Please read ':help uganda'.", '']
  953. hi StartifyBracket ctermfg=240
  954. hi StartifyFile ctermfg=147
  955. hi StartifyFooter ctermfg=240
  956. hi StartifyHeader ctermfg=114
  957. hi StartifyNumber ctermfg=215
  958. hi StartifyPath ctermfg=245
  959. hi StartifySlash ctermfg=240
  960. hi StartifySpecial ctermfg=240
  961. <
  962. ==============================================================================
  963. vim: tw=78