Эх сурвалжийг харах

Fix g:startify_change_to_dir corner cases

References https://github.com/mhinz/vim-startify/issues/283
Marco Hinz 8 жил өмнө
parent
commit
1e251fb749
1 өөрчлөгдсөн 10 нэмэгдсэн , 1 устгасан
  1. 10 1
      autoload/startify.vim

+ 10 - 1
autoload/startify.vim

@@ -808,7 +808,16 @@ function! s:check_user_options(path) abort
   elseif get(g:, 'startify_change_to_vcs_root')
     call s:cd_to_vcs_root(a:path)
   elseif get(g:, 'startify_change_to_dir', 1)
-    execute 'lcd' isdirectory(a:path) ? a:path : fnamemodify(a:path, ':h')
+    if isdirectory(a:path)
+      execute 'lcd' a:path
+    else
+      let dir = fnamemodify(a:path, ':h')
+      if isdirectory(dir)
+        execute 'lcd' dir
+      else
+        " Do nothing. E.g. a:path == `scp://foo/bar`
+      endif
+    endif
   endif
 endfunction