Explorar o código

Fix g:startify_change_to_dir corner cases

References https://github.com/mhinz/vim-startify/issues/283
Marco Hinz %!s(int64=8) %!d(string=hai) anos
pai
achega
1e251fb749
Modificáronse 1 ficheiros con 10 adicións e 1 borrados
  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