Created
October 17, 2017 17:20
-
-
Save nelstrom/d677474c8e71baa3b4b72f24b66f94f0 to your computer and use it in GitHub Desktop.
Specifying project-local indentation settings via Projectionist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"*.js": { | |
"indent": "tabs:3" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autocmd User ProjectionistActivate call s:activate() | |
function! s:activate() abort | |
for [root, value] in projectionist#query('indent') | |
let l:pattern = '\v(tabs|spaces):(\d)' | |
let l:matches = matchlist(value, l:pattern) | |
if !empty(l:matches) | |
let l:type = l:matches[1] | |
let l:size = l:matches[2] | |
if l:type ==? 'spaces' | |
setlocal expandtab | |
endif | |
if l:type ==? 'tabs' | |
setlocal noexpandtab | |
endif | |
let &l:tabstop = l:size | |
let &l:softtabstop = l:size | |
let &l:shiftwidth = l:size | |
endif | |
break | |
endfor | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment