From 05cc44f7f992b47c59472d1ed02a34d1edf403cb Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Wed, 24 Apr 2013 10:42:35 +0200 Subject: [PATCH] add bookmarks --- README.md | 3 +++ doc/startify.txt | 11 +++++++++++ plugin/startify.vim | 13 +++++++++++++ 3 files changed, 27 insertions(+) diff --git a/README.md b/README.md index fe67c62..218d5ea 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@ _1)_ If you start Vim without giving any filenames to it (or pipe stuff to it so it reads from STDIN), startify will show a small but pretty start screen which shows recently used files and sessions by default. + Additionally, you can define bookmarks, thus entries for files that always + should be available in the start screen. + You can either navigate to a certain menu entry or you just key in whatever is written between the square brackets on that line. diff --git a/doc/startify.txt b/doc/startify.txt index 75e4cfa..c194380 100644 --- a/doc/startify.txt +++ b/doc/startify.txt @@ -40,6 +40,9 @@ Startify basically provides two things: it reads from STDIN), startify will show a small but pretty start screen which shows recently used files and sessions by default. + Additionally, you can define bookmarks, thus entries for files that always + should be available in the start screen. + You can either navigate to a certain menu entry or you just key in whatever is written between the square brackets on that line. @@ -87,6 +90,14 @@ List recently used files using viminfo. The amount of files to list. +============- + + let g:startify_bookmarks = [ '~/.vimrc' ] + +A list of files to bookmark. Those files will always be shown at the bottom of +the start screen. + + ============================================================================== 4. Commands *startify-commands* diff --git a/plugin/startify.vim b/plugin/startify.vim index ced941d..d5fb8e3 100644 --- a/plugin/startify.vim +++ b/plugin/startify.vim @@ -58,6 +58,19 @@ function! s:start() abort call append('$', ' ['. idx .']'. repeat(' ', 3 - strlen(string(idx))) . fnamemodify(sfiles[i], ':t:r')) execute 'nnoremap '. idx .' :source '. sfiles[i] .'' endfor + let cnt = idx + endif + + if exists('g:startify_bookmarks') + call append('$', '') + for fname in g:startify_bookmarks + if !filereadable(expand(fname)) + continue + endif + let cnt += 1 + call append('$', ' ['. cnt .']'. repeat(' ', 3 - strlen(string(cnt))) . fname) + execute 'nnoremap '. cnt .' :edit '. fname .'' + endfor endif call append('$', ['', ' [q] quit'])