-
Notifications
You must be signed in to change notification settings - Fork 188
Example configurations
Paul Fernandez edited this page Oct 29, 2020
·
16 revisions
If you came up with any cool configuration worth sharing, add it here. Don't forget to add a link at the top as well.
- Show modified and untracked git files
- Use NERDTree bookmarks
- Display NERDTree bookmarks as a separate list
" returns all modified files of the current git repo
" `2>/dev/null` makes the command fail quietly, so that when we are not
" in a git repo, the list will be empty
function! s:gitModified()
let files = systemlist('git ls-files -m 2>/dev/null')
return map(files, "{'line': v:val, 'path': v:val}")
endfunction
" same as above, but show untracked files, honouring .gitignore
function! s:gitUntracked()
let files = systemlist('git ls-files -o --exclude-standard 2>/dev/null')
return map(files, "{'line': v:val, 'path': v:val}")
endfunction
let g:startify_lists = [
\ { 'type': 'files', 'header': [' MRU'] },
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': function('s:gitModified'), 'header': [' git modified']},
\ { 'type': function('s:gitUntracked'), 'header': [' git untracked']},
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]
See :h g:startify_lists
for more information.
let g:startify_bookmarks = systemlist("cut -sd' ' -f 2 ~/.NERDTreeBookmarks")
" Read ~/.NERDTreeBookmarks file and takes its second column
function! s:nerdtreeBookmarks()
let bookmarks = systemlist("cut -d' ' -f 2 ~/.NERDTreeBookmarks")
let bookmarks = bookmarks[0:-2] " Slices an empty last line
return map(bookmarks, "{'line': v:val, 'path': v:val}")
endfunction
let g:startify_lists = [
\ { 'type': function('s:nerdtreeBookmarks'), 'header': [' NERDTree Bookmarks']}
\]