Permalink
Browse files

Version 0.1: Initial upload

  • Loading branch information...
0 parents commit 019772d9952f17e2148d4a18512f958ae860c55c @bellaire bellaire committed with Feb 26, 2009
Showing with 23 additions and 0 deletions.
  1. +9 −0 README
  2. +14 −0 plugin/gitignore.vim
9 README
@@ -0,0 +1,9 @@
+This is a mirror of http://www.vim.org/scripts/script.php?script_id=2557
+
+Another one from StackOverflow.
+
+It will read your .gitignore file from the directory where you launch vim and parse it, transforming its format into one suitable for wildignore, and then set that option. Thus, tab-completion won't present those files as options when using vim commands that expect a filename.
+
+Limitations:
+ * This will read the .gitignore file from the directory where you launch vim. No effort is made to look for other .gitignore files and parse them. Alternatively, you could specify an absolute path to a file on the first line.
+ * The wildignore option in vim doesn't support the notion of negating ignores like you can in a .gitignore file. That is, you can't say :set wildignore=*.html,!foo.html to have it ignore all html files except foo.html. Therefore, .gitignore lines that start with ! are simply ignored.
@@ -0,0 +1,14 @@
+let filename = '.gitignore'
+if filereadable(filename)
+ let igstring = ''
+ for oline in readfile(filename)
+ let line = substitute(oline, '\s|\n|\r', '', "g")
+ if line =~ '^#' | con | endif
+ if line == '' | con | endif
+ if line =~ '^!' | con | endif
+ if line =~ '/$' | let igstring .= "," . line . "*" | con | endif
+ let igstring .= "," . line
+ endfor
+ let execstring = "set wildignore=".substitute(igstring, '^,', '', "g")
+ execute execstring
+endif

0 comments on commit 019772d

Please sign in to comment.