diff options
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index a325459887..a2c50b4c81 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -84,6 +84,24 @@ void vim_feedkeys(String keys, String mode) typebuf_was_filled = true; } +/// Replace any terminal codes with the internal representation +/// +/// @see replace_termcodes +/// @see cpoptions +String vim_replace_termcodes(String str, Boolean from_part, Boolean do_lt, + Boolean special) +{ + if (str.size == 0) { + // Empty string + return str; + } + + char *ptr = NULL; + replace_termcodes((char_u *)str.data, (char_u **)&ptr, + from_part, do_lt, special); + return cstr_as_string(ptr); +} + /// Evaluates the expression str using the vim internal expression /// evaluator (see |expression|). /// Dictionaries and lists are recursively expanded. |