Last Updated: February 25, 2016
·
554
· rovalles

Spaces or Tabs based on your git repo

I use the same vim file on different projects and sometimes some projects use different settings. So to avoid switching things around for each project I just let the if statements handle it.

function Tabulate()
    "check the repo
    let l:repo = system('git remote show -n origin | grep "Fetch URL"')

   "use match to check what repo it is.
    if match(repo, ''domian'') > 1 
        set noexpandtab "tabs not spaces
    else
        set expandtab "spaces not tabs
    endif
endfunction

autocmd BufEnter * :call Tabulate()

1 Response
Add your response

I've had good luck with DetectIndent:
http://www.vim.org/scripts/script.php?script_id=1171

over 1 year ago ·