Просмотр исходного кода

Issue a warning if the viminfo file can't be read

Also add a typical solution to the FAQ.

Closes #89.
Marco Hinz 11 лет назад
Родитель
Сommit
ec869a589e
2 измененных файлов с 59 добавлено и 31 удалено
  1. 6 0
      autoload/startify.vim
  2. 53 31
      doc/startify.txt

+ 6 - 0
autoload/startify.vim

@@ -85,6 +85,12 @@ function! startify#insane_in_the_membrane() abort
     let cnt = 1
   endif
 
+  if empty(v:oldfiles)
+    echohl WarningMsg
+    echomsg "startify: Can't read viminfo file.  Read :help startify-faq"
+    echohl None
+  endif
+
   for item in s:lists
     if type(item) == 1
       let cnt = s:show_{item}(cnt)

+ 53 - 31
doc/startify.txt

@@ -507,49 +507,37 @@ Example: (my terminal emulator supports 256 colors)
 ==============================================================================
 FAQ                                                               *startify-faq*
 
-------------------------------------------------------------------------------
-
-CtrlP or NERDTree open a split in Startify!~
+I don't want the start screen to use cursorline!~
 
-Put this in your vimrc:
->
-    autocmd FileType startify setlocal buftype=
-<
-If you're using CtrlP without NERDTree, there is an even more elegant
-solution:
+Startify sets its own filetype "startify". Thus one could set buffer-local
+options like this:
 >
-    let g:ctrlp_reuse_window = 'startify'
+    autocmd FileType startify setlocal nocursorline
 <
 ------------------------------------------------------------------------------
 
-How do I get both NERDTree and Startify working at startup?~
+Recent files aren't shown!~
 
-Put this in your vimrc:
->
-    autocmd VimEnter *
-                \ if !argc() |
-                \   Startify |
-                \   NERDTree |
-                \   execute "normal \<c-w>w" |
-                \ endif
-<
-------------------------------------------------------------------------------
+Perhaps the problem is that the viminfo file..
 
-The session autoload feature is not working!~
+    - doesn't exist
+    - is invalid
+    - is empty
+    - can't be read (check permissions)
 
-Do you have NERDTree installed by any chance? If so, try this:
+I suggest the following steps:
+
+    1) Create a new directory:
 >
-    let NERDTreeHijackNetrw = 0
+        $ mkdir -p ~/.vim/files/info
 <
-------------------------------------------------------------------------------
-
-I don't want the start screen to use cursorline!~
-
-Startify sets its own filetype "startify". Thus one could set buffer-local
-options like this:
+    2) Put this into your vimrc:
 >
-    autocmd FileType startify setlocal nocursorline
+        set viminfo='100,n$HOME/.vim/files/info/viminfo
 <
+See |'viminfo'| for information about the second step and what it does
+exactly.
+
 ------------------------------------------------------------------------------
 
 Last recently used files don't seem to get updated at :Startify!~
@@ -582,6 +570,40 @@ Use the skiplist. Personally I use:
            \ '\.DS_Store'
            \ ]
 <
+------------------------------------------------------------------------------
+
+CtrlP or NERDTree open a split in Startify!~
+
+Put this in your vimrc:
+>
+    autocmd FileType startify setlocal buftype=
+<
+If you're using CtrlP without NERDTree, there is an even more elegant
+solution:
+>
+    let g:ctrlp_reuse_window = 'startify'
+<
+------------------------------------------------------------------------------
+
+How do I get both NERDTree and Startify working at startup?~
+
+Put this in your vimrc:
+>
+    autocmd VimEnter *
+                \ if !argc() |
+                \   Startify |
+                \   NERDTree |
+                \   execute "normal \<c-w>w" |
+                \ endif
+<
+------------------------------------------------------------------------------
+
+The session autoload feature is not working!~
+
+Do you have NERDTree installed by any chance? If so, try this:
+>
+    let NERDTreeHijackNetrw = 0
+<
 ==============================================================================
 EXAMPLE                                                       *startify-example*