API: nvim_source

This commit is contained in:
Siddhant Gupta
2019-10-06 13:37:54 -07:00
committed by Justin M. Keyes
parent 70b6061666
commit 6aa03e86da
3 changed files with 127 additions and 1 deletions

View File

@@ -25,6 +25,7 @@
#include "nvim/highlight.h"
#include "nvim/window.h"
#include "nvim/types.h"
#include "nvim/ex_cmds2.h"
#include "nvim/ex_docmd.h"
#include "nvim/screen.h"
#include "nvim/memline.h"
@@ -72,6 +73,15 @@ void api_vim_free_all_mem(void)
map_free(String, handle_T)(namespace_ids);
}
void nvim_source(String command, Error *err)
FUNC_API_SINCE(5)
{
try_start();
do_source_str((char_u *)command.data);
update_screen(VALID);
try_end(err);
}
/// Executes an ex-command.
///
/// On execution error: fails with VimL error, does not update v:errmsg.