Преглед на файлове

Change skiplist default + improve docs

Thanks for the feedback, @Osse.
Marco Hinz преди 10 години
родител
ревизия
695121f065
променени са 2 файла, в които са добавени 22 реда и са изтрити 22 реда
  1. 11 5
      autoload/startify.vim
  2. 11 17
      doc/startify.txt

+ 11 - 5
autoload/startify.vim

@@ -19,7 +19,7 @@ let s:session_dir    = resolve(expand(get(g:, 'startify_session_dir',
 
 let s:skiplist = get(g:, 'startify_skiplist', [
       \ 'COMMIT_EDITMSG',
-      \ fnamemodify($VIMRUNTIME, ':p') .'/doc',
+      \ escape(fnamemodify($VIMRUNTIME, ':p'), '\') .'doc',
       \ 'bundle/.*/doc',
       \ ])
 
@@ -89,7 +89,7 @@ function! startify#insane_in_the_membrane() abort
   if empty(v:oldfiles)
     echohl WarningMsg
     echomsg "startify: Can't read viminfo file.  Read :help startify-faq-02"
-    echohl None
+    echohl NONE
   endif
 
   let b:startify_section_header_lines = []
@@ -537,9 +537,15 @@ endfunction
 " Function: s:is_in_skiplist {{{1
 function! s:is_in_skiplist(arg) abort
   for regexp in s:skiplist
-    if (a:arg =~# regexp)
-      return 1
-    endif
+    try
+      if a:arg =~# regexp
+        return 1
+      endif
+    catch
+      echohl WarningMsg
+      echomsg 'startify: Pattern '. string(regexp) .' threw an exception. Read :help g:startify_skiplist'
+      echohl NONE
+    endtry
   endfor
 endfunction
 

+ 11 - 17
doc/startify.txt

@@ -247,17 +247,18 @@ At the moment only git, hg, bzr and svn are supported.
 >
     let g:startify_skiplist = [
         \ 'COMMIT_EDITMSG',
-        \ fnamemodify($VIMRUNTIME, ':p') .'/doc',
+        \ escape(fnamemodify($VIMRUNTIME, ':p'), '\') .'doc',
         \ 'bundle/.*/doc',
-        \ '.vimgolf',
         \ ]
 <
 A list of Vim regular expressions that is used to filter recently used files.
 See |pattern.txt| for what patterns can be used.
 
-NOTE: Due to the nature of patterns, you can't just use something like
-"'~/mysecret'" but have to use "$HOME . '/mysecret.txt". The former would do
-something entirely different: |/\~|
+NOTE: Due to the nature of patterns, you can't just use "~/mysecret" but have
+to use "$HOME .'/mysecret.txt'". The former would do something entirely
+different: |/\~|. When using backslashes as path separators, escape them.
+Otherwise using "C:\this\vim\path\is\problematic" would not match what you
+expect, since |/\v| is a pattern, too.
 
 Example:
 >
@@ -265,7 +266,7 @@ Example:
            \ '\.vimgolf',
            \ '^/tmp',
            \ '/project/.*/documentation',
-           \ $HOME . '/mysecret.txt',
+           \ escape(fnamemodify($HOME, ':p'), '\') .'mysecret.txt',
            \ ]
 <
 ------------------------------------------------------------------------------
@@ -629,15 +630,8 @@ Some people swear it works for them with these settings:
                                                                *startify-faq-04*
 How to disable common but unimportant files?~
 
-Use the skiplist. Personally I use:
->
-    let g:startify_skiplist = [
-           \ 'COMMIT_EDITMSG',
-           \ fnamemodify($VIMRUNTIME, ':p') .'/doc',
-           \ 'bundle/.*/doc',
-           \ '\.DS_Store'
-           \ ]
-<
+Use |g:startify_skiplist|.
+
 ------------------------------------------------------------------------------
                                                                *startify-faq-05*
 CtrlP or NERDTree open a split in Startify!~
@@ -714,9 +708,9 @@ This is my configuration..
 
     let g:startify_skiplist = [
                 \ 'COMMIT_EDITMSG',
-                \ fnamemodify($VIMRUNTIME, ':p') .'/doc',
                 \ 'bundle/.*/doc',
-                \ '\.vimgolf',
+                \ '/data/repo/neovim/runtime/doc',
+                \ '/Users/mhi/local/vim/share/vim/vim74/doc',
                 \ ]
 
     let g:startify_bookmarks = [