فهرست منبع

add bookmarks

Marco Hinz 12 سال پیش
والد
کامیت
05cc44f7f9
3فایلهای تغییر یافته به همراه27 افزوده شده و 0 حذف شده
  1. 3 0
      README.md
  2. 11 0
      doc/startify.txt
  3. 13 0
      plugin/startify.vim

+ 3 - 0
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.
 

+ 11 - 0
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*
 

+ 13 - 0
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 <buffer> '. idx .' :source '. sfiles[i] .'<cr>'
     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 <buffer> '. cnt .' :edit '. fname .'<cr>'
+    endfor
   endif
 
   call append('$', ['', '   [q]  quit'])