Skip to content

Instantly share code, notes, and snippets.

@abullrd
Created April 5, 2013 18:37
Show Gist options
  • Save abullrd/5321570 to your computer and use it in GitHub Desktop.
Save abullrd/5321570 to your computer and use it in GitHub Desktop.
Vim use .gitignore
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment