2013-09-24 17:41:31 +02:00
|
|
|
" vim: et sw=2 sts=2
|
|
|
|
|
2013-04-23 16:41:02 +02:00
|
|
|
" Plugin: https://github.com/mhinz/vim-startify
|
2015-04-28 15:34:11 +02:00
|
|
|
" Description: A fancy start screen for Vim.
|
2013-04-23 16:41:02 +02:00
|
|
|
" Maintainer: Marco Hinz <http://github.com/mhinz>
|
|
|
|
|
|
|
|
if exists('g:loaded_startify') || &cp
|
|
|
|
finish
|
|
|
|
endif
|
|
|
|
let g:loaded_startify = 1
|
2015-03-02 22:06:10 +01:00
|
|
|
let g:startify_locked = 0
|
2013-04-23 16:41:02 +02:00
|
|
|
|
2017-02-26 03:39:09 +01:00
|
|
|
if !get(g:, 'startify_disable_at_vimenter')
|
|
|
|
set shortmess+=I
|
|
|
|
endif
|
|
|
|
|
2013-04-23 16:41:02 +02:00
|
|
|
augroup startify
|
2018-04-09 17:08:20 +02:00
|
|
|
autocmd VimEnter * nested call s:on_vimenter()
|
|
|
|
autocmd VimLeavePre * nested call s:on_vimleavepre()
|
2015-03-02 22:06:10 +01:00
|
|
|
autocmd QuickFixCmdPre *vimgrep* let g:startify_locked = 1
|
|
|
|
autocmd QuickFixCmdPost *vimgrep* let g:startify_locked = 0
|
2013-04-23 16:41:02 +02:00
|
|
|
augroup END
|
|
|
|
|
2015-12-25 16:19:10 +01:00
|
|
|
function! s:update_oldfiles(file)
|
|
|
|
if g:startify_locked || !exists('v:oldfiles')
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
let idx = index(v:oldfiles, a:file)
|
|
|
|
if idx != -1
|
|
|
|
call remove(v:oldfiles, idx)
|
|
|
|
endif
|
|
|
|
call insert(v:oldfiles, a:file, 0)
|
|
|
|
endfunction
|
|
|
|
|
2018-04-09 17:08:20 +02:00
|
|
|
function! s:on_vimenter()
|
2018-04-10 12:12:15 +02:00
|
|
|
if !argc() && line2byte('$') == -1
|
2015-02-11 14:58:10 +01:00
|
|
|
if get(g:, 'startify_session_autoload') && filereadable('Session.vim')
|
|
|
|
source Session.vim
|
2016-03-20 16:27:38 +01:00
|
|
|
elseif !get(g:, 'startify_disable_at_vimenter')
|
2015-02-11 14:58:10 +01:00
|
|
|
call startify#insane_in_the_membrane()
|
|
|
|
endif
|
|
|
|
endif
|
2016-03-07 13:21:16 +01:00
|
|
|
if get(g:, 'startify_update_oldfiles')
|
|
|
|
call map(v:oldfiles, 'fnamemodify(v:val, ":p")')
|
|
|
|
autocmd startify BufNewFile,BufRead,BufFilePre *
|
|
|
|
\ call s:update_oldfiles(expand('<afile>:p'))
|
|
|
|
endif
|
2015-02-11 14:58:10 +01:00
|
|
|
autocmd! startify VimEnter
|
|
|
|
endfunction
|
|
|
|
|
2018-04-09 17:08:20 +02:00
|
|
|
function! s:on_vimleavepre()
|
2017-02-25 22:35:04 +01:00
|
|
|
if get(g:, 'startify_session_persistence')
|
|
|
|
\ && exists('v:this_session')
|
|
|
|
\ && filewritable(v:this_session)
|
2015-02-11 14:58:10 +01:00
|
|
|
call startify#session_write(fnameescape(v:this_session))
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
|
2017-11-21 20:13:48 +01:00
|
|
|
command! -nargs=? -bar -complete=customlist,startify#session_list SLoad call startify#session_load(<f-args>)
|
|
|
|
command! -nargs=? -bar -bang -complete=customlist,startify#session_list SSave call startify#session_save(<bang>0, <f-args>)
|
2016-02-02 14:54:58 +01:00
|
|
|
command! -nargs=? -bar -bang -complete=customlist,startify#session_list SDelete call startify#session_delete(<bang>0, <f-args>)
|
2015-01-05 16:06:20 -05:00
|
|
|
command! -nargs=0 -bar SClose call startify#session_close()
|
2018-04-09 14:31:53 +02:00
|
|
|
command! -nargs=0 -bar Startify call startify#insane_in_the_membrane()
|
2015-06-01 17:07:40 +02:00
|
|
|
command! -nargs=0 -bar StartifyDebug call startify#debug()
|
2014-11-22 18:15:29 +01:00
|
|
|
|
|
|
|
nnoremap <silent><plug>(startify-open-buffers) :<c-u>call startify#open_buffers()<cr>
|