Skip to content

Instantly share code, notes, and snippets.

@jamessan
Last active December 18, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamessan/5794112 to your computer and use it in GitHub Desktop.
Save jamessan/5794112 to your computer and use it in GitHub Desktop.
Exit vim with an error if a command-line argument is a directory
fun! ErrorOnDirectory()
for i in range(argc())
if isdirectory(argv(i))
cquit
endif
endfor
endfun
augroup NoDirectories
autocmd!
autocmd VimEnter * call ErrorOnDirectory()
augroup END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment