diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-06 17:24:37 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-06-06 17:31:54 +1200 |
commit | ce4527cca3d1aacde321fc3826decb2047df65cc (patch) | |
tree | aec29f5427d0b6b8e65ae7cc39c21bf2f3a03036 /vim/scripts.vim | |
parent | Factor out password redaction into new plugin (diff) | |
download | dotfiles-ce4527cca3d1aacde321fc3826decb2047df65cc.tar.gz dotfiles-ce4527cca3d1aacde321fc3826decb2047df65cc.zip |
Add custom scripts.vim
Including adding sed support
Diffstat (limited to 'vim/scripts.vim')
-rw-r--r-- | vim/scripts.vim | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/vim/scripts.vim b/vim/scripts.vim new file mode 100644 index 00000000..1d4e1eb1 --- /dev/null +++ b/vim/scripts.vim @@ -0,0 +1,52 @@ +" Try to determine filetype by examining actual file contents; read as little +" as possible, and try to keep things simple and specific to what I typically +" work on, and will expect to be syntax-highlighted. + +" Read first line +let s:line = getline(1) + +" If it's not a shebang, we're done +if s:line !~# '\m^#!' + finish +endif + +" AWK +if s:line =~# '\m\<[gm]\?awk\>' + setfiletype awk + +" Perl 5 +elseif s:line =~# '\m\<perl\>' + setfiletype perl + +" Perl 6 +elseif s:line =~# '\m\<perl6\>' + setfiletype perl6 + +" PHP +elseif s:line =~# '\m\<php\>' + setfiletype php + +" Python +elseif s:line =~# '\m\<python[23]\>' + setfiletype python + +" sed +elseif s:line =~# '\m\<sed\>' + setfiletype sed + +" Bash +elseif s:line =~# '\m\<bash\>' + let b:is_bash = 1 + setfiletype sh + +" Korn shell +elseif s:line =~# '\m\<\(m\|pd\)ksh\(93\)\?\>' + let b:is_kornshell = 1 + setfiletype sh + +" POSIX/Bourne shell +elseif s:line =~# '\m\<sh\>' + let b:is_posix = 1 + setfiletype sh + +endif |