Closed lesar closed 2 years ago
I have used it often and it work well
I have found a better solution that not involve in startify customization but in autocommand on NERDTree:
augroup NERDTreeStartify
autocmd VimEnter * silent! autocmd! FileExplorer
au BufEnter * call Stica(expand('<amatch>'))
au VimEnter * if argc() == 1 && !exists('s:std_in') || v:this_session != '' | call Stica(expand('<amatch>')) | endif
augroup END
function! Stica(dir) abort
if !isdirectory(a:dir)
return
endif
execute 'NERDTreeToggle' a:dir | wincmd p | enew | wincmd p | execute 'cd '.a:dir
endfunction
" my startify conf:
"======================== Startify =============================================
let g:startify_session_dir = '~/.vim/session'
let g:startify_lists = [
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'files', 'header': [' Files'] },
\ { 'type': 'dir', 'header': [' Current Directory '. getcwd()] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ ]
let g:startify_bookmarks = [
\ { 'i': '~/.vim/init/' },
\ ]
let g:startify_session_autoload = 1
let g:startify_session_delete_buffers = 1
let g:startify_change_to_dir = 1
let g:startify_session_persistence = 1
let g:startify_session_before_save = [
\ 'silent! NERDTreeClose'
\ ]
let g:startify_open_folder_cmd = 'NERDTree'
Now if on startify hit 'i' I onpen my path using NERDTree
if I do :e /path-to/folder go on NERDTree too
if I do vim /path-to/folder go on NERDTree too
if I start a saved session go on NERDTree too
I'm not a vim developer so if someone can make my code better is welcome: reopen the question and add. Forgive my poor English.
best regards, Leonardo
Hallo, I try to better integrate NERDTree without dependencies to use on session and in bookmark pointing on folder.
I rewite this function only to make an example to show you what I need: (but is working)
let g:startify_open_folder_command='edit' "default for user not NERDTree aware
orlet g:startify_open_folder_command='NERDTree'
My startify configuration:
Is a bad Idea?
Other solution I try not fit well.
there is a more simple solution?
best regards, Leonardo