tex: ft command to print or set current file type - neatvi - [fork] simple vi-type editor with UTF-8 support (HTM) git clone git://src.adamsgaard.dk/neatvi (DIR) Log (DIR) Files (DIR) Refs (DIR) README --- (DIR) commit 327a8df78c89d94f7074d6a5881f222287d8fddc (DIR) parent 6b9ca3203a7dd6f7c9c5c5d6d0abe61dd6d96360 (HTM) Author: Ali Gholami Rudi <ali@rudi.ir> Date: Thu, 29 Oct 2015 18:07:33 +0330 ex: ft command to print or set current file type Diffstat: M ex.c | 12 ++++++++++++ 1 file changed, 12 insertions(+), 0 deletions(-) --- (DIR) diff --git a/ex.c b/ex.c t@@ -679,6 +679,17 @@ static int ec_make(char *ec) return 0; } +static int ec_ft(char *ec) +{ + char arg[EXLEN]; + ex_arg(ec, arg); + if (arg[0]) + snprintf(bufs[0].ft, sizeof(bufs[0].ft), arg); + else + ex_print(ex_filetype()); + return 0; +} + static struct option { char *abbr; char *name; t@@ -772,6 +783,7 @@ static struct excmd { {"ya", "yank", ec_yank}, {"!", "!", ec_exec}, {"make", "make", ec_make}, + {"ft", "filetype", ec_ft}, {"", "", ec_null}, };