├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── autoload ├── startify.vim └── startify │ └── fortune.vim ├── doc └── startify.txt ├── images ├── startify-logo.png └── startify-menu.png ├── plugin └── startify.vim ├── syntax └── startify.vim └── test ├── feature ├── buffer.vader ├── mapping.vader └── session.vader ├── include └── testfile.txt ├── run ├── session └── .gitkeep ├── viminfo └── vimrc /.gitignore: -------------------------------------------------------------------------------- 1 | doc/tags 2 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: 2 | - linux 3 | - osx 4 | 5 | addons: 6 | apt: 7 | packages: 8 | - vim-gtk 9 | 10 | script: 11 | - test/run 12 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | CONTRIBUTING 2 | ============ 3 | 4 | If you intend to contribute to this project, please keep some simple rules in 5 | mind: 6 | 7 | - one commit per feature/fix 8 | - the short commit message shouldn't be longer than 50 characters 9 | - the short commit message should start with an uppercase character 10 | - use the imperative for the short commit message 11 | - don't finish the short commit message with a '.' 12 | - don't use github-specific syntax to close an issue (I'll do that, when 13 | merging into master) 14 | - it's always a good idea to have a look at 'git log' to get an idea how to 15 | format one's own commits 16 | - if you have questions about a certain patch or feature requests, just open 17 | a Github issue 18 | 19 | Examples 20 | -------- 21 | 22 | ``` 23 | Bad: "fixed loop to start from 0 instead of 1" 24 | Good: "Avoid off-by-one issue in skiplist loop" 25 | 26 | Bad: "fixed typo" 27 | Good: "Docs: typo" 28 | ``` 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Marco Hinz 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/mhinz/vim-startify.svg?branch=master)](https://travis-ci.org/mhinz/vim-startify) 2 | 3 | ![vim-startify](https://raw.githubusercontent.com/mhinz/vim-startify/master/images/startify-logo.png) 4 | 5 | --- 6 | 7 | This plugin provides a start screen for Vim and Neovim. 8 | 9 | It provides **dynamically created headers or footers** and uses configurable 10 | lists to show **recently used or bookmarked files** and **persistent sessions**. 11 | All of this can be accessed in a **simple to use menu** that even allows to 12 | **open multiple entries** at once. 13 | 14 | Startify doesn't get in your way and works out-of-the-box, but provides many 15 | options for fine-grained customization. 16 | 17 | --- 18 | 19 | - [Installation & Documentation](#installation-and-documentation) 20 | - [Plugin features in detail](https://github.com/mhinz/vim-startify/wiki/Plugin-features-in-detail) 21 | - [Screenshot](#screenshot) 22 | - [Author & Feedback](#author-and-feedback) 23 | 24 | --- 25 | 26 | ## Installation and Documentation 27 | 28 | Use your favorite plugin manager. 29 | 30 | Using [vim-plug](https://github.com/junegunn/vim-plug): 31 | 32 | Plug 'mhinz/vim-startify' 33 | 34 | It works without any configuration, but you might want to look into the 35 | documentation for further customization: 36 | 37 | :h startify 38 | :h startify-faq 39 | 40 | If you want to share anything with your fellow plugin users, make sure to visit 41 | the [wiki](https://github.com/mhinz/vim-startify/wiki). 42 | 43 | ## Screenshot 44 | 45 | ![Startify in action!](https://github.com/mhinz/vim-startify/blob/master/images/startify-menu.png) 46 | 47 | That's it. A fancy start screen for Vim. 48 | 49 | _(Almost all visible features enabled. Colorscheme: 50 | [vim-janah](https://github.com/mhinz/vim-janah).)_ 51 | 52 | ## Author and Feedback 53 | 54 | If you like my plugins, please star them on Github. It's a great way of getting 55 | feedback. Same goes for issues reports or feature requests. 56 | -------------------------------------------------------------------------------- /autoload/startify.vim: -------------------------------------------------------------------------------- 1 | " vim: et sw=2 sts=2 2 | 3 | " Plugin: https://github.com/mhinz/vim-startify 4 | " Description: A fancy start screen for Vim. 5 | " Maintainer: Marco Hinz 6 | 7 | if exists('g:autoloaded_startify') || &compatible 8 | finish 9 | endif 10 | let g:autoloaded_startify = 1 11 | 12 | " Function: #get_lastline {{{1 13 | function! startify#get_lastline() abort 14 | return b:startify.lastline + 1 15 | endfunction 16 | 17 | " Function: #get_separator {{{1 18 | function! startify#get_separator() abort 19 | return !exists('+shellslash') || &shellslash ? '/' : '\' 20 | endfunction 21 | 22 | " Function: #get_session_path {{{1 23 | function! startify#get_session_path() abort 24 | if exists('g:startify_session_dir') 25 | let path = g:startify_session_dir 26 | elseif has('nvim') 27 | let path = has('nvim-0.3.1') 28 | \ ? stdpath('data').'/session' 29 | \ : has('win32') 30 | \ ? '~/AppData/Local/nvim-data/session' 31 | \ : '~/.local/share/nvim/session' 32 | else " Vim 33 | let path = has('win32') 34 | \ ? '~/vimfiles/session' 35 | \ : '~/.vim/session' 36 | endif 37 | 38 | return resolve(expand(path)) 39 | endfunction 40 | 41 | " Function: #insane_in_the_membrane {{{1 42 | function! startify#insane_in_the_membrane(on_vimenter) abort 43 | " Handle vim -y, vim -M. 44 | if a:on_vimenter && (&insertmode || !&modifiable) 45 | return 46 | endif 47 | 48 | if !&hidden && &modified 49 | call s:warn('Save your changes first.') 50 | return 51 | endif 52 | 53 | if !empty(v:servername) && exists('g:startify_skiplist_server') 54 | for servname in g:startify_skiplist_server 55 | if servname == v:servername 56 | return 57 | endif 58 | endfor 59 | endif 60 | 61 | if line2byte('$') != -1 62 | noautocmd enew 63 | endif 64 | 65 | silent! setlocal 66 | \ bufhidden=wipe 67 | \ colorcolumn= 68 | \ foldcolumn=0 69 | \ matchpairs= 70 | \ modifiable 71 | \ nobuflisted 72 | \ nocursorcolumn 73 | \ nocursorline 74 | \ nolist 75 | \ nonumber 76 | \ noreadonly 77 | \ norelativenumber 78 | \ nospell 79 | \ noswapfile 80 | \ signcolumn=no 81 | \ synmaxcol& 82 | if empty(&statusline) 83 | setlocal statusline=\ startify 84 | endif 85 | 86 | " Must be global so that it can be read by syntax/startify.vim. 87 | let g:startify_header = exists('g:startify_custom_header') 88 | \ ? s:set_custom_section(g:startify_custom_header) 89 | \ : (exists('*strwidth') ? startify#pad(startify#fortune#cowsay()) : []) 90 | if !empty(g:startify_header) 91 | let g:startify_header += [''] " add blank line 92 | endif 93 | call append('$', g:startify_header) 94 | 95 | let b:startify = { 96 | \ 'entries': {}, 97 | \ 'indices': [], 98 | \ 'leftmouse': 0, 99 | \ 'tick': 0, 100 | \ } 101 | 102 | if g:startify_enable_special 103 | call append('$', [s:leftpad .'[e] ', '']) 104 | endif 105 | call s:register(line('$')-1, 'e', 'special', 'enew', '') 106 | 107 | let b:startify.entry_number = 0 108 | if filereadable('Session.vim') 109 | call append('$', [s:leftpad .'[0] '. getcwd() . s:sep .'Session.vim', '']) 110 | call s:register(line('$')-1, '0', 'session', 111 | \ 'call startify#session_delete_buffers() | source', 'Session.vim') 112 | let b:startify.entry_number = 1 113 | let l:show_session = 1 114 | endif 115 | 116 | if empty(v:oldfiles) 117 | call s:warn("Can't read viminfo file. Read :help startify-faq-02") 118 | endif 119 | 120 | let b:startify.section_header_lines = [] 121 | 122 | let lists = s:get_lists() 123 | call s:show_lists(lists) 124 | 125 | silent $delete _ 126 | 127 | if g:startify_enable_special 128 | call append('$', ['', s:leftpad .'[q] ']) 129 | call s:register(line('$'), 'q', 'special', 'call s:close()', '') 130 | else 131 | " Don't overwrite the last regular entry, thus +1 132 | call s:register(line('$')+1, 'q', 'special', 'call s:close()', '') 133 | endif 134 | 135 | " compute first line offset 136 | let b:startify.firstline = 2 137 | let b:startify.firstline += len(g:startify_header) 138 | " no special, no local Session.vim, but a section header 139 | if !g:startify_enable_special && !exists('l:show_session') && has_key(lists[0], 'header') 140 | let b:startify.firstline += len(lists[0].header) + 1 141 | endif 142 | 143 | let b:startify.lastline = line('$') 144 | 145 | let footer = exists('g:startify_custom_footer') 146 | \ ? s:set_custom_section(g:startify_custom_footer) 147 | \ : [] 148 | if !empty(footer) 149 | let footer = [''] + footer 150 | endif 151 | call append('$', footer) 152 | 153 | setlocal nomodifiable nomodified 154 | 155 | call s:hide_endofbuffer_markers() 156 | 157 | call s:set_mappings() 158 | call cursor(b:startify.firstline, 5) 159 | autocmd startify CursorMoved call s:set_cursor() 160 | 161 | silent! %foldopen! 162 | normal! zb 163 | set filetype=startify 164 | 165 | if exists('##DirChanged') 166 | let b:startify.cwd = getcwd() 167 | autocmd startify DirChanged if getcwd() !=# get(get(b:, 'startify', {}), 'cwd') | Startify | endif 168 | endif 169 | if exists('#User#Startified') 170 | doautocmd User Startified 171 | endif 172 | if exists('#User#StartifyReady') 173 | doautocmd User StartifyReady 174 | endif 175 | endfunction 176 | 177 | " Function: #session_load {{{1 178 | function! startify#session_load(source_last_session, ...) abort 179 | if !isdirectory(s:session_dir) 180 | echomsg 'The session directory does not exist: '. s:session_dir 181 | return 182 | elseif empty(startify#session_list_as_string('')) 183 | echomsg 'There are no sessions...' 184 | return 185 | endif 186 | 187 | let session_path = s:session_dir . s:sep 188 | 189 | if a:0 190 | let session_path .= a:1 191 | elseif a:source_last_session && !has('win32') 192 | let session_path .= '__LAST__' 193 | else 194 | call inputsave() 195 | let session_path .= input( 196 | \ 'Load this session: ', 197 | \ fnamemodify(v:this_session, ':t'), 198 | \ 'custom,startify#session_list_as_string') | redraw 199 | call inputrestore() 200 | endif 201 | 202 | if filereadable(session_path) 203 | if get(g:, 'startify_session_persistence') && filewritable(v:this_session) 204 | call startify#session_write(fnameescape(v:this_session)) 205 | endif 206 | call startify#session_delete_buffers() 207 | execute 'source '. fnameescape(session_path) 208 | call s:create_last_session_link(session_path) 209 | else 210 | echo 'No such file: '. session_path 211 | endif 212 | endfunction 213 | 214 | " Function: #session_save {{{1 215 | function! startify#session_save(bang, ...) abort 216 | if !isdirectory(s:session_dir) 217 | if exists('*mkdir') 218 | echo 'The session directory does not exist: '. s:session_dir .'. Create it? [y/n]' 219 | if (nr2char(getchar()) == 'y') 220 | call mkdir(s:session_dir, 'p') 221 | else 222 | echo 223 | return 224 | endif 225 | else 226 | echo 'The session directory does not exist: '. s:session_dir 227 | return 228 | endif 229 | endif 230 | 231 | call inputsave() 232 | let this_session = fnamemodify(v:this_session, ':t') 233 | if this_session ==# '__LAST__' 234 | let this_session = '' 235 | endif 236 | let session_name = exists('a:1') 237 | \ ? a:1 238 | \ : input('Save under this session name: ', this_session, 'custom,startify#session_list_as_string') | redraw 239 | call inputrestore() 240 | 241 | if empty(session_name) 242 | echo 'You gave an empty name!' 243 | return 244 | endif 245 | 246 | let session_path = s:session_dir . s:sep . session_name 247 | if !filereadable(session_path) 248 | call startify#session_write(fnameescape(session_path)) 249 | echo 'Session saved under: '. session_path 250 | return 251 | endif 252 | 253 | echo 'Session already exists. Overwrite? [y/n]' | redraw 254 | if a:bang || nr2char(getchar()) == 'y' 255 | call startify#session_write(fnameescape(session_path)) 256 | echo 'Session saved under: '. session_path 257 | else 258 | echo 'Did NOT save the session!' 259 | endif 260 | endfunction 261 | 262 | " Function: #session_close {{{1 263 | function! startify#session_close() abort 264 | if exists('v:this_session') && filewritable(v:this_session) 265 | call startify#session_write(fnameescape(v:this_session)) 266 | let v:this_session = '' 267 | endif 268 | call startify#session_delete_buffers() 269 | Startify 270 | endfunction 271 | 272 | " Function: #session_write {{{1 273 | function! startify#session_write(session_path) 274 | " preserve existing variables from savevars 275 | if exists('g:startify_session_savevars') 276 | let savevars = map(filter(copy(g:startify_session_savevars), 'exists(v:val)'), '"let ". v:val ." = ". strtrans(string(eval(v:val)))') 277 | endif 278 | 279 | " if this function is called while being in the Startify buffer 280 | " (by loading another session or running :SSave/:SLoad directly) 281 | " switch back to the previous buffer before saving the session 282 | if &filetype == 'startify' 283 | let callingbuffer = bufnr('#') 284 | if callingbuffer > 0 285 | execute 'buffer' callingbuffer 286 | endif 287 | endif 288 | " prevent saving already deleted buffers that were in the arglist 289 | for arg in argv() 290 | if !buflisted(arg) 291 | execute 'silent! argdelete' fnameescape(arg) 292 | endif 293 | endfor 294 | " clean up session before saving it 295 | for cmd in get(g:, 'startify_session_before_save', []) 296 | execute cmd 297 | endfor 298 | 299 | let ssop = &sessionoptions 300 | set sessionoptions-=options 301 | try 302 | execute 'mksession!' a:session_path 303 | catch 304 | echohl ErrorMsg 305 | echomsg v:exception 306 | echohl NONE 307 | return 308 | finally 309 | let &sessionoptions = ssop 310 | endtry 311 | 312 | if exists('g:startify_session_remove_lines') 313 | \ || exists('g:startify_session_savevars') 314 | \ || exists('g:startify_session_savecmds') 315 | silent execute 'split' a:session_path 316 | 317 | " remove lines from the session file 318 | if exists('g:startify_session_remove_lines') 319 | for pattern in g:startify_session_remove_lines 320 | execute 'silent global/'. pattern .'/delete _' 321 | endfor 322 | endif 323 | 324 | " put variables from savevars into session file 325 | if exists('savevars') && !empty(savevars) 326 | call append(line('$')-3, savevars) 327 | endif 328 | 329 | " put commands from savecmds into session file 330 | if exists('g:startify_session_savecmds') 331 | call append(line('$')-3, g:startify_session_savecmds) 332 | endif 333 | 334 | setlocal bufhidden=delete 335 | silent update 336 | silent hide 337 | endif 338 | 339 | call s:create_last_session_link(a:session_path) 340 | endfunction 341 | 342 | " Function: #session_delete {{{1 343 | function! startify#session_delete(bang, ...) abort 344 | if !isdirectory(s:session_dir) 345 | echo 'The session directory does not exist: '. s:session_dir 346 | return 347 | elseif empty(startify#session_list_as_string('')) 348 | echo 'There are no sessions...' 349 | return 350 | endif 351 | 352 | call inputsave() 353 | let session_path = s:session_dir . s:sep . (exists('a:1') 354 | \ ? a:1 355 | \ : input('Delete this session: ', fnamemodify(v:this_session, ':t'), 'custom,startify#session_list_as_string')) 356 | call inputrestore() 357 | 358 | if !filereadable(session_path) 359 | redraw | echo 'No such session: '. session_path 360 | return 361 | endif 362 | 363 | redraw | echo 'Really delete '. session_path .'? [y/n]' | redraw 364 | if a:bang || nr2char(getchar()) == 'y' 365 | if delete(session_path) == 0 366 | echo 'Deleted session '. session_path .'!' 367 | else 368 | echo 'Deletion failed!' 369 | endif 370 | else 371 | echo 'Deletion aborted!' 372 | endif 373 | endfunction 374 | 375 | " Function: #session_delete_buffers {{{1 376 | function! startify#session_delete_buffers() 377 | if get(g:, 'startify_session_delete_buffers', 1) 378 | silent! %bdelete! 379 | endif 380 | endfunction 381 | 382 | " Function: #session_list {{{1 383 | function! startify#session_list(lead, ...) abort 384 | return filter(map(split(globpath(s:session_dir, '*'.a:lead.'*'), '\n'), 'fnamemodify(v:val, ":t")'), 'v:val !=# "__LAST__"') 385 | endfunction 386 | 387 | " Function: #session_list_as_string {{{1 388 | function! startify#session_list_as_string(lead, ...) abort 389 | return join(filter(map(split(globpath(s:session_dir, '*'.a:lead.'*'), '\n'), 'fnamemodify(v:val, ":t")'), 'v:val !=# "__LAST__"'), "\n") 390 | endfunction 391 | 392 | " Function: #debug {{{1 393 | function! startify#debug() 394 | if exists('b:startify.entries') 395 | for k in sort(keys(b:startify.entries)) 396 | echomsg '['. k .'] = '. string(b:startify.entries[k]) 397 | endfor 398 | else 399 | call s:warn('This is no Startify buffer!') 400 | endif 401 | endfunction 402 | 403 | " Function: #open_buffers {{{1 404 | function! startify#open_buffers(...) abort 405 | if exists('a:1') " used in mappings 406 | let entry = b:startify.entries[a:1] 407 | if !empty(s:batchmode) && entry.type == 'file' 408 | call startify#set_mark(s:batchmode, a:1) 409 | else 410 | call s:open_buffer(entry) 411 | endif 412 | return 413 | endif 414 | 415 | let marked = filter(copy(b:startify.entries), 'v:val.marked') 416 | if empty(marked) " open current entry 417 | call s:open_buffer(b:startify.entries[line('.')]) 418 | return 419 | endif 420 | 421 | enew 422 | setlocal nobuflisted 423 | 424 | " Open all marked entries. 425 | for entry in sort(values(marked), 's:sort_by_tick') 426 | call s:open_buffer(entry) 427 | endfor 428 | 429 | wincmd = 430 | 431 | if exists('#User#StartifyAllBuffersOpened') 432 | doautocmd User StartifyAllBuffersOpened 433 | endif 434 | endfunction 435 | 436 | " Function: #pad {{{1 437 | function! startify#pad(lines) abort 438 | return map(copy(a:lines), 's:leftpad . v:val') 439 | endfunction 440 | 441 | " Function: #center {{{1 442 | function! startify#center(lines) abort 443 | let longest_line = max(map(copy(a:lines), 'strwidth(v:val)')) 444 | return map(copy(a:lines), 445 | \ 'repeat(" ", (winwidth(0) / 2) - (longest_line / 2) - 1) . v:val') 446 | endfunction 447 | 448 | " Function: s:get_lists {{{1 449 | function! s:get_lists() abort 450 | if exists('g:startify_lists') 451 | return g:startify_lists 452 | elseif exists('g:startify_list_order') 453 | " Convert old g:startify_list_order format to newer g:startify_lists format. 454 | let lists = [] 455 | for item in g:startify_list_order 456 | if type(item) == type([]) 457 | let header = item 458 | else 459 | if exists('header') 460 | let lists += [{ 'type': item, 'header': header }] 461 | unlet header 462 | else 463 | let lists += [{ 'type': item }] 464 | endif 465 | endif 466 | unlet item 467 | endfor 468 | return lists 469 | else 470 | return [ 471 | \ { 'header': [s:leftpad .'MRU'], 'type': 'files' }, 472 | \ { 'header': [s:leftpad .'MRU '. getcwd()], 'type': 'dir' }, 473 | \ { 'header': [s:leftpad .'Sessions'], 'type': 'sessions' }, 474 | \ { 'header': [s:leftpad .'Bookmarks'], 'type': 'bookmarks' }, 475 | \ { 'header': [s:leftpad .'Commands'], 'type': 'commands' }, 476 | \ ] 477 | endif 478 | endfunction 479 | 480 | " Function: s:show_lists {{{1 481 | function! s:show_lists(lists) abort 482 | for list in a:lists 483 | if !has_key(list, 'type') 484 | continue 485 | endif 486 | 487 | let b:startify.indices = copy(get(list, 'indices', [])) 488 | 489 | if type(list.type) == type('') 490 | if has_key(list, 'header') 491 | let s:last_message = list.header 492 | endif 493 | call s:show_{list.type}() 494 | elseif type(list.type) == type(function('tr')) 495 | try 496 | let entries = list.type() 497 | catch 498 | call s:warn(v:exception) 499 | continue 500 | endtry 501 | if empty(entries) 502 | unlet! s:last_message 503 | continue 504 | endif 505 | 506 | if has_key(list, 'header') 507 | let s:last_message = list.header 508 | call s:print_section_header() 509 | endif 510 | 511 | for entry in entries 512 | let cmd = get(entry, 'cmd', 'edit') 513 | let path = get(entry, 'path', '') 514 | let type = get(entry, 'type', empty(path) ? 'special' : 'file') 515 | let index = s:get_index_as_string() 516 | call append('$', s:leftpad .'['. index .']'. repeat(' ', (3 - strlen(index))) . entry.line) 517 | call s:register(line('$'), index, type, cmd, path) 518 | endfor 519 | call append('$', '') 520 | else 521 | call s:warn('Wrong format for g:startify_lists: '. string(list)) 522 | endif 523 | endfor 524 | endfunction 525 | 526 | " Function: s:open_buffer {{{1 527 | function! s:open_buffer(entry) 528 | if a:entry.type == 'special' 529 | execute a:entry.cmd 530 | elseif a:entry.type == 'session' 531 | execute a:entry.cmd a:entry.path 532 | elseif a:entry.type == 'file' 533 | if line2byte('$') == -1 534 | execute 'edit' a:entry.path 535 | else 536 | if a:entry.cmd == 'tabnew' 537 | wincmd = 538 | endif 539 | execute a:entry.cmd a:entry.path 540 | endif 541 | call s:check_user_options(a:entry.path) 542 | endif 543 | if exists('#User#StartifyBufferOpened') 544 | doautocmd User StartifyBufferOpened 545 | endif 546 | endfunction 547 | 548 | " Function: s:set_custom_section {{{1 549 | function! s:set_custom_section(section) abort 550 | if type(a:section) == type([]) 551 | return copy(a:section) 552 | elseif type(a:section) == type('') 553 | return empty(a:section) ? [] : eval(a:section) 554 | endif 555 | return [] 556 | endfunction 557 | 558 | " Function: s:display_by_path {{{1 559 | function! s:display_by_path(path_prefix, path_format, use_env) abort 560 | let oldfiles = call(get(g:, 'startify_enable_unsafe') ? 's:filter_oldfiles_unsafe' : 's:filter_oldfiles', 561 | \ [a:path_prefix, a:path_format, a:use_env]) 562 | 563 | let entry_format = "s:leftpad .'['. index .']'. repeat(' ', (3 - strlen(index))) ." 564 | let entry_format .= exists('*StartifyEntryFormat') ? StartifyEntryFormat() : 'entry_path' 565 | 566 | if !empty(oldfiles) 567 | if exists('s:last_message') 568 | call s:print_section_header() 569 | endif 570 | 571 | for [absolute_path, entry_path] in oldfiles 572 | let index = s:get_index_as_string() 573 | call append('$', eval(entry_format)) 574 | if has('win32') 575 | let absolute_path = substitute(absolute_path, '\[', '\[[]', 'g') 576 | endif 577 | call s:register(line('$'), index, 'file', 'edit', absolute_path) 578 | endfor 579 | 580 | call append('$', '') 581 | endif 582 | endfunction 583 | 584 | " Function: s:filter_oldfiles {{{1 585 | function! s:filter_oldfiles(path_prefix, path_format, use_env) abort 586 | let path_prefix = '\V'. escape(a:path_prefix, '\') 587 | let counter = g:startify_files_number 588 | let entries = {} 589 | let oldfiles = [] 590 | 591 | for fname in v:oldfiles 592 | if counter <= 0 593 | break 594 | endif 595 | 596 | if s:is_in_skiplist(fname) 597 | " https://github.com/mhinz/vim-startify/issues/353 598 | continue 599 | endif 600 | 601 | try 602 | let absolute_path = fnamemodify(resolve(fname), ":p") 603 | catch /E655/ " Too many symbolic links (cycle?) 604 | call s:warn('Symlink loop detected! Skipping: '. fname) 605 | continue 606 | endtry 607 | " filter duplicates, bookmarks and entries from the skiplist 608 | if has_key(entries, absolute_path) 609 | \ || !filereadable(absolute_path) 610 | \ || s:is_in_skiplist(absolute_path) 611 | \ || match(absolute_path, path_prefix) 612 | continue 613 | endif 614 | 615 | let entry_path = '' 616 | if !empty(g:startify_transformations) 617 | let entry_path = s:transform(absolute_path) 618 | endif 619 | if empty(entry_path) 620 | let entry_path = fnamemodify(absolute_path, a:path_format) 621 | endif 622 | 623 | let entries[absolute_path] = 1 624 | let counter -= 1 625 | let oldfiles += [[fnameescape(absolute_path), entry_path]] 626 | endfor 627 | 628 | if a:use_env 629 | call s:init_env() 630 | for i in range(len(oldfiles)) 631 | for [k,v] in s:env 632 | let p = oldfiles[i][0] 633 | if !stridx(tolower(p), tolower(v)) 634 | let oldfiles[i][1] = printf('$%s%s', k, p[len(v):]) 635 | break 636 | endif 637 | endfor 638 | endfor 639 | endif 640 | 641 | return oldfiles 642 | endfunction 643 | 644 | " Function: s:filter_oldfiles_unsafe {{{1 645 | function! s:filter_oldfiles_unsafe(path_prefix, path_format, use_env) abort 646 | let path_prefix = '\V'. escape(a:path_prefix, '\') 647 | let counter = g:startify_files_number 648 | let entries = {} 649 | let oldfiles = [] 650 | let is_dir = escape(s:sep, '\') . '$' 651 | 652 | for fname in v:oldfiles 653 | if counter <= 0 654 | break 655 | endif 656 | 657 | if s:is_in_skiplist(fname) 658 | " https://github.com/mhinz/vim-startify/issues/353 659 | continue 660 | endif 661 | 662 | let absolute_path = glob(fnamemodify(fname, ":p")) 663 | if empty(absolute_path) 664 | \ || has_key(entries, absolute_path) 665 | \ || (absolute_path =~ is_dir) 666 | \ || match(absolute_path, path_prefix) 667 | \ || s:is_in_skiplist(absolute_path) 668 | continue 669 | endif 670 | 671 | let entry_path = fnamemodify(absolute_path, a:path_format) 672 | let entries[absolute_path] = 1 673 | let counter -= 1 674 | let oldfiles += [[fnameescape(absolute_path), entry_path]] 675 | endfor 676 | 677 | return oldfiles 678 | endfunction 679 | 680 | " Function: s:show_dir {{{1 681 | function! s:show_dir() abort 682 | return s:display_by_path(getcwd() . s:sep, ':.', 0) 683 | endfunction 684 | 685 | " Function: s:show_files {{{1 686 | function! s:show_files() abort 687 | return s:display_by_path('', g:startify_relative_path, get(g:, 'startify_use_env')) 688 | endfunction 689 | 690 | " Function: s:show_sessions {{{1 691 | function! s:show_sessions() abort 692 | let limit = get(g:, 'startify_session_number', 999) - 1 693 | if limit <= -1 694 | return 695 | endif 696 | 697 | let sfiles = split(globpath(s:session_dir, '*'), '\n') 698 | let sfiles = filter(sfiles, 'v:val !~# "__LAST__$"') 699 | let sfiles = filter(sfiles, 700 | \ '!(v:val =~# "x\.vim$" && index(sfiles, v:val[:-6].".vim") >= 0)') 701 | if empty(sfiles) 702 | if exists('s:last_message') 703 | unlet s:last_message 704 | endif 705 | return 706 | endif 707 | 708 | if exists('s:last_message') 709 | call s:print_section_header() 710 | endif 711 | 712 | if get(g:, 'startify_session_sort') 713 | function! s:sort_by_mtime(foo, bar) 714 | let foo = getftime(a:foo) 715 | let bar = getftime(a:bar) 716 | return foo == bar ? 0 : (foo < bar ? 1 : -1) 717 | endfunction 718 | call sort(sfiles, 's:sort_by_mtime') 719 | endif 720 | 721 | for i in range(len(sfiles)) 722 | let index = s:get_index_as_string() 723 | let fname = fnamemodify(sfiles[i], ':t') 724 | let dname = sfiles[i] ==# v:this_session ? fname.' (*)' : fname 725 | call append('$', s:leftpad .'['. index .']'. repeat(' ', (3 - strlen(index))) . dname) 726 | if has('win32') 727 | let fname = substitute(fname, '\[', '\[[]', 'g') 728 | endif 729 | call s:register(line('$'), index, 'session', 'SLoad', fname) 730 | if i == limit 731 | break 732 | endif 733 | endfor 734 | 735 | call append('$', '') 736 | endfunction 737 | 738 | " Function: s:show_bookmarks {{{1 739 | function! s:show_bookmarks() abort 740 | if !exists('g:startify_bookmarks') || empty(g:startify_bookmarks) 741 | return 742 | endif 743 | 744 | if exists('s:last_message') 745 | call s:print_section_header() 746 | endif 747 | 748 | let entry_format = "s:leftpad .'['. index .']'. repeat(' ', (3 - strlen(index))) ." 749 | let entry_format .= exists('*StartifyEntryFormat') ? StartifyEntryFormat() : 'entry_path' 750 | 751 | for bookmark in g:startify_bookmarks 752 | if type(bookmark) == type({}) 753 | let [index, path] = items(bookmark)[0] 754 | else " string 755 | let [index, path] = [s:get_index_as_string(), bookmark] 756 | endif 757 | 758 | let absolute_path = path 759 | 760 | let entry_path = '' 761 | if !empty(g:startify_transformations) 762 | let entry_path = s:transform(fnamemodify(resolve(expand(path)), ':p')) 763 | endif 764 | if empty(entry_path) 765 | let entry_path = path 766 | endif 767 | 768 | call append('$', eval(entry_format)) 769 | 770 | if has('win32') 771 | let path = substitute(path, '\[', '\[[]', 'g') 772 | endif 773 | call s:register(line('$'), index, 'file', 'edit', fnameescape(expand(path))) 774 | 775 | unlet bookmark " avoid type mismatch for heterogeneous lists 776 | endfor 777 | 778 | call append('$', '') 779 | endfunction 780 | 781 | " Function: s:show_commands {{{1 782 | function! s:show_commands() abort 783 | if !exists('g:startify_commands') || empty(g:startify_commands) 784 | return 785 | endif 786 | 787 | if exists('s:last_message') 788 | call s:print_section_header() 789 | endif 790 | 791 | for entry in g:startify_commands 792 | if type(entry) == type({}) " with custom index 793 | let [index, command] = items(entry)[0] 794 | else 795 | let command = entry 796 | let index = s:get_index_as_string() 797 | endif 798 | " If no list is given, the description is the command itself. 799 | let [desc, cmd] = type(command) == type([]) ? command : [command, command] 800 | 801 | call append('$', s:leftpad .'['. index .']'. repeat(' ', (3 - strlen(index))) . desc) 802 | call s:register(line('$'), index, 'special', cmd, '') 803 | 804 | unlet entry command 805 | endfor 806 | 807 | call append('$', '') 808 | endfunction 809 | 810 | " Function: s:is_in_skiplist {{{1 811 | function! s:is_in_skiplist(arg) abort 812 | for regexp in g:startify_skiplist 813 | try 814 | if a:arg =~# regexp 815 | return 1 816 | endif 817 | catch 818 | call s:warn('Pattern '. string(regexp) .' threw an exception. Read :help g:startify_skiplist') 819 | endtry 820 | endfor 821 | endfunction 822 | 823 | " Function: s:set_cursor {{{1 824 | function! s:set_cursor() abort 825 | let b:startify.oldline = exists('b:startify.newline') ? b:startify.newline : s:fixed_column 826 | let b:startify.newline = line('.') 827 | 828 | " going up (-1) or down (1) 829 | if b:startify.oldline == b:startify.newline 830 | \ && col('.') != s:fixed_column 831 | \ && !b:startify.leftmouse 832 | let movement = 2 * (col('.') > s:fixed_column) - 1 833 | let b:startify.newline += movement 834 | else 835 | let movement = 2 * (b:startify.newline > b:startify.oldline) - 1 836 | let b:startify.leftmouse = 0 837 | endif 838 | 839 | " skip section headers lines until an entry is found 840 | while index(b:startify.section_header_lines, b:startify.newline) != -1 841 | let b:startify.newline += movement 842 | endwhile 843 | 844 | " skip blank lines between lists 845 | if empty(getline(b:startify.newline)) 846 | let b:startify.newline += movement 847 | endif 848 | 849 | " don't go beyond first or last entry 850 | let b:startify.newline = max([b:startify.firstline, min([b:startify.lastline, b:startify.newline])]) 851 | 852 | call cursor(b:startify.newline, s:fixed_column) 853 | endfunction 854 | 855 | " Function: s:set_mappings {{{1 856 | function! s:set_mappings() abort 857 | nnoremap i :enew startinsert 858 | nnoremap :enew startinsert 859 | nnoremap b :call startify#set_mark('B') 860 | nnoremap s :call startify#set_mark('S') 861 | nnoremap t :call startify#set_mark('T') 862 | nnoremap v :call startify#set_mark('V') 863 | nnoremap B :call startify#set_batchmode('B') 864 | nnoremap S :call startify#set_batchmode('S') 865 | nnoremap T :call startify#set_batchmode('T') 866 | nnoremap V :call startify#set_batchmode('V') 867 | nnoremap :call startify#open_buffers() 868 | nnoremap :call leftmouse() 869 | nnoremap <2-LeftMouse> :call startify#open_buffers() 870 | nnoremap :enew execute 'normal! "'.(v:register=='"'?'*':v:register).'gp' 871 | 872 | " Without these mappings n/N wouldn't work properly, since autocmds always 873 | " force the cursor back on the index. 874 | nnoremap n ' j'[v:searchforward].'n' 875 | nnoremap N 'j '[v:searchforward].'N' 876 | 877 | function! s:leftmouse() 878 | " feedkeys() triggers CursorMoved which calls s:set_cursor() which checks 879 | " .leftmouse. 880 | let b:startify.leftmouse = 1 881 | call feedkeys("\", 'nt') 882 | endfunction 883 | 884 | function! s:compare_by_index(foo, bar) 885 | return a:foo.index - a:bar.index 886 | endfunction 887 | 888 | for entry in sort(values(b:startify.entries), 's:compare_by_index') 889 | execute 'nnoremap ' entry.index 890 | \ ':call startify#open_buffers('. string(entry.line) .')' 891 | endfor 892 | endfunction 893 | 894 | " Function: #set_batchmode {{{1 895 | function! startify#set_batchmode(batchmode) abort 896 | let s:batchmode = (a:batchmode == s:batchmode) ? '' : a:batchmode 897 | echo empty(s:batchmode) ? 'Batchmode off' : 'Batchmode: '. s:batchmode 898 | endfunction 899 | 900 | " Function: #set_mark {{{1 901 | function! startify#set_mark(type, ...) abort 902 | if a:0 903 | let entryline = a:1 904 | else 905 | call startify#set_batchmode('') 906 | let entryline = line('.') 907 | endif 908 | let entry = b:startify.entries[entryline] 909 | 910 | if entry.type != 'file' 911 | return 912 | endif 913 | 914 | let default_cmds = { 915 | \ 'B': 'edit', 916 | \ 'S': 'split', 917 | \ 'V': 'vsplit', 918 | \ 'T': 'tabnew', 919 | \ } 920 | 921 | let origline = line('.') 922 | execute entryline 923 | let index = expand('') 924 | setlocal modifiable 925 | 926 | " https://github.com/vim/vim/issues/8053 927 | let showmatch = &showmatch 928 | let &showmatch = 0 929 | 930 | if entry.marked && index[0] == a:type 931 | let entry.cmd = 'edit' 932 | let entry.marked = 0 933 | execute 'normal! "_ci]'. entry.index 934 | else 935 | let entry.cmd = default_cmds[a:type] 936 | let entry.marked = 1 937 | let entry.tick = b:startify.tick 938 | let b:startify.tick += 1 939 | execute 'normal! "_ci]'. repeat(a:type, len(index)) 940 | endif 941 | 942 | let &showmatch = showmatch 943 | 944 | setlocal nomodifiable nomodified 945 | " Reset cursor to fixed column, which is important for s:set_cursor(). 946 | call cursor(origline, s:fixed_column) 947 | endfunction 948 | 949 | " Function: s:sort_by_tick {{{1 950 | function! s:sort_by_tick(one, two) 951 | return a:one.tick - a:two.tick 952 | endfunction 953 | 954 | " Function: s:check_user_options {{{1 955 | function! s:check_user_options(path) abort 956 | let session = a:path . s:sep .'Session.vim' 957 | 958 | if get(g:, 'startify_session_autoload') && filereadable(glob(session)) 959 | execute 'silent bwipeout' a:path 960 | call startify#session_delete_buffers() 961 | execute 'source' session 962 | return 963 | endif 964 | 965 | if get(g:, 'startify_change_to_vcs_root') && s:cd_to_vcs_root(a:path) 966 | return 967 | endif 968 | 969 | if get(g:, 'startify_change_to_dir', 1) 970 | if isdirectory(a:path) 971 | execute s:cd_cmd() a:path 972 | else 973 | let dir = fnamemodify(a:path, ':h') 974 | if isdirectory(dir) 975 | execute s:cd_cmd() dir 976 | else 977 | " Do nothing. E.g. a:path == `scp://foo/bar` 978 | endif 979 | endif 980 | endif 981 | endfunction 982 | 983 | " Function: s:cd_to_vcs_root {{{1 984 | function! s:cd_to_vcs_root(path) abort 985 | let dir = fnamemodify(a:path, ':p:h') 986 | for vcs in [ '.git', '.hg', '.bzr', '.svn' ] 987 | let root = finddir(vcs, dir .';') 988 | if !empty(root) 989 | execute s:cd_cmd() fnameescape(fnamemodify(root, ':h')) 990 | return 1 991 | endif 992 | endfor 993 | return 0 994 | endfunction 995 | 996 | " Function: s:cd_cmd {{{1 997 | function! s:cd_cmd() abort 998 | let g:startify_change_cmd = get(g:, 'startify_change_cmd', 'lcd') 999 | if g:startify_change_cmd !~# '^[lt]\?cd$' 1000 | call s:warn('Invalid value for g:startify_change_cmd. Defaulting to :lcd') 1001 | let g:startify_change_cmd = 'lcd' 1002 | endif 1003 | return g:startify_change_cmd 1004 | endfunction 1005 | 1006 | " Function: s:close {{{1 1007 | function! s:close() abort 1008 | if len(filter(range(0, bufnr('$')), 'buflisted(v:val)')) - &buflisted 1009 | if bufloaded(bufnr('#')) && bufnr('#') != bufnr('%') 1010 | buffer # 1011 | else 1012 | bnext 1013 | endif 1014 | else 1015 | quit 1016 | endif 1017 | endfunction 1018 | 1019 | " Function: s:get_index_as_string {{{1 1020 | function! s:get_index_as_string() abort 1021 | if !empty(b:startify.indices) 1022 | return remove(b:startify.indices, 0) 1023 | elseif exists('g:startify_custom_indices') 1024 | let listlen = len(g:startify_custom_indices) 1025 | if b:startify.entry_number < listlen 1026 | let idx = g:startify_custom_indices[b:startify.entry_number] 1027 | else 1028 | let idx = string(b:startify.entry_number - listlen) 1029 | endif 1030 | else 1031 | let idx = string(b:startify.entry_number) 1032 | endif 1033 | 1034 | let b:startify.entry_number += 1 1035 | 1036 | return idx 1037 | endfunction 1038 | 1039 | " Function: s:print_section_header {{{1 1040 | function! s:print_section_header() abort 1041 | $ 1042 | let curline = line('.') 1043 | 1044 | for lnum in range(curline, curline + len(s:last_message) + 1) 1045 | call add(b:startify.section_header_lines, lnum) 1046 | endfor 1047 | 1048 | call append('$', s:last_message + ['']) 1049 | unlet s:last_message 1050 | endfunction 1051 | 1052 | " Function: s:register {{{1 1053 | function! s:register(line, index, type, cmd, path) 1054 | let b:startify.entries[a:line] = { 1055 | \ 'index': a:index, 1056 | \ 'type': a:type, 1057 | \ 'line': a:line, 1058 | \ 'cmd': a:cmd, 1059 | \ 'path': a:path, 1060 | \ 'marked': 0, 1061 | \ } 1062 | endfunction 1063 | 1064 | " Function: s:create_last_session_link {{{1 1065 | function! s:create_last_session_link(session_path) 1066 | if !has('win32') && a:session_path !~# '__LAST__$' 1067 | let cmd = printf('ln -sf %s %s', 1068 | \ shellescape(fnamemodify(a:session_path, ':t')), 1069 | \ shellescape(s:session_dir .'/__LAST__')) 1070 | silent call system(cmd) 1071 | if v:shell_error 1072 | call s:warn("Can't create 'last used session' symlink.") 1073 | endif 1074 | endif 1075 | endfunction 1076 | 1077 | " Function: s:init_env {{{1 1078 | function! s:init_env() 1079 | let s:env = [] 1080 | let ignore = { 1081 | \ 'HOME': 1, 1082 | \ 'OLDPWD': 1, 1083 | \ 'PWD': 1, 1084 | \ } 1085 | 1086 | if exists('*environ') 1087 | let env = items(environ()) 1088 | else 1089 | redir => s 1090 | silent! execute "norm!:ec$\'\\\\'\" 1091 | redir END 1092 | redraw 1093 | let env = map(split(s), '[v:val, eval("$".v:val)]') 1094 | endif 1095 | 1096 | for [var, val] in env 1097 | if has('win32') ? (val[1] != ':') : (val[0] != '/') 1098 | \ || has_key(ignore, var) 1099 | \ || len(var) > len(val) 1100 | continue 1101 | endif 1102 | call insert(s:env, [var, val], 0) 1103 | endfor 1104 | 1105 | function! s:compare_by_key_len(foo, bar) 1106 | return len(a:foo[0]) - len(a:bar[0]) 1107 | endfunction 1108 | function! s:compare_by_val_len(foo, bar) 1109 | return len(a:bar[1]) - len(a:foo[1]) 1110 | endfunction 1111 | 1112 | let s:env = sort(s:env, 's:compare_by_key_len') 1113 | let s:env = sort(s:env, 's:compare_by_val_len') 1114 | endfunction 1115 | 1116 | " Function: s:transform {{{1 1117 | function s:transform(absolute_path) 1118 | for [k,V] in g:startify_transformations 1119 | if a:absolute_path =~ k 1120 | return type(V) == type('') ? V : V(a:absolute_path) 1121 | endif 1122 | unlet V 1123 | endfor 1124 | return '' 1125 | endfunction 1126 | 1127 | " Function: s:hide_endofbuffer_markers {{{1 1128 | " Use the bg color of Normal to set the fg color of EndOfBuffer, effectively 1129 | " hiding it. 1130 | function! s:hide_endofbuffer_markers() 1131 | if !exists('+winhl') 1132 | return 1133 | endif 1134 | let val = synIDattr(hlID('Normal'), 'bg') 1135 | if empty(val) 1136 | return 1137 | elseif val =~ '^\d*$' 1138 | execute 'highlight StartifyEndOfBuffer ctermfg='. val 1139 | else 1140 | execute 'highlight StartifyEndOfBuffer guifg='. val 1141 | endif 1142 | setlocal winhighlight=EndOfBuffer:StartifyEndOfBuffer 1143 | endfunction 1144 | 1145 | " Function: s:warn {{{1 1146 | function! s:warn(msg) abort 1147 | echohl WarningMsg 1148 | echomsg 'startify: '. a:msg 1149 | echohl NONE 1150 | endfunction 1151 | 1152 | " Init: values {{{1 1153 | let s:sep = startify#get_separator() 1154 | 1155 | let g:startify_files_number = get(g:, 'startify_files_number', 10) 1156 | let g:startify_enable_special = get(g:, 'startify_enable_special', 1) 1157 | let g:startify_relative_path = get(g:, 'startify_relative_path') ? ':~:.' : ':p:~' 1158 | let s:session_dir = startify#get_session_path() 1159 | let g:startify_transformations = get(g:, 'startify_transformations', []) 1160 | 1161 | let g:startify_skiplist = extend(get(g:, 'startify_skiplist', []), [ 1162 | \ 'runtime/doc/.*\.txt$', 1163 | \ 'bundle/.*/doc/.*\.txt$', 1164 | \ 'plugged/.*/doc/.*\.txt$', 1165 | \ '/.git/', 1166 | \ 'fugitiveblame$', 1167 | \ escape(fnamemodify(resolve($VIMRUNTIME), ':p'), '\') .'doc/.*\.txt$', 1168 | \ ], 'keep') 1169 | 1170 | let g:startify_padding_left = get(g:, 'startify_padding_left', 3) 1171 | let s:leftpad = repeat(' ', g:startify_padding_left) 1172 | let s:fixed_column = g:startify_padding_left + 2 1173 | let s:batchmode = '' 1174 | -------------------------------------------------------------------------------- /autoload/startify/fortune.vim: -------------------------------------------------------------------------------- 1 | scriptencoding utf-8 2 | 3 | " Function: s:get_random_offset {{{1 4 | function! s:get_random_offset(max) abort 5 | return str2nr(matchstr(reltimestr(reltime()), '\.\zs\d\+')[1:]) % a:max 6 | endfunction 7 | 8 | " Function: s:draw_box {{{1 9 | function! s:draw_box(lines) abort 10 | let longest_line = max(map(copy(a:lines), 'strwidth(v:val)')) 11 | let top_bottom_without_corners = repeat(s:char_top_bottom, longest_line + 2) 12 | let top = s:char_top_left . top_bottom_without_corners . s:char_top_right 13 | let bottom = s:char_bottom_left . top_bottom_without_corners . s:char_bottom_right 14 | let lines = [top] 15 | for l in a:lines 16 | let offset = longest_line - strwidth(l) 17 | let lines += [s:char_sides . ' '. l . repeat(' ', offset) .' ' . s:char_sides] 18 | endfor 19 | let lines += [bottom] 20 | return lines 21 | endfunction 22 | 23 | " Function: #quote {{{1 24 | function! startify#fortune#quote() abort 25 | return g:startify_custom_header_quotes[s:get_random_offset(len(g:startify_custom_header_quotes))] 26 | endfunction 27 | 28 | " Function: #boxed {{{1 29 | function! startify#fortune#boxed(...) abort 30 | let wrapped_quote = [] 31 | if a:0 && type(a:1) == type([]) 32 | let quote = a:1 33 | else 34 | let Quote = startify#fortune#quote() 35 | let quote = type(Quote) == type(function('tr')) ? Quote() : Quote 36 | endif 37 | for line in quote 38 | let wrapped_quote += split(line, '\%50c.\{-}\zs\s', 1) 39 | endfor 40 | let wrapped_quote = s:draw_box(wrapped_quote) 41 | return wrapped_quote 42 | endfunction 43 | 44 | " Function: #cowsay {{{1 45 | function! startify#fortune#cowsay(...) abort 46 | if a:0 47 | let quote = a:0 && type(a:1) == type([]) ? a:1 : startify#fortune#quote() 48 | let s:char_top_bottom = get(a:000, 1, s:char_top_bottom) 49 | let s:char_sides = get(a:000, 2, s:char_sides) 50 | let s:char_top_left = get(a:000, 3, s:char_top_left) 51 | let s:char_top_right = get(a:000, 4, s:char_top_right) 52 | let s:char_bottom_right = get(a:000, 5, s:char_bottom_right) 53 | let s:char_bottom_left = get(a:000, 6, s:char_bottom_left) 54 | else 55 | let quote = startify#fortune#quote() 56 | endif 57 | let boxed_quote = startify#fortune#boxed(quote) 58 | return boxed_quote + s:cow 59 | endfunction 60 | 61 | " Function: #predefined_quotes {{{1 62 | function! startify#fortune#predefined_quotes() abort 63 | return s:predefined_quotes 64 | endfunction 65 | 66 | " Variables {{{1 67 | let s:cow = [ 68 | \ ' o', 69 | \ ' o ^__^', 70 | \ ' o (oo)\_______', 71 | \ ' (__)\ )\/\', 72 | \ ' ||----w |', 73 | \ ' || ||', 74 | \ ] 75 | 76 | let g:startify_fortune_use_unicode = &encoding == 'utf-8' && get(g:, 'startify_fortune_use_unicode') 77 | 78 | let s:char_top_bottom = ['-', '─'][g:startify_fortune_use_unicode] 79 | let s:char_sides = ['|', '│'][g:startify_fortune_use_unicode] 80 | let s:char_top_left = ['*', '╭'][g:startify_fortune_use_unicode] 81 | let s:char_top_right = ['*', '╮'][g:startify_fortune_use_unicode] 82 | let s:char_bottom_right = ['*', '╯'][g:startify_fortune_use_unicode] 83 | let s:char_bottom_left = ['*', '╰'][g:startify_fortune_use_unicode] 84 | 85 | let s:predefined_quotes = [ 86 | \ ["Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.", '', '- Brian Kernighan'], 87 | \ ["If you don't finish then you're just busy, not productive."], 88 | \ ['Adapting old programs to fit new machines usually means adapting new machines to behave like old ones.', '', '- Alan Perlis'], 89 | \ ['Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it.', '', '- Alan Perlis'], 90 | \ ['It is easier to change the specification to fit the program than vice versa.', '', '- Alan Perlis'], 91 | \ ['Simplicity does not precede complexity, but follows it.', '', '- Alan Perlis'], 92 | \ ['Optimization hinders evolution.', '', '- Alan Perlis'], 93 | \ ['Recursion is the root of computation since it trades description for time.', '', '- Alan Perlis'], 94 | \ ['It is better to have 100 functions operate on one data structure than 10 functions on 10 data structures.', '', '- Alan Perlis'], 95 | \ ['There is nothing quite so useless as doing with great efficiency something that should not be done at all.', '', '- Peter Drucker'], 96 | \ ["If you don't fail at least 90% of the time, you're not aiming high enough.", '', '- Alan Kay'], 97 | \ ['I think a lot of new programmers like to use advanced data structures and advanced language features as a way of demonstrating their ability. I call it the lion-tamer syndrome. Such demonstrations are impressive, but unless they actually translate into real wins for the project, avoid them.', '', '- Glyn Williams'], 98 | \ ['I would rather die of passion than of boredom.', '', '- Vincent Van Gogh'], 99 | \ ['If a system is to serve the creative spirit, it must be entirely comprehensible to a single individual.'], 100 | \ ["The computing scientist's main challenge is not to get confused by the complexities of his own making.", '', '- Edsger W. Dijkstra'], 101 | \ ["Progress in a fixed context is almost always a form of optimization. Creative acts generally don't stay in the context that they are in.", '', '- Alan Kay'], 102 | \ ['The essence of XML is this: the problem it solves is not hard, and it does not solve the problem well.', '', '- Phil Wadler'], 103 | \ ['A good programmer is someone who always looks both ways before crossing a one-way street.', '', '- Doug Linder'], 104 | \ ['Patterns mean "I have run out of language."', '', '- Rich Hickey'], 105 | \ ['Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.', '', '- John Woods'], 106 | \ ['Unix was not designed to stop its users from doing stupid things, as that would also stop them from doing clever things.'], 107 | \ ['Contrary to popular belief, Unix is user friendly. It just happens to be very selective about who it decides to make friends with.'], 108 | \ ['Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.'], 109 | \ ['There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies.', '', '- C.A.R. Hoare'], 110 | \ ["If you don't make mistakes, you're not working on hard enough problems.", '', '- Frank Wilczek'], 111 | \ ["If you don't start with a spec, every piece of code you write is a patch.", '', '- Leslie Lamport'], 112 | \ ['Caches are bugs waiting to happen.', '', '- Rob Pike'], 113 | \ ['Abstraction is not about vagueness, it is about being precise at a new semantic level.', '', '- Edsger W. Dijkstra'], 114 | \ ["dd is horrible on purpose. It's a joke about OS/360 JCL. But today it's an internationally standardized joke. I guess that says it all.", '', '- Rob Pike'], 115 | \ ['All loops are infinite ones for faulty RAM modules.'], 116 | \ ['All idioms must be learned. Good idioms only need to be learned once.', '', '- Alan Cooper'], 117 | \ ['For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled.', '', '- Richard Feynman'], 118 | \ ['If programmers were electricians, parallel programmers would be bomb disposal experts. Both cut wires.', '', '- Bartosz Milewski'], 119 | \ ['Computers are harder to maintain at high altitude. Thinner air means less cushion between disk heads and platters. Also more radiation.'], 120 | \ ['Almost every programming language is overrated by its practitioners.', '', '- Larry Wall'], 121 | \ ['Fancy algorithms are slow when n is small, and n is usually small.', '', '- Rob Pike'], 122 | \ ['Methods are just functions with a special first argument.', '', '- Andrew Gerrand'], 123 | \ 124 | \ ['Care about your craft.', '', 'Why spend your life developing software unless you care about doing it well?'], 125 | \ ["Provide options, don't make lame excuses.", '', "Instead of excuses, provide options. Don't say it can't be done; explain what can be done."], 126 | \ ['Be a catalyst for change.', '', "You can't force change on people. Instead, show them how the future might be and help them participate in creating it."], 127 | \ ['Make quality a requirements issue.', '', "Involve your users in determining the project's real quality requirements."], 128 | \ ['Critically analyze what you read and hear.', '', "Don't be swayed by vendors, media hype, or dogma. Analyze information in terms of you and your project."], 129 | \ ["DRY - Don't Repeat Yourself.", '', 'Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.'], 130 | \ ['Eliminate effects between unrelated things.', '', 'Design components that are self-contained, independent, and have a single, well-defined purpose.'], 131 | \ ['Use tracer bullets to find the target.', '', 'Tracer bullets let you home in on your target by trying things and seeing how close they land.'], 132 | \ ['Program close to the problem domain.', '', "Design and code in your user's language."], 133 | \ ['Iterate the schedule with the code.', '', 'Use experience you gain as you implement to refine the project time scales.'], 134 | \ ['Use the power of command shells.', '', "Use the shell when graphical user interfaces don't cut it."], 135 | \ ['Always use source code control.', '', 'Source code control is a time machine for your work - you can go back.'], 136 | \ ["Don't panic when debugging", '', 'Take a deep breath and THINK! about what could be causing the bug.'], 137 | \ ["Don't assume it - prove it.", '', 'Prove your assumptions in the actual environment - with real data and boundary conditions.'], 138 | \ ['Write code that writes code.', '', 'Code generators increase your productivity and help avoid duplication.'], 139 | \ ['Design With contracts.', '', 'Use contracts to document and verify that code does no more and no less than it claims to do.'], 140 | \ ['Use assertions to prevent the impossible.', '', 'Assertions validate your assumptions. Use them to protect your code from an uncertain world.'], 141 | \ ['Finish what you start.', '', 'Where possible, the routine or object that allocates a resource should be responsible for deallocating it.'], 142 | \ ["Configure, don't integrate.", '', 'Implement technology choices for an application as configuration options, not through integration or engineering.'], 143 | \ ['Analyze workflow to improve concurrency.', '', "Exploit concurrency in your user's workflow."], 144 | \ ['Always design for concurrency.', '', "Allow for concurrency, and you'll design cleaner interfaces with fewer assumptions."], 145 | \ ['Use blackboards to coordinate workflow.', '', 'Use blackboards to coordinate disparate facts and agents, while maintaining independence and isolation among participants.'], 146 | \ ['Estimate the order of your algorithms.', '', 'Get a feel for how long things are likely to take before you write code.'], 147 | \ ['Refactor early, refactor often.', '', 'Just as you might weed and rearrange a garden, rewrite, rework, and re-architect code when it needs it. Fix the root of the problem.'], 148 | \ ['Test your software, or your users will.', '', "Test ruthlessly. Don't make your users find bugs for you."], 149 | \ ["Don't gather requirements - dig for them.", '', "Requirements rarely lie on the surface. They're buried deep beneath layers of assumptions, misconceptions, and politics."], 150 | \ ['Abstractions live longer than details.', '', 'Invest in the abstraction, not the implementation. Abstractions can survive the barrage of changes from different implementations and new technologies.'], 151 | \ ["Don't think outside the box - find the box.", '', 'When faced with an impossible problem, identify the real constraints. Ask yourself: "Does it have to be done this way? Does it have to be done at all?"'], 152 | \ ['Some things are better done than described.', '', "Don't fall into the specification spiral - at some point you need to start coding."], 153 | \ ["Costly tools don't produce better designs.", '', 'Beware of vendor hype, industry dogma, and the aura of the price tag. Judge tools on their merits.'], 154 | \ ["Don't use manual procedures.", '', 'A shell script or batch file will execute the same instructions, in the same order, time after time.'], 155 | \ ["Coding ain't done 'til all the Tests run.", '', "'Nuff said."], 156 | \ ['Test state coverage, not code coverage.', '', "Identify and test significant program states. Just testing lines of code isn't enough."], 157 | \ ['English is just a programming language.', '', 'Write documents as you would write code: honor the DRY principle, use metadata, MVC, automatic generation, and so on.'], 158 | \ ["Gently exceed your users' expectations.", '', "Come to understand your users' expectations, then deliver just that little bit more."], 159 | \ ['Think about your work.', '', 'Turn off the autopilot and take control. Constantly critique and appraise your work.'], 160 | \ ["Don't live with broken windows.", '', 'Fix bad designs, wrong decisions, and poor code when you see them.'], 161 | \ ['Remember the big picture.', '', "Don't get so engrossed in the details that you forget to check what's happening around you."], 162 | \ ['Invest regularly in your knowledge portfolio.', '', 'Make learning a habit.'], 163 | \ ["It's both what you say and the way you say it.", '', "There's no point in having great ideas if you don't communicate them effectively."], 164 | \ ['Make it easy to reuse.', '', "If it's easy to reuse, people will. Create an environment that supports reuse."], 165 | \ ['There are no final decisions.', '', 'No decision is cast in stone. Instead, consider each as being written in the sand at the beach, and plan for change.'], 166 | \ ['Prototype to learn.', '', 'Prototyping is a learning experience. Its value lies not in the code you produce, but in the lessons you learn.'], 167 | \ ['Estimate to avoid surprises.', '', "Estimate before you start. You'll spot potential problems up front."], 168 | \ ['Keep knowledge in plain text.', '', "Plain text won't become obsolete. It helps leverage your work and simplifies debugging and testing."], 169 | \ ['Use a single editor well.', '', 'The editor should be an extension of your hand; make sure your editor is configurable, extensible, and programmable.'], 170 | \ ['Fix the problem, not the blame.', '', "It doesn't really matter whether the bug is your fault or someone else's - it is still your problem, and it still needs to be fixed."], 171 | \ ["\"select\" isn't broken.", '', 'It is rare to find a bug in the OS or the compiler, or even a third-party product or library. The bug is most likely in the application.'], 172 | \ ['Learn a text manipulation language.', '', 'You spend a large part of each day working with text. Why not have the computer do some of it for you?'], 173 | \ ["You can't write perfect software.", '', "Software can't be perfect. Protect your code and users from the inevitable errors."], 174 | \ ['Crash early.', '', 'A dead program normally does a lot less damage than a crippled one.'], 175 | \ ['Use exceptions for exceptional problems.', '', 'Exceptions can suffer from all the readability and maintainability problems of classic spaghetti code. Reserve exceptions for exceptional things.'], 176 | \ ['Minimize coupling between modules.', '', 'Avoid coupling by writing "shy" code and applying the Law of Demeter.'], 177 | \ ['Put abstractions in code, details in metadata.', '', 'Program for the general case, and put the specifics outside the compiled code base.'], 178 | \ ['Design using services.', '', 'Design in terms of services-independent, concurrent objects behind well-defined, consistent interfaces.'], 179 | \ ['Separate views from models.', '', 'Gain flexibility at low cost by designing your application in terms of models and views.'], 180 | \ ["Don't program by coincidence.", '', "Rely only on reliable things. Beware of accidental complexity, and don't confuse a happy coincidence with a purposeful plan."], 181 | \ ['Test your estimates.', '', "Mathematical analysis of algorithms doesn't tell you everything. Try timing your code in its target environment."], 182 | \ ['Design to test.', '', 'Start thinking about testing before you write a line of code.'], 183 | \ ["Don't use wizard code you don't understand.", '', 'Wizards can generate reams of code. Make sure you understand all of it before you incorporate it into your project.'], 184 | \ ['Work with a user to think like a user.', '', "It's the best way to gain insight into how the system will really be used."], 185 | \ ['Use a project glossary.', '', 'Create and maintain a single source of all the specific terms and vocabulary for a project.'], 186 | \ ["Start when you're ready.", '', "You've been building experience all your life. Don't ignore niggling doubts."], 187 | \ ["Don't be a slave to formal methods.", '', "Don't blindly adopt any technique without putting it into the context of your development practices and capabilities."], 188 | \ ['Organize teams around functionality.', '', "Don't separate designers from coders, testers from data modelers. Build teams the way you build code."], 189 | \ ['Test early. Test often. Test automatically.', '', 'Tests that run with every build are much more effective than test plans that sit on a shelf.'], 190 | \ ['Use saboteurs to test your testing.', '', 'Introduce bugs on purpose in a separate copy of the source to verify that testing will catch them.'], 191 | \ ['Find bugs once.', '', 'Once a human tester finds a bug, it should be the last time a human tester finds that bug. Automatic tests should check for it from then on.'], 192 | \ ['Sign your work.', '', 'Craftsmen of an earlier age were proud to sign their work. You should be, too.'], 193 | \ ['Think twice, code once.'], 194 | \ ['No matter how far down the wrong road you have gone, turn back now.'], 195 | \ ['Why do we never have time to do it right, but always have time to do it over?'], 196 | \ ['Weeks of programming can save you hours of planning.'], 197 | \ ['To iterate is human, to recurse divine.', '', '- L. Peter Deutsch'], 198 | \ ['Computers are useless. They can only give you answers.', '', '- Pablo Picasso'], 199 | \ ['The question of whether computers can think is like the question of whether submarines can swim.', '', '- Edsger W. Dijkstra'], 200 | \ ["It's ridiculous to live 100 years and only be able to remember 30 million bytes. You know, less than a compact disc. The human condition is really becoming more obsolete every minute.", '', '- Marvin Minsky'], 201 | \ ["The city's central computer told you? R2D2, you know better than to trust a strange computer!", '', '- C3PO'], 202 | \ ['Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves.', '', '- Alan Kay'], 203 | \ ["I've finally learned what \"upward compatible\" means. It means we get to keep all our old mistakes.", '', '- Dennie van Tassel'], 204 | \ ["There are two major products that come out of Berkeley: LSD and UNIX. We don't believe this to be a coincidence.", '', '- Jeremy S. Anderson'], 205 | \ ["The bulk of all patents are crap. Spending time reading them is stupid. It's up to the patent owner to do so, and to enforce them.", '', '- Linus Torvalds'], 206 | \ ['Controlling complexity is the essence of computer programming.', '', '- Brian Kernighan'], 207 | \ ['Complexity kills. It sucks the life out of developers, it makes products difficult to plan, build and test, it introduces security challenges, and it causes end-user and administrator frustration.', '', '- Ray Ozzie'], 208 | \ ['The function of good software is to make the complex appear to be simple.', '', '- Grady Booch'], 209 | \ ["There's an old story about the person who wished his computer were as easy to use as his telephone. That wish has come true, since I no longer know how to use my telephone.", '', '- Bjarne Stroustrup'], 210 | \ ['There are only two industries that refer to their customers as "users".', '', '- Edward Tufte'], 211 | \ ['Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris.', '', '- Larry Wall'], 212 | \ ['Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter.', '', '- Eric S. Raymond'], 213 | \ ['Optimism is an occupational hazard of programming; feedback is the treatment.', '', '- Kent Beck'], 214 | \ ['First, solve the problem. Then, write the code.', '', '- John Johnson'], 215 | \ ['Measuring programming progress by lines of code is like measuring aircraft building progress by weight.', '', '- Bill Gates'], 216 | \ ["Don't worry if it doesn't work right. If everything did, you'd be out of a job.", '', "- Mosher's Law of Software Engineering"], 217 | \ ['A LISP programmer knows the value of everything, but the cost of nothing.', '', '- Alan J. Perlis'], 218 | \ ['All problems in computer science can be solved with another level of indirection.', '', '- David Wheeler'], 219 | \ ['Functions delay binding; data structures induce binding. Moral: Structure data late in the programming process.', '', '- Alan J. Perlis'], 220 | \ ['Easy things should be easy and hard things should be possible.', '', '- Larry Wall'], 221 | \ ['Nothing is more permanent than a temporary solution.'], 222 | \ ["If you can't explain something to a six-year-old, you really don't understand it yourself.", '', '- Albert Einstein'], 223 | \ ['All programming is an exercise in caching.', '', '- Terje Mathisen'], 224 | \ ['Software is hard.', '', '- Donald Knuth'], 225 | \ ['They did not know it was impossible, so they did it!', '', '- Mark Twain'], 226 | \ ['The object-oriented model makes it easy to build up programs by accretion. What this often means, in practice, is that it provides a structured way to write spaghetti code.', '', '- Paul Graham'], 227 | \ ['Question: How does a large software project get to be one year late?', 'Answer: One day at a time!'], 228 | \ ['The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.', '', '- Tom Cargill'], 229 | \ ["In software, we rarely have meaningful requirements. Even if we do, the only measure of success that matters is whether our solution solves the customer's shifting idea of what their problem is.", '', '- Jeff Atwood'], 230 | \ ['If debugging is the process of removing bugs, then programming must be the process of putting them in.', '', '- Edsger W. Dijkstra'], 231 | \ ['640K ought to be enough for anybody.', '', '- Bill Gates, 1981'], 232 | \ ['To understand recursion, one must first understand recursion.', '', '- Stephen Hawking'], 233 | \ ['Developing tolerance for imperfection is the key factor in turning chronic starters into consistent finishers.', '', '- Jon Acuff'], 234 | \ ['Every great developer you know got there by solving problems they were unqualified to solve until they actually did it.', '', '- Patrick McKenzie'], 235 | \ ["The average user doesn't give a damn what happens, as long as (1) it works and (2) it's fast.", '', '- Daniel J. Bernstein'], 236 | \ ['Walking on water and developing software from a specification are easy if both are frozen.', '', '- Edward V. Berard'], 237 | \ ['Be curious. Read widely. Try new things. I think a lot of what people call intelligence boils down to curiosity.', '', '- Aaron Swartz'], 238 | \ ['What one programmer can do in one month, two programmers can do in two months.', '', '- Frederick P. Brooks'], 239 | \ ] 240 | 241 | let g:startify_custom_header_quotes = exists('g:startify_custom_header_quotes') 242 | \ ? g:startify_custom_header_quotes 243 | \ : startify#fortune#predefined_quotes() 244 | -------------------------------------------------------------------------------- /doc/startify.txt: -------------------------------------------------------------------------------- 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 | 18 | If you encounter any bugs or have feature requests, just open an issue on 19 | GitHub. 20 | 21 | Thank you for flying mhi^ airlines. Get the Vim on! 22 | < 23 | ============================================================================== 24 | CONTENTS *startify-contents* 25 | 26 | INTRO .......................................... |startify-intro| 27 | USAGE .......................................... |startify-usage| 28 | OPTIONS ........................................ |startify-options| 29 | AUTOCMD ........................................ |startify-autocmd| 30 | COMMANDS ....................................... |startify-commands| 31 | MAPPINGS ....................................... |startify-mappings| 32 | COLORS ......................................... |startify-colors| 33 | MISC ........................................... |startify-misc| 34 | FAQ ............................................ |startify-faq| 35 | EXAMPLE ........................................ |startify-example| 36 | 37 | ============================================================================== 38 | INTRO *startify-intro* 39 | 40 | Startify is a plugin that shows recently used files, bookmarks, commands and 41 | sessions that were saved to a certain directory. 42 | 43 | ============================================================================== 44 | USAGE *startify-usage* 45 | 46 | Startify basically provides two things: 47 | 48 | 1) If you start Vim without giving any filenames to it (or pipe stuff to it so 49 | it reads from STDIN), startify will show a pretty start screen that shows 50 | recently used files (using viminfo/shada) and sessions by default. 51 | 52 | Additionally, you can define bookmarks (thus entries for files) and 53 | commands that always should be available on the start screen. 54 | 55 | You can either navigate to a certain menu entry and hit `` or just 56 | enter the index (the index is whatever is written between the square 57 | brackets on that line). You can even double-click anywhere on the line. 58 | 59 | In addition, `e` creates an empty buffer, `i` creates an empty buffer and 60 | jumps into insert mode, `q` quits either the buffer or, if there is no 61 | other listed buffer left, Vim itself. 62 | 63 | Moreover, you can open multiple buffers at once. Navigate to an entry and 64 | hit either `b` (open in same window), `s` (open in split), `v` (open in 65 | vertical split) or `t` (open in tab). You can do that for multiple entries. 66 | You can also mix them. The order of the selections will be remembered. 67 | Afterwards execute these actions via ``. 68 | 69 | The uppercase variants of b/s/v/t enable the batchmode which lets you 70 | select any entries without navigating there first. Every following index 71 | will be opened in the currently active mode. E.g. to open the buffers with 72 | the indices 0, 2, and 4, use `B024` instead of `bjjbjjb`. To disable 73 | batchmode, just use the same uppercase key again, or any of the lowercase 74 | variants. 75 | 76 | When the selection is finished, Startify will close automatically. You can 77 | reopen the screen via :Startify. 78 | 79 | And you can define your own custom ascii art header! 80 | 81 | 2) The plugin eases the handling of loading and saving sessions by putting 82 | sessions in a central directory. 83 | 84 | :SLoad load a session |startify-:SLoad| 85 | :SSave[!] save a session |startify-:SSave| 86 | :SDelete[!] delete a session |startify-:SDelete| 87 | :SClose close a session |startify-:SClose| 88 | 89 | If ! is given, you won't get prompted. 90 | 91 | It also supports session persistence, so once a session is loaded, it gets 92 | saved automatically when Vim is quit: |g:startify_session_persistence| 93 | 94 | ============================================================================== 95 | OPTIONS *startify-options* 96 | 97 | Put these variables into your vimrc. The shown assignments are also the 98 | default values. 99 | 100 | Most used options:~ 101 | |g:startify_bookmarks| 102 | |g:startify_change_to_dir| 103 | |g:startify_change_to_vcs_root| 104 | |g:startify_change_cmd| 105 | |g:startify_custom_header| 106 | |g:startify_enable_special| 107 | |g:startify_list_order| 108 | |g:startify_lists| 109 | |g:startify_skiplist| 110 | |g:startify_update_oldfiles| 111 | 112 | Misc options:~ 113 | |g:startify_commands| 114 | |g:startify_custom_footer| 115 | |g:startify_custom_header_quotes| 116 | |g:startify_custom_indices| 117 | |g:startify_disable_at_vimenter| 118 | |g:startify_enable_unsafe| 119 | |g:startify_files_number| 120 | |g:startify_fortune_use_unicode| 121 | |g:startify_padding_left| 122 | |g:startify_relative_path| 123 | |g:startify_skiplist_server| 124 | |g:startify_use_env| 125 | 126 | Sessions:~ 127 | |g:startify_session_autoload| 128 | |g:startify_session_before_save| 129 | |g:startify_session_delete_buffers| 130 | |g:startify_session_dir| 131 | |g:startify_session_number| 132 | |g:startify_session_persistence| 133 | |g:startify_session_remove_lines| 134 | |g:startify_session_savecmds| 135 | |g:startify_session_savevars| 136 | |g:startify_session_sort| 137 | 138 | ------------------------------------------------------------------------------ 139 | *g:startify_session_dir* 140 | > 141 | let g:startify_session_dir = '~/.vim/session' 142 | < 143 | The directory to save/load sessions to/from. 144 | 145 | Defaults:~ 146 | 147 | Nvim: `$XDG_DATA_HOME/nvim/session` (`:echo stdpath('data')`) 148 | Vim (Unix): `$HOME/.vim/session` 149 | Vim (Windows): `$HOME/vimfiles/session` 150 | 151 | ------------------------------------------------------------------------------ 152 | *g:startify_list_order* 153 | 154 | This option is DEPRECATED in favor of |g:startify_lists|. 155 | 156 | ------------------------------------------------------------------------------ 157 | *g:startify_lists* 158 | > 159 | let g:startify_lists = [ 160 | \ { 'type': 'files', 'header': [' MRU'] }, 161 | \ { 'type': 'dir', 'header': [' MRU '. getcwd()] }, 162 | \ { 'type': 'sessions', 'header': [' Sessions'] }, 163 | \ { 'type': 'bookmarks', 'header': [' Bookmarks'] }, 164 | \ { 'type': 'commands', 'header': [' Commands'] }, 165 | \ ] 166 | < 167 | Startify displays lists. Each list consists of a `type` and optionally a `header` 168 | and custom `indices`. 169 | 170 | The 'type' is either a string of a built-in type or a |Funcref|. 171 | 172 | The 'header' is a list of strings, whereas each string will be put on its own 173 | line in the header. 174 | 175 | The 'indices' is a list of strings, which act as indices for the current list. 176 | Opposed to the global |g:startify_custom_indices|, this is limited to the 177 | current list. 178 | 179 | Built-in types:~ 180 | 181 | 'files' 182 | 183 | This lists the most recently used files using viminfo. The number of files 184 | is limited by |g:startify_files_number|. 185 | 186 | 'dir' 187 | 188 | This lists the files from the current directory sorted by modification 189 | time. The number of files is limited by |g:startify_files_number|. 190 | 191 | 'bookmarks' 192 | 193 | This lists bookmarks, thus hardcoded files or directories that will always 194 | be shown. Have a look at |g:startify_bookmarks|. 195 | 196 | 'sessions' 197 | 198 | This lists all the sessions saved in the directory |g:startify_session_dir|. 199 | 200 | 'commands' 201 | 202 | This lists commands defined in |g:startify_commands|. 203 | 204 | Funcref type:~ 205 | 206 | The referenced function must return a list of dictionaries. Each dictionary 207 | is an entry that consists of these keys: 208 | 209 | 'line' The text to display for this entry. (required) 210 | 211 | 'cmd' The Vim command to execute when the entry gets chosen. 212 | (required unless 'path' is given) 213 | 214 | 'path' Points to a file. This way you can even use the standard markers 215 | like `s` or `v` etc. to open multiple entries at once. 216 | (required unless 'cmd' is given) 217 | 218 | Example #1:~ 219 | > 220 | function s:foobar() 221 | return [ 222 | \ { 'line': 'foo', 'cmd': 'echo "FOO!"' }, 223 | \ { 'line': 'bar', 'cmd': 'echo "BAR!"' }, 224 | \ ] 225 | endfunction 226 | 227 | let g:startify_lists = [ 228 | \ { 'type': 'files', 'header': [' MRU:'] }, 229 | \ { 'type': function('s:foobar'), 'header': ['foo', ' and', ' bar'] }, 230 | \ ] 231 | < 232 | Example #2:~ 233 | 234 | This more practical example assumes a git repo at ~/repo and vim-fugitive 235 | installed (for `:Git`). 236 | > 237 | function! s:list_commits() 238 | let git = 'git -C ~/repo' 239 | let commits = systemlist(git .' log --oneline | head -n10') 240 | let git = 'G'. git[1:] 241 | return map(commits, '{"line": matchstr(v:val, "\\s\\zs.*"), "cmd": "'. git .' show ". matchstr(v:val, "^\\x\\+") }') 242 | endfunction 243 | 244 | let g:startify_lists = [ 245 | \ { 'header': [' MRU'], 'type': 'files' }, 246 | \ { 'header': [' MRU '. getcwd()], 'type': 'dir' }, 247 | \ { 'header': [' Sessions'], 'type': 'sessions' }, 248 | \ { 'header': [' Commits'], 'type': function('s:list_commits') }, 249 | \ ] 250 | < 251 | NOTE: Headers are context-sensitive: If the list for a type is empty, the 252 | header won't be shown. 253 | 254 | NOTE: Headers use the StartifySection highlight group. See |startify-colors|. 255 | 256 | ------------------------------------------------------------------------------ 257 | *g:startify_bookmarks* 258 | > 259 | let g:startify_bookmarks = [] 260 | < 261 | A list of files or directories to bookmark. The list can contain two kinds of 262 | types. Either a path or a dictionary whereas the key is the custom index and 263 | the value is the path. 264 | 265 | Example: 266 | > 267 | let g:startify_bookmarks = [ {'c': '~/.vimrc'}, '~/.zshrc' ] 268 | < 269 | NOTE: Avoid using keys from |startify-mappings| if providing custom indices. 270 | 271 | ------------------------------------------------------------------------------ 272 | *g:startify_commands* 273 | > 274 | let g:startify_commands = [] 275 | < 276 | A list of commands to execute on selection. Leading colons are optional. It 277 | supports optional custom indices and/or command descriptions. 278 | 279 | Example: 280 | > 281 | let g:startify_commands = [ 282 | \ ':help reference', 283 | \ ['Vim Reference', 'h ref'], 284 | \ {'h': 'h ref'}, 285 | \ {'m': ['My magical function', 'call Magic()']}, 286 | \ ] 287 | < 288 | NOTE: Avoid using keys from |startify-mappings| if providing custom indices. 289 | 290 | ------------------------------------------------------------------------------ 291 | *g:startify_files_number* 292 | > 293 | let g:startify_files_number = 10 294 | < 295 | The number of files to list. 296 | 297 | ------------------------------------------------------------------------------ 298 | *g:startify_update_oldfiles* 299 | > 300 | let g:startify_update_oldfiles = 0 301 | < 302 | Usually |v:oldfiles| only gets updated when Vim exits. Using this option updates 303 | it on-the-fly, so that :Startify is always up-to-date. 304 | 305 | ------------------------------------------------------------------------------ 306 | *g:startify_session_autoload* 307 | > 308 | let g:startify_session_autoload = 0 309 | < 310 | If this option is enabled and you start Vim in a directory that contains a 311 | `Session.vim`, that session will be loaded automatically. Otherwise it will be 312 | shown as the top entry in the Startify buffer. 313 | 314 | The same happens when you |:cd| to a directory that contains a `Session.vim` 315 | and execute |:Startify|. 316 | 317 | It also works if you open a bookmarked directory. See |g:startify_bookmarks|. 318 | 319 | This is great way to create a portable project folder! 320 | 321 | NOTE: This option is affected by |g:startify_session_delete_buffers|. 322 | 323 | ------------------------------------------------------------------------------ 324 | *g:startify_session_before_save* 325 | > 326 | let g:startify_session_before_save = [] 327 | < 328 | This is a list of commands to be executed before saving a session. 329 | 330 | Example: 331 | > 332 | let g:startify_session_before_save = [ 'silent! tabdo NERDTreeClose' ] 333 | < 334 | ------------------------------------------------------------------------------ 335 | *g:startify_session_persistence* 336 | > 337 | let g:startify_session_persistence = 0 338 | < 339 | Automatically update sessions in two cases: 340 | 341 | - Before leaving Vim 342 | - Before loading a new session via :SLoad 343 | 344 | This also works for sessions started with: 345 | > 346 | vim -S mysession.vim 347 | < 348 | ------------------------------------------------------------------------------ 349 | *g:startify_session_delete_buffers* 350 | > 351 | let g:startify_session_delete_buffers = 1 352 | < 353 | Delete all buffers when loading or closing a session: 354 | 355 | - When using |startify-:SLoad|. 356 | - When using |startify-:SClose|. 357 | - When using |g:startify_session_autoload|. 358 | - When choosing a session from the Startify buffer. 359 | 360 | NOTE: Buffers with unsaved changes are silently ignored. 361 | 362 | ------------------------------------------------------------------------------ 363 | *g:startify_change_to_dir* 364 | > 365 | let g:startify_change_to_dir = 1 366 | < 367 | When opening a file or bookmark, change to its directory. 368 | 369 | You want to disable this, if you're using |'autochdir'| as well. 370 | 371 | NOTE: It defaults to 1, because that was already the behaviour at the time 372 | this option was introduced. 373 | 374 | ------------------------------------------------------------------------------ 375 | *g:startify_change_to_vcs_root* 376 | > 377 | let g:startify_change_to_vcs_root = 0 378 | < 379 | When opening a file or bookmark, seek and change to the root directory of the 380 | VCS (if there is one). 381 | 382 | At the moment only git, hg, bzr and svn are supported. 383 | 384 | ------------------------------------------------------------------------------ 385 | *g:startify_change_cmd* 386 | > 387 | let g:startify_change_cmd = 'lcd' 388 | < 389 | The default command for switching directories. Valid values: 390 | 391 | 'cd' (|:cd|) 392 | 'lcd' (|:lcd|) 393 | 'tcd' (|:tcd|) 394 | 395 | Affects |g:startify_change_to_dir| and |g:startify_change_to_vcs_root|. 396 | 397 | ------------------------------------------------------------------------------ 398 | *g:startify_skiplist* 399 | > 400 | let g:startify_skiplist = [] 401 | < 402 | A list of Vim regular expressions that is used to filter recently used files. 403 | See |pattern.txt| for what patterns can be used. 404 | 405 | The following patterns are filtered by default: 406 | 407 | 'runtime/doc/.*\.txt$' 408 | 'bundle/.*/doc/.*\.txt$' 409 | 'plugged/.*/doc/.*\.txt$' 410 | '/.git/' 411 | 'fugitiveblame$' 412 | escape(fnamemodify(resolve($VIMRUNTIME), ':p'), '\') .'doc/.*\.txt$' 413 | 414 | NOTE: Due to the nature of patterns, you can't just use "~/mysecret" but have 415 | to use "$HOME .'/mysecret.txt'". The former would do something entirely 416 | different: |/\~|. 417 | 418 | NOTE: When using backslashes as path separators, escape them. Otherwise using 419 | "C:\this\vim\path\is\problematic" would not match what you would expect, since 420 | |/\v| is a pattern, too. 421 | 422 | Example: 423 | > 424 | let g:startify_skiplist = [ 425 | \ '\.vimgolf', 426 | \ '^/tmp', 427 | \ '/project/.*/documentation', 428 | \ escape(fnamemodify($HOME, ':p'), '\') .'mysecret.txt', 429 | \ ] 430 | < 431 | ------------------------------------------------------------------------------ 432 | *g:startify_fortune_use_unicode* 433 | > 434 | let g:startify_fortune_use_unicode = 0 435 | < 436 | By default, the fortune header uses ASCII characters, because they work for 437 | everyone. If you set this option to 1 and your 'encoding' is "utf-8", Unicode 438 | box-drawing characters will be used instead. 439 | 440 | This is not the default, because users of East Asian languages often set 441 | 'ambiwidth' to "double" or make their terminal emulator treat characters of 442 | ambiguous width as double width. Both would make the drawn box look funny. 443 | 444 | For more information: http://unicode.org/reports/tr11 445 | 446 | ------------------------------------------------------------------------------ 447 | *g:startify_padding_left* 448 | > 449 | let g:startify_padding_left = 3 450 | < 451 | The number of spaces used for left padding. 452 | 453 | ------------------------------------------------------------------------------ 454 | *g:startify_skiplist_server* 455 | > 456 | let g:startify_skiplist_server = [] 457 | < 458 | Do not create the startify buffer, if this is a Vim server instance with a 459 | name contained in this list. 460 | 461 | Example: 462 | > 463 | let g:startify_skiplist_server = [ 'GVIM' ] 464 | < 465 | ------------------------------------------------------------------------------ 466 | *g:startify_enable_special* 467 | > 468 | let g:startify_enable_special = 1 469 | < 470 | Show and . 471 | ------------------------------------------------------------------------------ 472 | *g:startify_enable_unsafe* 473 | > 474 | let g:startify_enable_unsafe = 0 475 | < 476 | Enable the option only in case you think Vim starts too slowly (because of 477 | :Startify) or if you often edit files on remote filesystems. 478 | 479 | It's called unsafe because it improves the time :Startify needs to execute by 480 | reducing the amount of syscalls to the underlying operating system, but 481 | sacrifices the precision of shown entries. 482 | 483 | This could lead to inconsistences in the shown :Startify entries (e.g. the 484 | same file could be shown twice, because one time file was opened via absolute 485 | path and another time via symlink). 486 | 487 | Currently this option does this: 488 | 489 | - don't resolves symlinks (readlink(2)) 490 | - don't check every file if it's readable (stat(2)) 491 | - don't filter through the bookmark list 492 | 493 | ------------------------------------------------------------------------------ 494 | *g:startify_session_remove_lines* 495 | > 496 | let g:startify_session_remove_lines = [] 497 | < 498 | Lines matching any of the patterns in this list, will be removed from the 499 | session file. 500 | 501 | Example: 502 | > 503 | let g:startify_session_remove_lines = ['setlocal', 'winheight'] 504 | < 505 | Internally this simply does: 506 | > 507 | :global/setlocal/delete 508 | :global/winheight/delete 509 | < 510 | So you can use any |pattern|. 511 | 512 | NOTE: Take care not to mess up any expressions within the session file, 513 | otherwise you'll probably get problems when trying to load it. 514 | 515 | ------------------------------------------------------------------------------ 516 | *g:startify_session_savevars* 517 | > 518 | let g:startify_session_savevars = [] 519 | < 520 | Include a list of variables in here which you would like Startify to save into 521 | the session file in addition to what Vim normally saves into the session file. 522 | For example, Vim will not normally save all-lowercase global variables, which 523 | are common for plugin settings. It may be advisable to include 524 | |g:startify_session_savevars| and |g:startify_session_savecmds| into this list 525 | so they are saved every time the session saves. 526 | 527 | Example: 528 | > 529 | let g:startify_session_savevars = [ 530 | \ 'g:startify_session_savevars', 531 | \ 'g:startify_session_savecmds', 532 | \ 'g:random_plugin_use_feature' 533 | \ ] 534 | < 535 | ------------------------------------------------------------------------------ 536 | *g:startify_session_savecmds* 537 | > 538 | let g:startify_session_savecmds = [] 539 | < 540 | Include a list of cmdline commands which Vim will run upon loading the 541 | session. This can be useful to set various things (other than variables, 542 | |g:startify_session_savevars| above) which Vim may not normally save into the 543 | session file, as well as run external commands upon loading a session. 544 | 545 | Example: 546 | > 547 | let g:startify_session_savecmds = [ 548 | \ 'silent !pdfreader ~/latexproject/main.pdf &' 549 | \ ] 550 | < 551 | ------------------------------------------------------------------------------ 552 | *g:startify_session_number* 553 | > 554 | let g:startify_session_number = 999 555 | < 556 | The maximum number of sessions to display. Makes the most sense together with 557 | |g:startify_session_sort|. 558 | 559 | ------------------------------------------------------------------------------ 560 | *g:startify_session_sort* 561 | > 562 | let g:startify_session_sort = 0 563 | < 564 | Sort sessions by modification time (when the session files were written) 565 | rather than alphabetically. 566 | 567 | ------------------------------------------------------------------------------ 568 | *g:startify_custom_indices* 569 | > 570 | let g:startify_custom_indices = [] 571 | < 572 | Use any list of strings as indices instead of increasing numbers. If there are 573 | more startify entries than actual items in the custom list, the remaining 574 | entries will be filled using the default numbering scheme starting from 0. 575 | 576 | Thus you can create your own indexing scheme that fits your keyboard layout. 577 | You don't want to leave the home row, do you?! 578 | 579 | Example: 580 | > 581 | let g:startify_custom_indices = ['f', 'g', 'h'] 582 | < 583 | This would result in: 584 | 585 | [f] /most/recently/used/file1 586 | [g] /most/recently/used/file2 587 | [h] /most/recently/used/file3 588 | [0] /most/recently/used/file4 589 | [1] /most/recently/used/file5 590 | [2] /most/recently/used/file6 591 | etc. 592 | 593 | If you want numbers to start at 1 instead of 0, you could use this: 594 | > 595 | let g:startify_custom_indices = map(range(1,100), 'string(v:val)') 596 | < 597 | NOTE: There is no sanitizing going on, so you should know what you're doing! 598 | Avoid using keys from |startify-mappings|. 599 | 600 | ------------------------------------------------------------------------------ 601 | *g:startify_custom_header* 602 | > 603 | let g:startify_custom_header = 'startify#pad(startify#fortune#cowsay())' 604 | < 605 | Define your own header. 606 | 607 | This option takes a `list of strings`, whereas each string will be put on its 608 | own line. If it is a simple `string`, it should evaluate to a list of strings. 609 | 610 | Helper functions:~ 611 | 612 | startify#fortune#quote() random quote 613 | startify#fortune#boxed(...) random quote in a box 614 | startify#fortune#cowsay(...) random quote in a box + cow 615 | 616 | The last two functions optionally take a quote in the list of strings format. 617 | They also return a list of strings, suitable for this option. 618 | 619 | startify#pad([strings]) pad strings in list according to 620 | |g:startify_padding_left| or the default of 3 621 | startify#center([strings]) center list of strings without removing 622 | its strings indentations 623 | 624 | Example #1:~ 625 | > 626 | let g:startify_custom_header = [ 627 | \ ' ________ __ __ ', 628 | \ ' __ /\_____ \/\ \\ \ ', 629 | \ ' __ __ /\_\ ___ ___ \/___//''/''\ \ \\ \ ', 630 | \ ' /\ \/\ \\/\ \ /'' __` __`\ /'' /'' \ \ \\ \_ ', 631 | \ ' \ \ \_/ |\ \ \/\ \/\ \/\ \ /'' /''__ \ \__ ,__\', 632 | \ ' \ \___/ \ \_\ \_\ \_\ \_\ /\_/ /\_\ \/_/\_\_/ ', 633 | \ ' \/__/ \/_/\/_/\/_/\/_/ \// \/_/ \/_/ ', 634 | \ ] 635 | < 636 | Example #2:~ 637 | > 638 | let g:startify_custom_header = 639 | \ startify#pad(split(system('fortune | cowsay'), '\n')) 640 | < 641 | Example #3:~ 642 | 643 | Let's assume you like the default boxed random quote, but not the ASCII art 644 | cow. You'd rather have another small ASCII art come before the quote. No 645 | problem! 646 | > 647 | let g:ascii = [ 648 | \ ' __', 649 | \ '.--.--.|__|.--------.', 650 | \ '| | || || |', 651 | \ ' \___/ |__||__|__|__|', 652 | \ '' 653 | \] 654 | let g:startify_custom_header = g:ascii + startify#fortune#boxed() 655 | < 656 | Looks great! But it's not on the same column as the indices below which makes 657 | it look awkward. Let's indent the header by 3 spaces: 658 | > 659 | let g:startify_custom_header = 660 | \ startify#pad(g:ascii + startify#fortune#boxed()) 661 | < 662 | Ah, much better! There's only one issue left. If you set 663 | g:startify_custom_header this way, it will only be done once. Hence spamming 664 | :Startify will always show the same quote. 665 | 666 | If you provide a string to it instead, Startify will evaluate it every time 667 | :Startify is run: 668 | > 669 | let g:startify_custom_header = 670 | \ 'startify#pad(g:ascii + startify#fortune#boxed())' 671 | < 672 | Happy customizing! 673 | 674 | Also have a look at |startify-faq-08|. 675 | 676 | ------------------------------------------------------------------------------ 677 | *g:startify_custom_header_quotes* 678 | 679 | If you don't set |g:startify_custom_header|, the internal cowsay implementation 680 | with predefined random quotes will be used. 681 | 682 | To use your own quotes, set this option to a list of quotes. Each quote is 683 | either another list or a |Funcref| (see |expr-lambda|) that returns a list. 684 | 685 | Each element of the inner lists is put on an own line in the custom header. 686 | > 687 | let g:startify_custom_header_quotes = [ 688 | \ ['quote #1'], 689 | \ ['quote #2', 'using', 'three lines'], 690 | \ {-> systemlist('echo quote #3')} 691 | \ ] 692 | < 693 | If you want the predefined quotes as well, use this: 694 | > 695 | let g:startify_custom_header_quotes = 696 | \ startify#fortune#predefined_quotes() + [['quote 1', 'quote 2']] 697 | < 698 | ------------------------------------------------------------------------------ 699 | *g:startify_custom_footer* 700 | > 701 | let g:startify_custom_footer = '' 702 | < 703 | Same as the custom header, but shown at the bottom of the startify buffer. 704 | 705 | ------------------------------------------------------------------------------ 706 | *g:startify_disable_at_vimenter* 707 | > 708 | let g:startify_disable_at_vimenter = 0 709 | < 710 | Don't run Startify at Vim startup. You can still call it anytime via 711 | :Startify. 712 | 713 | ----------------------------------------------------------------------------- 714 | *g:startify_relative_path* 715 | > 716 | let g:startify_relative_path = 0 717 | < 718 | If the file is in or below the current working directory, use a relative path. 719 | Otherwise an absolute path is used. The latter prevents hard to grasp entries 720 | like `../../../../../foo`. 721 | 722 | NOTE: This only applies to the "files" list, since the "dir" list is 723 | relative by nature. 724 | 725 | ----------------------------------------------------------------------------- 726 | *g:startify_use_env* 727 | > 728 | let g:startify_use_env = 0 729 | < 730 | Show environment variables in path, if their name is shorter than their value. 731 | See |startify-colors| for highlighting them. 732 | 733 | $PWD and $OLDPWD are ignored. 734 | 735 | ============================================================================== 736 | AUTOCMD *startify-autocmd* 737 | 738 | In certain situations Startify emits events which can be hooked into via 739 | |autocmd|s. Those can be used for further customization. 740 | 741 | StartifyReady~ 742 | 743 | When the Startify buffer is ready. 744 | 745 | StartifyBufferOpened~ 746 | 747 | For each buffer that got opened by Startify. When you open multiple files at 748 | once (see |startify-usage|), this event fires multiple times as well. 749 | 750 | StartifyAllBuffersOpened~ 751 | 752 | No matter how many buffers you open, this event fires only once after the 753 | last buffer was opened. 754 | 755 | Example: 756 | > 757 | autocmd User StartifyReady let &l:stl = ' This statusline rocks!' 758 | < 759 | Or use it to disable single mappings: |startify-faq-16|. 760 | 761 | NOTE: Autocmds don't nest by default. If you use any command that triggers new 762 | events, be sure to add "nested": |autocmd-nested|. 763 | 764 | ============================================================================== 765 | COMMANDS *startify-commands* 766 | *startify-:Startify* 767 | > 768 | :Startify 769 | < 770 | Open the startify buffer. 771 | *startify-:SSave* 772 | *startify-:SDelete* 773 | > 774 | :SSave[!] [session] 775 | :SDelete[!] [session] 776 | < 777 | Save or delete a session. If you don't specify a session name, it will prompt 778 | you for one. 779 | 780 | Use `:SSave!` or `:SDelete!` to always overwrite or delete an existing session. 781 | 782 | *startify-:SLoad* 783 | > 784 | :SLoad[!] [session] 785 | < 786 | Load a session. If you don't specify a session name, it will prompt you for 787 | one. 788 | 789 | If the `!` is given, it tries to source the last used session (only Unix). 790 | 791 | Providing only a part of the session name works too, if you complete the 792 | argument with either or afterwards. 793 | 794 | NOTE: This command is affected by |g:startify_session_delete_buffers|. 795 | 796 | *startify-:SClose* 797 | > 798 | :SClose 799 | < 800 | Save and close the current session, close all listed buffers, and open the 801 | Startify buffer. 802 | 803 | NOTE: This command is affected by |g:startify_session_delete_buffers|. 804 | 805 | ============================================================================== 806 | MAPPINGS *startify-mappings* 807 | 808 | Some things are remapped in the startify buffer.. 809 | > 810 | q 811 | < 812 | Close startify. Also quit Vim if it is the only buffer. 813 | > 814 | e 815 | < 816 | Close startify and create a blank buffer. 817 | > 818 | i 819 | 820 | < 821 | Close startify, create a blank buffer and jump into insert mode right away. 822 | > 823 | <2-LeftMouse> 824 | < 825 | Use a simple mouse click to open the targeted entry. 826 | > 827 | [any number that is shown between square brackets] 828 | < 829 | Open the entry with the given number. 830 | > 831 | b 832 | s 833 | v 834 | t 835 | < 836 | Mark current entry to be opened in either the same window, in a split window, 837 | in a vertical split window or in a new tab. 838 | > 839 | 840 | < 841 | Open all marked entries. If nothing was marked beforehand, just open the 842 | current entry. 843 | 844 | If you want to use another key instead of , put this in your vimrc: 845 | > 846 | autocmd User Startified nmap o (startify-open-buffers) 847 | < 848 | ============================================================================== 849 | COLORS *startify-colors* 850 | 851 | You can overwrite the highlight groups used by startify. The plugin defines 852 | these groups: 853 | 854 | Highlight group | Description | Default 855 | ------------------------------------------------------------------ 856 | | | 857 | StartifyBracket | [,] | linked to Delimiter 858 | StartifyFile | the actual file | linked to Identifier 859 | StartifyFooter | the custom footer | linked to Title 860 | StartifyHeader | the custom header | linked to Title 861 | StartifyNumber | the numbers between [] | linked to Number 862 | StartifyPath | the path to a file | linked to Directory 863 | StartifySection | section headers | linked to Statement 864 | StartifySelect | selected entries | linked to Title 865 | StartifySlash | slashes in paths | linked to Delimiter 866 | StartifySpecial | , | linked to Comment 867 | StartifyVar | environment variables | linked to StartifyPath 868 | 869 | Example: (my terminal emulator supports 256 colors) 870 | > 871 | highlight StartifyBracket ctermfg=240 872 | highlight StartifyFooter ctermfg=240 873 | highlight StartifyHeader ctermfg=114 874 | highlight StartifyNumber ctermfg=215 875 | highlight StartifyPath ctermfg=245 876 | highlight StartifySlash ctermfg=240 877 | highlight StartifySpecial ctermfg=240 878 | < 879 | ============================================================================== 880 | MISC *startify-misc* 881 | 882 | Changing the entry format:~ 883 | 884 | You can create a function `StartifyEntryFormat()` which returns a string that 885 | gets evaluated in Startify. In that string, `entry_path` and `absolute_path` 886 | will be replaced by their respective values. 887 | 888 | `absolute_path` is self-explaining and `entry_path` is the same path but 889 | potentially shortened, depending on options like |g:startify_relative_path|. 890 | 891 | Let us assume you have vim-devicons installed. That plugin has a function 892 | `WebDevIconsGetFileTypeSymbol()` which returns an icon depending on the given 893 | file. Prepend the logo to each Startify entry by putting this in your vimrc: 894 | > 895 | function! StartifyEntryFormat() 896 | return 'WebDevIconsGetFileTypeSymbol(absolute_path) ." ". entry_path' 897 | endfunction 898 | < 899 | ============================================================================== 900 | FAQ *startify-faq* 901 | 902 | |startify-faq-01| I want to use cursorline! 903 | |startify-faq-02| Recent files aren't shown! 904 | |startify-faq-03| I have broken colors when using sessions! 905 | |startify-faq-04| How to disable common but unimportant files? 906 | |startify-faq-05| Why is the Startify buffer not using buftype=nofile? 907 | |startify-faq-06| How do I get both NERDTree and Startify working at 908 | startup? 909 | |startify-faq-07| The session autoload feature is not working! 910 | |startify-faq-08| How do I center my header/footer? 911 | |startify-faq-09| tmux-resurrect? 912 | |startify-faq-10| Temporarily skip Startify at start? 913 | |startify-faq-11| How to use the output of a command as header? 914 | |startify-faq-12| There is an empty window with vim-plug! 915 | |startify-faq-13| How to disable random quotes header? 916 | |startify-faq-14| NERDTree with NERDTreeTabs does not work in gvim! 917 | |startify-faq-15| Startify is cluttered with help files! 918 | |startify-faq-16| How to disable single mappings? 919 | |startify-faq-17| Run Startify for each new tab! 920 | |startify-faq-18| Files from remote file system slow down startup! 921 | 922 | ------------------------------------------------------------------------------ 923 | *startify-faq-01* 924 | I want to use cursorline!~ 925 | 926 | Startify issues a User event when it's finished. It can be used to set 927 | buffer-local options etc. 928 | > 929 | autocmd User Startified setlocal cursorline 930 | < 931 | ------------------------------------------------------------------------------ 932 | *startify-faq-02* 933 | Recent files aren't shown!~ 934 | 935 | Perhaps the problem is that the viminfo file.. 936 | 937 | - doesn't exist 938 | - is invalid 939 | - is empty 940 | - can't be read (check permissions) 941 | 942 | I suggest the following steps: 943 | 944 | 1) Create a new directory: 945 | > 946 | $ mkdir -p ~/.vim/files/info 947 | < 948 | 2) Put this into your vimrc: 949 | > 950 | set viminfo='100,n$HOME/.vim/files/info/viminfo 951 | < 952 | See |'viminfo'| for information about the second step and what it does 953 | exactly. 954 | 955 | ------------------------------------------------------------------------------ 956 | *startify-faq-03* 957 | I have broken colors when using sessions!~ 958 | 959 | Nothing this plugin could do about. Try playing around with 'sessionoptions'. 960 | 961 | NOTE: Startify removes 'options' from the session options automatically, 962 | because it's the source of many problems. 963 | 964 | Some people swear it works for them with these settings: 965 | > 966 | set sessionoptions=blank,curdir,folds,help,tabpages,winpos 967 | < 968 | ------------------------------------------------------------------------------ 969 | *startify-faq-04* 970 | How to disable common but unimportant files?~ 971 | 972 | Use |g:startify_skiplist|. 973 | 974 | ------------------------------------------------------------------------------ 975 | *startify-faq-05* 976 | Why is the Startify buffer not using buftype=nofile?~ 977 | 978 | Did you accidentally use |:write| in the Startify buffer and it was saved to 979 | an actual file on disk? It's because buftype=nofile is not used. 980 | 981 | This is done to improve compatibility with other plugins. When buftype=nofile 982 | was set, plugins like CtrlP or NERDTree would open splits instead of reusing 983 | the window showing the Startify buffer. 984 | 985 | If you understand this but want it anyway, put this in your vimrc: 986 | > 987 | autocmd User Startified setlocal buftype=nofile 988 | < 989 | ------------------------------------------------------------------------------ 990 | *startify-faq-06* 991 | How do I get both NERDTree and Startify working at startup?~ 992 | 993 | Put this in your vimrc: 994 | > 995 | autocmd VimEnter * 996 | \ if !argc() 997 | \ | Startify 998 | \ | NERDTree 999 | \ | wincmd w 1000 | \ | endif 1001 | < 1002 | ------------------------------------------------------------------------------ 1003 | *startify-faq-07* 1004 | The session autoload feature is not working!~ 1005 | 1006 | Do you have NERDTree installed by any chance? If so, try this: 1007 | > 1008 | let NERDTreeHijackNetrw = 0 1009 | < 1010 | ------------------------------------------------------------------------------ 1011 | *startify-faq-08* 1012 | How do I center my header/footer?~ 1013 | > 1014 | let g:startify_custom_header = 1015 | \ 'startify#center(startify#fortune#cowsay())' 1016 | < 1017 | ------------------------------------------------------------------------------ 1018 | *startify-faq-09* 1019 | tmux-resurrect?~ 1020 | 1021 | If you use tmux-resurrect to restore your tmux environment, you can use :SLoad 1022 | to load your last used session right away: 1023 | > 1024 | set -g @resurrect-processes '"vim->vim +SLoad"' 1025 | < 1026 | ------------------------------------------------------------------------------ 1027 | *startify-faq-10* 1028 | Temporarily skip Startify at start?~ 1029 | 1030 | In some cases you might need to skip Startify at start. E.g. 1031 | > 1032 | vim +VimwikiMakeDiaryNote 1033 | < 1034 | Startify would interfere in this case. A simple way to avoid that would be: 1035 | > 1036 | vim --cmd 'let g:startify_disable_at_vimenter = 1' +VimwikiMakeDiaryNote 1037 | < 1038 | ------------------------------------------------------------------------------ 1039 | *startify-faq-11* 1040 | How to use the output of a command as header?~ 1041 | > 1042 | redir => test 1043 | silent echo 'one' 1044 | silent echo 'two' 1045 | silent echo 'three' 1046 | redir END 1047 | 1048 | let g:startify_custom_header = 1049 | \ map(split(test), 'repeat(" ", 10) . v:val') 1050 | < 1051 | |:redir| puts a string into 'test'. Then we turn it into a list of strings. 1052 | Then we shift each string to the right by 10 spaces. Afterwards we add an 1053 | empty string to the list, which results in an empty line in the header. 1054 | 1055 | ------------------------------------------------------------------------------ 1056 | *startify-faq-12* 1057 | There is an empty window with vim-plug!~ 1058 | 1059 | After start there might be only the Startify buffer which is marked as 1060 | |unlisted-buffer|. The problem arises if you use :PlugUpdate followed by 'D' 1061 | to see the changes. An empty window! 1062 | 1063 | The actual problem is that Vim won't close the last listed buffer. Try this: 1064 | > 1065 | $ vim -u NONE -N 1066 | :set nobuflisted 1067 | :new 1068 | :bd 1069 | < 1070 | It won't close the buffer and therefore the window. This also happens in 1071 | vim-plug. Note that this is no bug in neither plugin, it's a Vim weirdness. 1072 | 1073 | Workaround #1:~ 1074 | > 1075 | autocmd User Startified setlocal buflisted 1076 | < 1077 | In some cases this could break other plugins at start (I look at you 1078 | NERDTree), but works well most of the time. 1079 | 1080 | Workaround #2:~ 1081 | > 1082 | let g:plug_window = 'enew' " or maybe 'tabnew' 1083 | < 1084 | This will open the plug buffer in the current window instead of creating a new 1085 | window on the left side. Mind that this will also close the Startify buffer 1086 | since it will be hidden. 1087 | 1088 | ------------------------------------------------------------------------------ 1089 | *startify-faq-13* 1090 | How to disable random quotes header?~ 1091 | > 1092 | let g:startify_custom_header = [] 1093 | < 1094 | See |g:startify_custom_header|. 1095 | 1096 | ------------------------------------------------------------------------------ 1097 | *startify-faq-14* 1098 | NERDTree with NERDTreeTabs does not work in gvim!~ 1099 | 1100 | Mind that `https://github.com/jistr/vim-nerdtree-tabs` is no longer maintained 1101 | and has quite some issues. 1102 | 1103 | Anyway, this particular issue can be resolved in different ways. See: 1104 | 1105 | https://github.com/mhinz/vim-startify/issues/24 1106 | 1107 | ------------------------------------------------------------------------------ 1108 | *startify-faq-15* 1109 | Startify is cluttered with help files!~ 1110 | 1111 | Every time you use |:h|, you open a file from the Vim runtime directory or of 1112 | an installed plugin. By default, Startify detects these files and skips them. 1113 | 1114 | This works for most use cases, but not for all. 1115 | 1116 | If the default fails for you and the Startify buffer is cluttered with help 1117 | files, add that path to the skiplist yourself: |g:startify_skiplist|. 1118 | 1119 | ------------------------------------------------------------------------------ 1120 | *startify-faq-16* 1121 | How to disable single mappings?~ 1122 | 1123 | Use |startify-autocmd|: 1124 | > 1125 | autocmd User Startified for key in ['b','s','t','v'] | 1126 | \ execute 'nunmap ' key | endfor 1127 | < 1128 | ------------------------------------------------------------------------------ 1129 | *startify-faq-17* 1130 | Run Startify for each new tab!~ 1131 | > 1132 | if has('nvim') 1133 | autocmd TabNewEntered * Startify 1134 | else 1135 | autocmd BufWinEnter * 1136 | \ if !exists('t:startify_new_tab') 1137 | \ && empty(expand('%')) 1138 | \ && empty(&l:buftype) 1139 | \ && &l:modifiable | 1140 | \ let t:startify_new_tab = 1 | 1141 | \ Startify | 1142 | \ endif 1143 | endif 1144 | < 1145 | NOTE: I do not recommend this. It can lead to all kinds of issues, so you 1146 | should know exactly what the above code does. E.g. any plugin using |:tabnew| 1147 | is probably expecting an empty buffer afterwards, but it won't be empty, it 1148 | will be filled with the Startify buffer and fail. I suggest mapping 1149 | `:Startify` to something convenient instead. 1150 | 1151 | ------------------------------------------------------------------------------ 1152 | *startify-faq-18* 1153 | Files from remote file system slow down startup!~ 1154 | 1155 | I/O actions like resolving symbolic links or checking if a file is readable 1156 | can be very slow on some remote file systems (Samba, NFS, FUSE, etc.) Even 1157 | more so when done for many files. 1158 | 1159 | In that case it is often better to add the mount point of the remote file 1160 | system to |g:startify_skiplist|: 1161 | > 1162 | let g:startify_skiplist = ['^/mnt/nfs'] 1163 | < 1164 | ============================================================================== 1165 | EXAMPLE *startify-example* 1166 | > 1167 | autocmd User Startified setlocal cursorline 1168 | 1169 | let g:startify_enable_special = 0 1170 | let g:startify_files_number = 8 1171 | let g:startify_relative_path = 1 1172 | let g:startify_change_to_dir = 1 1173 | let g:startify_update_oldfiles = 1 1174 | let g:startify_session_autoload = 1 1175 | let g:startify_session_persistence = 1 1176 | 1177 | let g:startify_skiplist = [ 1178 | \ 'COMMIT_EDITMSG', 1179 | \ 'bundle/.*/doc', 1180 | \ '/data/repo/neovim/runtime/doc', 1181 | \ '/Users/mhi/local/vim/share/vim/vim74/doc', 1182 | \ ] 1183 | 1184 | let g:startify_bookmarks = [ 1185 | \ { 'c': '~/.vim/vimrc' }, 1186 | \ '~/golfing', 1187 | \ ] 1188 | 1189 | let g:startify_custom_header = 1190 | \ startify#fortune#cowsay('', '═','║','╔','╗','╝','╚') 1191 | 1192 | let g:startify_custom_footer = 1193 | \ ['', " Vim is charityware. Please read ':help uganda'.", ''] 1194 | 1195 | hi StartifyBracket ctermfg=240 1196 | hi StartifyFile ctermfg=147 1197 | hi StartifyFooter ctermfg=240 1198 | hi StartifyHeader ctermfg=114 1199 | hi StartifyNumber ctermfg=215 1200 | hi StartifyPath ctermfg=245 1201 | hi StartifySlash ctermfg=240 1202 | hi StartifySpecial ctermfg=240 1203 | < 1204 | ============================================================================== 1205 | vim: tw=78 1206 | -------------------------------------------------------------------------------- /images/startify-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhinz/vim-startify/4e089dffdad46f3f5593f34362d530e8fe823dcf/images/startify-logo.png -------------------------------------------------------------------------------- /images/startify-menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhinz/vim-startify/4e089dffdad46f3f5593f34362d530e8fe823dcf/images/startify-menu.png -------------------------------------------------------------------------------- /plugin/startify.vim: -------------------------------------------------------------------------------- 1 | " vim: et sw=2 sts=2 2 | 3 | " Plugin: https://github.com/mhinz/vim-startify 4 | " Description: A fancy start screen for Vim. 5 | " Maintainer: Marco Hinz 6 | 7 | if exists('g:loaded_startify') || &cp 8 | finish 9 | endif 10 | let g:loaded_startify = 1 11 | let g:startify_locked = 0 12 | 13 | if !get(g:, 'startify_disable_at_vimenter') && (!has('nvim') || has('nvim-0.3.5')) 14 | " Only for Nvim v0.3.5+: https://github.com/neovim/neovim/issues/9885 15 | set shortmess+=I 16 | endif 17 | 18 | augroup startify 19 | autocmd VimEnter * nested call s:on_vimenter() 20 | autocmd VimLeavePre * nested call s:on_vimleavepre() 21 | autocmd QuickFixCmdPre *vimgrep* let g:startify_locked = 1 22 | autocmd QuickFixCmdPost *vimgrep* let g:startify_locked = 0 23 | augroup END 24 | 25 | function! s:update_oldfiles(file) 26 | if g:startify_locked || !exists('v:oldfiles') 27 | return 28 | endif 29 | let idx = index(v:oldfiles, a:file) 30 | if idx != -1 31 | call remove(v:oldfiles, idx) 32 | endif 33 | call insert(v:oldfiles, a:file, 0) 34 | endfunction 35 | 36 | function! s:on_vimenter() 37 | if !argc() && line('$') == 1 && getline('.') == '' 38 | if get(g:, 'startify_session_autoload') && filereadable('Session.vim') 39 | source Session.vim 40 | elseif !get(g:, 'startify_disable_at_vimenter') 41 | call startify#insane_in_the_membrane(1) 42 | endif 43 | endif 44 | if get(g:, 'startify_update_oldfiles') 45 | call map(v:oldfiles, 'fnamemodify(v:val, ":p")') 46 | autocmd startify BufNewFile,BufRead,BufFilePre * 47 | \ call s:update_oldfiles(expand(':p')) 48 | endif 49 | autocmd! startify VimEnter 50 | endfunction 51 | 52 | function! s:on_vimleavepre() 53 | if get(g:, 'startify_session_persistence') 54 | \ && exists('v:this_session') 55 | \ && filewritable(v:this_session) 56 | call startify#session_write(fnameescape(v:this_session)) 57 | endif 58 | endfunction 59 | 60 | command! -nargs=? -bar -bang -complete=customlist,startify#session_list SLoad call startify#session_load(0, ) 61 | command! -nargs=? -bar -bang -complete=customlist,startify#session_list SSave call startify#session_save(0, ) 62 | command! -nargs=? -bar -bang -complete=customlist,startify#session_list SDelete call startify#session_delete(0, ) 63 | command! -nargs=0 -bar SClose call startify#session_close() 64 | command! -nargs=0 -bar Startify call startify#insane_in_the_membrane(0) 65 | command! -nargs=0 -bar StartifyDebug call startify#debug() 66 | 67 | nnoremap (startify-open-buffers) :call startify#open_buffers() 68 | -------------------------------------------------------------------------------- /syntax/startify.vim: -------------------------------------------------------------------------------- 1 | " vim: et sw=2 sts=2 2 | 3 | " Plugin: https://github.com/mhinz/vim-startify 4 | " Description: A fancy start screen for Vim. 5 | " Maintainer: Marco Hinz 6 | 7 | if exists("b:current_syntax") 8 | finish 9 | endif 10 | 11 | let s:sep = startify#get_separator() 12 | let s:padding_left = repeat(' ', get(g:, 'startify_padding_left', 3)) 13 | 14 | syntax sync fromstart 15 | 16 | execute 'syntax match StartifyBracket /.*\%'. (len(s:padding_left) + 6) .'c/ contains= 17 | \ StartifyNumber, 18 | \ StartifySelect' 19 | syntax match StartifySpecial /\V\|/ 20 | syntax match StartifyNumber /^\s*\[\zs[^BSVT]\{-}\ze\]/ 21 | syntax match StartifySelect /^\s*\[\zs[BSVT]\{-}\ze\]/ 22 | syntax match StartifyVar /\$[^\/]\+/ 23 | syntax match StartifyFile /.*/ contains= 24 | \ StartifyBracket, 25 | \ StartifyPath, 26 | \ StartifySpecial, 27 | 28 | execute 'syntax match StartifySlash /\'. s:sep .'/' 29 | execute 'syntax match StartifyPath /\%'. (len(s:padding_left) + 6) .'c.*\'. s:sep .'/ contains=StartifySlash,StartifyVar' 30 | 31 | execute 'syntax region StartifyHeader start=/\%1l/ end=/\%'. (len(g:startify_header) + 2) .'l/' 32 | 33 | if exists('g:startify_custom_footer') 34 | execute 'syntax region StartifyFooter start=/\%'. startify#get_lastline() .'l/ end=/\_.*/' 35 | endif 36 | 37 | if exists('b:startify.section_header_lines') 38 | for line in b:startify.section_header_lines 39 | execute 'syntax region StartifySection start=/\%'. line .'l/ end=/$/' 40 | endfor 41 | endif 42 | 43 | highlight default link StartifyBracket Delimiter 44 | highlight default link StartifyFile Identifier 45 | highlight default link StartifyFooter Title 46 | highlight default link StartifyHeader Title 47 | highlight default link StartifyNumber Number 48 | highlight default link StartifyPath Directory 49 | highlight default link StartifySection Statement 50 | highlight default link StartifySelect Title 51 | highlight default link StartifySlash Delimiter 52 | highlight default link StartifySpecial Comment 53 | highlight default link StartifyVar StartifyPath 54 | 55 | let b:current_syntax = 'startify' 56 | -------------------------------------------------------------------------------- /test/feature/buffer.vader: -------------------------------------------------------------------------------- 1 | Before: 2 | enew! 3 | Startify 4 | 5 | Execute (Check buffer options): 6 | AssertEqual 'startify', &filetype 7 | AssertEqual 'wipe', &bufhidden 8 | AssertEqual '', &buftype 9 | AssertEqual 0, &buflisted 10 | AssertEqual 0, &cursorcolumn 11 | AssertEqual 0, &cursorline 12 | AssertEqual 0, &list 13 | AssertEqual 0, &number 14 | AssertEqual 0, &swapfile 15 | -------------------------------------------------------------------------------- /test/feature/mapping.vader: -------------------------------------------------------------------------------- 1 | Before: 2 | enew! 3 | Startify 4 | 5 | Do (Open new buffer in insert "foo"): 6 | ifoo 7 | Expect (Buffer contains only "foo"): 8 | foo 9 | 10 | Do (Open new buffer in normal mode and insert "bar"): 11 | eibar 12 | Expect (Buffer contains only "bar"): 13 | bar 14 | 15 | Given (Buffer that contains only "quux"): 16 | quux 17 | Do (Quit Startify buffer via 'q'): 18 | q 19 | Expect (Buffer before :Startify was called): 20 | quux 21 | -------------------------------------------------------------------------------- /test/feature/session.vader: -------------------------------------------------------------------------------- 1 | Before: 2 | enew! 3 | 4 | Execute (:SSave foo | SClose): 5 | edit include/testfile.txt 6 | SSave foo 7 | SClose 8 | Do (q): 9 | q 10 | Expect (): 11 | 12 | 13 | Execute (:SLoad foo): 14 | SLoad foo 15 | Expect (textfile.txt): 16 | This is just a simple test file. 17 | Foo, bar, quux. 18 | 19 | Execute (Session: :SDelete! foo): 20 | AssertEqual filereadable(g:startify_session_dir.'/foo'), 1 21 | SDelete! foo 22 | AssertEqual filereadable(g:startify_session_dir.'/foo'), 0 23 | -------------------------------------------------------------------------------- /test/include/testfile.txt: -------------------------------------------------------------------------------- 1 | This is just a simple test file. 2 | Foo, bar, quux. 3 | -------------------------------------------------------------------------------- /test/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Change to directory of this script. 4 | cd "${0%/*}" 5 | 6 | # Look for existing vader installation. 7 | vader=( ${HOME}/.vim/*bundle*/vader*/plugin/vader.vim ) 8 | if [ -f ${vader[0]} ]; then 9 | # Remove "plugin/vader.vim" suffix. 10 | vader=${vader[0]%/*/*} 11 | fi 12 | 13 | if [ -d $vader ]; then 14 | [[ ! -L vader.vim ]] && ln -s $vader vader.vim 15 | else 16 | git clone https://github.com/junegunn/vader.vim.git 17 | fi 18 | 19 | # Provide viminfo during tests, remove it on exit. 20 | cp viminfo viminfo.tmp 21 | trap "{ rm viminfo.tmp; }" EXIT 22 | 23 | TERM=ansi HOME=/dev/null vim -XNu vimrc -i viminfo.tmp -c 'Vader! feature/*.vader' 24 | -------------------------------------------------------------------------------- /test/session/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhinz/vim-startify/4e089dffdad46f3f5593f34362d530e8fe823dcf/test/session/.gitkeep -------------------------------------------------------------------------------- /test/viminfo: -------------------------------------------------------------------------------- 1 | > ../plugin/startify.vim 2 | " 1 0 3 | -------------------------------------------------------------------------------- /test/vimrc: -------------------------------------------------------------------------------- 1 | filetype off 2 | 3 | set runtimepath+=vader.vim 4 | set runtimepath+=.. 5 | 6 | filetype plugin on 7 | syntax enable 8 | 9 | set hidden 10 | 11 | let g:startify_session_dir = 'session' 12 | let g:startify_relative_path = 1 13 | let g:startify_custom_header = [] 14 | --------------------------------------------------------------------------------