diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-09-11 04:01:41 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-09-13 16:20:09 +0200 |
commit | df072c3b2b20fb7d3d9d50b5ab0df92827aa628f (patch) | |
tree | fb80cb1409d60a6316d534b989451cd9986934e6 /src/nvim/misc1.c | |
parent | 7eb4d2f79dcc712dae1513516b9db5f574d51437 (diff) | |
download | rneovim-df072c3b2b20fb7d3d9d50b5ab0df92827aa628f.tar.gz rneovim-df072c3b2b20fb7d3d9d50b5ab0df92827aa628f.tar.bz2 rneovim-df072c3b2b20fb7d3d9d50b5ab0df92827aa628f.zip |
refactor: eliminate misc2.c
move `call_shell` to misc1.c
Move some fns to state.c
Move some fns to option.c
Move some fns to memline.c
Move `vim_chdir*` fns to file_search.c
Move some fns to new module, bytes.c
Move some fns to fileio.c
Diffstat (limited to 'src/nvim/misc1.c')
-rw-r--r-- | src/nvim/misc1.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index cab4edfec8..4ab059c923 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -31,7 +31,6 @@ #include "nvim/memline.h" #include "nvim/memory.h" #include "nvim/message.h" -#include "nvim/misc2.h" #include "nvim/garray.h" #include "nvim/move.h" #include "nvim/mouse.h" @@ -41,6 +40,7 @@ #include "nvim/regexp.h" #include "nvim/screen.h" #include "nvim/search.h" +#include "nvim/state.h" #include "nvim/strings.h" #include "nvim/tag.h" #include "nvim/ui.h" @@ -1746,18 +1746,6 @@ int gchar_pos(pos_T *pos) } /* - * Skip to next part of an option argument: Skip space and comma. - */ -char_u *skip_to_option_part(char_u *p) -{ - if (*p == ',') - ++p; - while (*p == ' ') - ++p; - return p; -} - -/* * Call this function when something in the current buffer is changed. * * Most often called through changed_bytes() and changed_lines(), which also @@ -2691,6 +2679,42 @@ void fast_breakcheck(void) } } +// Call shell. Calls os_call_shell, with 'shellxquote' added. +int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg) +{ + int retval; + proftime_T wait_time; + + if (p_verbose > 3) { + verbose_enter(); + smsg(_("Calling shell to execute: \"%s\""), + cmd == NULL ? p_sh : cmd); + ui_putc('\n'); + verbose_leave(); + } + + if (do_profiling == PROF_YES) { + prof_child_enter(&wait_time); + } + + if (*p_sh == NUL) { + EMSG(_(e_shellempty)); + retval = -1; + } else { + // The external command may update a tags file, clear cached tags. + tag_freematch(); + + retval = os_call_shell(cmd, opts, extra_shell_arg); + } + + set_vim_var_nr(VV_SHELL_ERROR, (varnumber_T)retval); + if (do_profiling == PROF_YES) { + prof_child_exit(&wait_time); + } + + return retval; +} + /// Get the stdout of an external command. /// If "ret_len" is NULL replace NUL characters with NL. When "ret_len" is not /// NULL store the length there. |