nixos-config/home/editors/neovim/scripts.vim

24 lines
611 B
VimL
Raw Normal View History

2020-10-11 10:50:44 +02:00
if did_filetype()
finish
endif
if getline(1) =~ '^#!.*nix-shell'
2020-11-14 11:18:13 +01:00
let s:matches = matchlist(getline(2), '^#!.*nix-shell .*-i \([^ \t\n]\+\)')
2020-10-11 10:50:44 +02:00
let s:command = s:matches[1]
echo s:command
if s:command != ''
if s:command =~# '^\(bash\d*\|\|ksh\d*\|sh\)\>'
call dist#ft#SetFileTypeSH(s:command)
elseif s:command == 'zsh'
set ft=zsh
2020-10-20 15:47:53 +02:00
elseif s:command =~ 'make\>'
2020-10-11 10:50:44 +02:00
set ft=make
2020-10-20 15:47:53 +02:00
elseif s:command =~ '^node\(js\)\=\>\|^js\>'
2020-10-11 10:50:44 +02:00
set ft=javascript
2020-10-20 15:47:53 +02:00
elseif s:command =~ '^ghci'
2020-10-11 10:50:44 +02:00
set ft=haskell
2020-10-20 15:47:53 +02:00
elseif s:command =~ 'python'
2020-10-11 10:50:44 +02:00
set ft=python
endif
endif
endif