diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-10 16:38:32 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-10 16:38:32 +0200 | 
| commit | 05ff14bfdaeca8def902c644d119f3946009bf14 (patch) | |
| tree | e6e9dbb371a1e4ecf4d4f72e05589248f82494ae /autoload | |
| parent | 9243367ba376050621e4c05e8f0439742c1f0f82 (diff) | |
| download | vim-polyglot-05ff14bfdaeca8def902c644d119f3946009bf14.tar.gz vim-polyglot-05ff14bfdaeca8def902c644d119f3946009bf14.zip | |
Add odin support, closes #544
Diffstat (limited to 'autoload')
| -rw-r--r-- | autoload/polyglot.vim | 36 | ||||
| -rw-r--r-- | autoload/sleuth.vim | 1 | 
2 files changed, 17 insertions, 20 deletions
| diff --git a/autoload/polyglot.vim b/autoload/polyglot.vim index d89108aa..bc8791f5 100644 --- a/autoload/polyglot.vim +++ b/autoload/polyglot.vim @@ -4,9 +4,9 @@ set cpo&vim  func! polyglot#Heuristics()    " Try to detect filetype from shebang -  let filetype = polyglot#Shebang() -  if filetype != "" -    exec "setf " . filetype +  let l:filetype = polyglot#Shebang() +  if l:filetype != "" +    exec "setf " . l:filetype      return 1    endif @@ -88,41 +88,37 @@ let s:r_envflag = '%(\S\+=\S\+\|-[iS]\|--ignore-environment\|--split-string\)'  let s:r_env = '^\%(\' . s:r_envflag . '\s\+\)*\(\S\+\)'  func! polyglot#Shebang() -  let line1 = getline(1) +  let l:line1 = getline(1) -  if line1 !~# "^#!" +  if l:line1 !~# "^#!"      return    endif -  let pathrest = matchlist(line1, s:r_hashbang) +  let l:pathrest = matchlist(l:line1, s:r_hashbang) -  if len(pathrest) == 0 +  if len(l:pathrest) == 0      return     endif -  let [_, path, rest; __] = pathrest +  let [_, l:path, l:rest; __] = l:pathrest -  let script = split(path, "/")[-1] +  let l:script = split(l:path, "/")[-1] -  if len(script) == 0 -    return -  endif - -  if script == "env" -    let argspath = matchlist(rest, s:r_env) -    if len(argspath) == 0 +  if l:script == "env" +    let l:argspath = matchlist(l:rest, s:r_env) +    if len(l:argspath) == 0        return      endif -    let script = argspath[1] +    let l:script = l:argspath[1]    endif -  if has_key(s:interpreters, script) -    return s:interpreters[script] +  if has_key(s:interpreters, l:script) +    return s:interpreters[l:script]    endif    for interpreter in keys(s:interpreters) -    if script =~# '^' . interpreter +    if l:script =~# '^' . interpreter        return s:interpreters[interpreter]      endif    endfor diff --git a/autoload/sleuth.vim b/autoload/sleuth.vim index 81974413..05459ccd 100644 --- a/autoload/sleuth.vim +++ b/autoload/sleuth.vim @@ -144,6 +144,7 @@ let s:globs = {    \ 'ocpbuild': '*.ocp',    \ 'ocpbuildroot': '*.root',    \ 'octave': '*.oct,*.m', +  \ 'odin': '*.odin',    \ 'omake': '*.om,OMakefile,OMakeroot,OMakeroot.in',    \ 'opam': '*.opam,*.opam.template,opam',    \ 'opencl': '*.cl,*.opencl', | 
