Vimscript: how to get current filetype as a variable

前端 未结 2 1795
一整个雨季
一整个雨季 2021-02-07 05:33

I\'d like to get the current filetype as a variable in vimscript.

I\'m making a function that grabs the current filetype and edits another file of corresponding filety

2条回答
  •  被撕碎了的回忆
    2021-02-07 06:00

    File type and file suffix are not necessarily the same thing. For example, if you are editing a .txt file, let zft = &ft sets zft to "text". let zfs = fnamemodify(bufname("%"), ":e") sets zfs to "txt".

提交回复
热议问题