Bram Moolenaar | d09091d | 2019-01-17 16:07:22 +0100 | [diff] [blame] | 1 | " Vim filetype plugin file |
| 2 | " Language: bash |
| 3 | " Maintainer: Bram Moolenaar |
| 4 | " Last Changed: 2019 Jan 12 |
| 5 | " |
| 6 | " This is not a real filetype plugin. It allows for someone to set 'filetype' |
| 7 | " to "bash" in the modeline, and gets the effect of filetype "sh" with |
| 8 | " b:is_bash set. Idea from Mahmode Al-Qudsi. |
| 9 | |
| 10 | if exists("b:did_ftplugin") |
| 11 | finish |
| 12 | endif |
| 13 | |
| 14 | let b:is_bash = 1 |
| 15 | if exists("b:is_sh") |
| 16 | unlet b:is_sh |
| 17 | endif |
| 18 | if exists("b:is_kornshell") |
| 19 | unlet b:is_kornshell |
| 20 | endif |
| 21 | |
| 22 | " Setting 'filetype' here directly won't work, since we are being invoked |
| 23 | " through an autocommand. Do it later, on the BufWinEnter event. |
| 24 | augroup bash_filetype |
| 25 | au BufWinEnter * call SetBashFt() |
| 26 | augroup END |
| 27 | |
| 28 | func SetBashFt() |
| 29 | au! bash_filetype |
| 30 | set ft=sh |
| 31 | endfunc |