Skip to content

Instantly share code, notes, and snippets.

@trevvvy
Created May 29, 2014 23:45
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 trevvvy/b550517bbedf40b4402d to your computer and use it in GitHub Desktop.
Save trevvvy/b550517bbedf40b4402d to your computer and use it in GitHub Desktop.
" Define the wildignore from gitignore. Primarily for CommandT
let gitignore = '.gitignore'
if filereadable(gitignore)
let igstring = ''
for oline in readfile(gitignore)
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
else
echo 'Unable to find gitignore'
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment