startify.txt 42 KB

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