mirror of
https://github.com/neovim/neovim.git
synced 2025-11-26 12:10:40 +00:00
Remove char_u: ex_docmd:do_cmdline_cmd()
This commit is contained in:
@@ -41,7 +41,7 @@ void vim_command(String str, Error *err)
|
|||||||
{
|
{
|
||||||
// Run the command
|
// Run the command
|
||||||
try_start();
|
try_start();
|
||||||
do_cmdline_cmd((char_u *) str.data);
|
do_cmdline_cmd(str.data);
|
||||||
update_screen(VALID);
|
update_screen(VALID);
|
||||||
try_end(err);
|
try_end(err);
|
||||||
}
|
}
|
||||||
@@ -124,9 +124,9 @@ String vim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
|
|||||||
|
|
||||||
String vim_command_output(String str, Error *err)
|
String vim_command_output(String str, Error *err)
|
||||||
{
|
{
|
||||||
do_cmdline_cmd((char_u *)"redir => v:command_output");
|
do_cmdline_cmd("redir => v:command_output");
|
||||||
vim_command(str, err);
|
vim_command(str, err);
|
||||||
do_cmdline_cmd((char_u *)"redir END");
|
do_cmdline_cmd("redir END");
|
||||||
|
|
||||||
if (err->set) {
|
if (err->set) {
|
||||||
return (String) STRING_INIT;
|
return (String) STRING_INIT;
|
||||||
|
|||||||
@@ -978,7 +978,7 @@ void ex_diffpatch(exarg_T *eap)
|
|||||||
|
|
||||||
// Do filetype detection with the new name.
|
// Do filetype detection with the new name.
|
||||||
if (au_has_group((char_u *)"filetypedetect")) {
|
if (au_has_group((char_u *)"filetypedetect")) {
|
||||||
do_cmdline_cmd((char_u *)":doau filetypedetect BufRead");
|
do_cmdline_cmd(":doau filetypedetect BufRead");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1087,7 +1087,7 @@ void diff_win_options(win_T *wp, int addbuf)
|
|||||||
// make sure topline is not halfway through a fold
|
// make sure topline is not halfway through a fold
|
||||||
changed_window_setting_win(wp);
|
changed_window_setting_win(wp);
|
||||||
if (vim_strchr(p_sbo, 'h') == NULL) {
|
if (vim_strchr(p_sbo, 'h') == NULL) {
|
||||||
do_cmdline_cmd((char_u *)"set sbo+=hor");
|
do_cmdline_cmd("set sbo+=hor");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saved the current values, to be restored in ex_diffoff().
|
// Saved the current values, to be restored in ex_diffoff().
|
||||||
@@ -1173,7 +1173,7 @@ void ex_diffoff(exarg_T *eap)
|
|||||||
|
|
||||||
// Remove "hor" from from 'scrollopt' if there are no diff windows left.
|
// Remove "hor" from from 'scrollopt' if there are no diff windows left.
|
||||||
if (!diffwin && (vim_strchr(p_sbo, 'h') != NULL)) {
|
if (!diffwin && (vim_strchr(p_sbo, 'h') != NULL)) {
|
||||||
do_cmdline_cmd((char_u *)"set sbo-=hor");
|
do_cmdline_cmd("set sbo-=hor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1743,7 +1743,7 @@ char_u* keymap_init(void)
|
|||||||
// Stop any active keymap and clear the table. Also remove
|
// Stop any active keymap and clear the table. Also remove
|
||||||
// b:keymap_name, as no keymap is active now.
|
// b:keymap_name, as no keymap is active now.
|
||||||
keymap_unload();
|
keymap_unload();
|
||||||
do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
|
do_cmdline_cmd("unlet! b:keymap_name");
|
||||||
} else {
|
} else {
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t buflen;
|
size_t buflen;
|
||||||
|
|||||||
@@ -1049,9 +1049,9 @@ doESCkey:
|
|||||||
* cursor. */
|
* cursor. */
|
||||||
if (bt_quickfix(curbuf) && c == CAR) {
|
if (bt_quickfix(curbuf) && c == CAR) {
|
||||||
if (curwin->w_llist_ref == NULL) /* quickfix window */
|
if (curwin->w_llist_ref == NULL) /* quickfix window */
|
||||||
do_cmdline_cmd((char_u *)".cc");
|
do_cmdline_cmd(".cc");
|
||||||
else /* location list window */
|
else /* location list window */
|
||||||
do_cmdline_cmd((char_u *)".ll");
|
do_cmdline_cmd(".ll");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cmdwin_type != 0) {
|
if (cmdwin_type != 0) {
|
||||||
@@ -2342,7 +2342,7 @@ void ins_compl_show_pum(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Dirty hard-coded hack: remove any matchparen highlighting. */
|
/* Dirty hard-coded hack: remove any matchparen highlighting. */
|
||||||
do_cmdline_cmd((char_u *)"if exists('g:loaded_matchparen')|3match none|endif");
|
do_cmdline_cmd("if exists('g:loaded_matchparen')|3match none|endif");
|
||||||
|
|
||||||
/* Update the screen before drawing the popup menu over it. */
|
/* Update the screen before drawing the popup menu over it. */
|
||||||
update_screen(0);
|
update_screen(0);
|
||||||
|
|||||||
@@ -5252,7 +5252,7 @@ void fix_help_buffer(void)
|
|||||||
*/
|
*/
|
||||||
void ex_exusage(exarg_T *eap)
|
void ex_exusage(exarg_T *eap)
|
||||||
{
|
{
|
||||||
do_cmdline_cmd((char_u *)"help ex-cmd-index");
|
do_cmdline_cmd("help ex-cmd-index");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -5260,7 +5260,7 @@ void ex_exusage(exarg_T *eap)
|
|||||||
*/
|
*/
|
||||||
void ex_viusage(exarg_T *eap)
|
void ex_viusage(exarg_T *eap)
|
||||||
{
|
{
|
||||||
do_cmdline_cmd((char_u *)"help normal-index");
|
do_cmdline_cmd("help normal-index");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -5973,11 +5973,9 @@ void ex_sign(exarg_T *eap)
|
|||||||
beginline(BL_WHITE);
|
beginline(BL_WHITE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* ... not currently in a window */
|
{ // ... not currently in a window
|
||||||
char_u *cmd;
|
char *cmd = xmalloc(STRLEN(buf->b_fname) + 25);
|
||||||
|
sprintf(cmd, "e +%" PRId64 " %s",
|
||||||
cmd = xmalloc(STRLEN(buf->b_fname) + 25);
|
|
||||||
sprintf((char *)cmd, "e +%" PRId64 " %s",
|
|
||||||
(int64_t)lnum, buf->b_fname);
|
(int64_t)lnum, buf->b_fname);
|
||||||
do_cmdline_cmd(cmd);
|
do_cmdline_cmd(cmd);
|
||||||
xfree(cmd);
|
xfree(cmd);
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ void ex_debug(exarg_T *eap)
|
|||||||
int debug_break_level_save = debug_break_level;
|
int debug_break_level_save = debug_break_level;
|
||||||
|
|
||||||
debug_break_level = 9999;
|
debug_break_level = 9999;
|
||||||
do_cmdline_cmd(eap->arg);
|
do_cmdline_cmd((char *)eap->arg);
|
||||||
debug_break_level = debug_break_level_save;
|
debug_break_level = debug_break_level_save;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2025,14 +2025,13 @@ void ex_compiler(exarg_T *eap)
|
|||||||
|
|
||||||
if (*eap->arg == NUL) {
|
if (*eap->arg == NUL) {
|
||||||
/* List all compiler scripts. */
|
/* List all compiler scripts. */
|
||||||
do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')");
|
do_cmdline_cmd("echo globpath(&rtp, 'compiler/*.vim')");
|
||||||
/* ) keep the indenter happy... */
|
/* ) keep the indenter happy... */
|
||||||
} else {
|
} else {
|
||||||
buf = xmalloc(STRLEN(eap->arg) + 14);
|
buf = xmalloc(STRLEN(eap->arg) + 14);
|
||||||
if (eap->forceit) {
|
if (eap->forceit) {
|
||||||
/* ":compiler! {name}" sets global options */
|
/* ":compiler! {name}" sets global options */
|
||||||
do_cmdline_cmd((char_u *)
|
do_cmdline_cmd("command -nargs=* CompilerSet set <args>");
|
||||||
"command -nargs=* CompilerSet set <args>");
|
|
||||||
} else {
|
} else {
|
||||||
/* ":compiler! {name}" sets local options.
|
/* ":compiler! {name}" sets local options.
|
||||||
* To remain backwards compatible "current_compiler" is always
|
* To remain backwards compatible "current_compiler" is always
|
||||||
@@ -2043,8 +2042,7 @@ void ex_compiler(exarg_T *eap)
|
|||||||
old_cur_comp = get_var_value((char_u *)"g:current_compiler");
|
old_cur_comp = get_var_value((char_u *)"g:current_compiler");
|
||||||
if (old_cur_comp != NULL)
|
if (old_cur_comp != NULL)
|
||||||
old_cur_comp = vim_strsave(old_cur_comp);
|
old_cur_comp = vim_strsave(old_cur_comp);
|
||||||
do_cmdline_cmd((char_u *)
|
do_cmdline_cmd("command -nargs=* CompilerSet setlocal <args>");
|
||||||
"command -nargs=* CompilerSet setlocal <args>");
|
|
||||||
}
|
}
|
||||||
do_unlet((char_u *)"g:current_compiler", TRUE);
|
do_unlet((char_u *)"g:current_compiler", TRUE);
|
||||||
do_unlet((char_u *)"b:current_compiler", TRUE);
|
do_unlet((char_u *)"b:current_compiler", TRUE);
|
||||||
@@ -2054,7 +2052,7 @@ void ex_compiler(exarg_T *eap)
|
|||||||
EMSG2(_("E666: compiler not supported: %s"), eap->arg);
|
EMSG2(_("E666: compiler not supported: %s"), eap->arg);
|
||||||
xfree(buf);
|
xfree(buf);
|
||||||
|
|
||||||
do_cmdline_cmd((char_u *)":delcommand CompilerSet");
|
do_cmdline_cmd(":delcommand CompilerSet");
|
||||||
|
|
||||||
/* Set "b:current_compiler" from "current_compiler". */
|
/* Set "b:current_compiler" from "current_compiler". */
|
||||||
p = get_var_value((char_u *)"g:current_compiler");
|
p = get_var_value((char_u *)"g:current_compiler");
|
||||||
|
|||||||
@@ -289,9 +289,9 @@ do_exmode (
|
|||||||
/*
|
/*
|
||||||
* Execute a simple command line. Used for translated commands like "*".
|
* Execute a simple command line. Used for translated commands like "*".
|
||||||
*/
|
*/
|
||||||
int do_cmdline_cmd(char_u *cmd)
|
int do_cmdline_cmd(char *cmd)
|
||||||
{
|
{
|
||||||
return do_cmdline(cmd, NULL, NULL,
|
return do_cmdline((char_u *)cmd, NULL, NULL,
|
||||||
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED);
|
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4357,7 +4357,7 @@ static void ex_buffer(exarg_T *eap)
|
|||||||
goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2);
|
goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2);
|
||||||
}
|
}
|
||||||
if (eap->do_ecmd_cmd != NULL) {
|
if (eap->do_ecmd_cmd != NULL) {
|
||||||
do_cmdline_cmd(eap->do_ecmd_cmd);
|
do_cmdline_cmd((char *)eap->do_ecmd_cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4370,7 +4370,7 @@ static void ex_bmodified(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2);
|
goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2);
|
||||||
if (eap->do_ecmd_cmd != NULL) {
|
if (eap->do_ecmd_cmd != NULL) {
|
||||||
do_cmdline_cmd(eap->do_ecmd_cmd);
|
do_cmdline_cmd((char *)eap->do_ecmd_cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4382,7 +4382,7 @@ static void ex_bnext(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2);
|
goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2);
|
||||||
if (eap->do_ecmd_cmd != NULL) {
|
if (eap->do_ecmd_cmd != NULL) {
|
||||||
do_cmdline_cmd(eap->do_ecmd_cmd);
|
do_cmdline_cmd((char *)eap->do_ecmd_cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4396,7 +4396,7 @@ static void ex_bprevious(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2);
|
goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2);
|
||||||
if (eap->do_ecmd_cmd != NULL) {
|
if (eap->do_ecmd_cmd != NULL) {
|
||||||
do_cmdline_cmd(eap->do_ecmd_cmd);
|
do_cmdline_cmd((char *)eap->do_ecmd_cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4410,7 +4410,7 @@ static void ex_brewind(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
goto_buffer(eap, DOBUF_FIRST, FORWARD, 0);
|
goto_buffer(eap, DOBUF_FIRST, FORWARD, 0);
|
||||||
if (eap->do_ecmd_cmd != NULL) {
|
if (eap->do_ecmd_cmd != NULL) {
|
||||||
do_cmdline_cmd(eap->do_ecmd_cmd);
|
do_cmdline_cmd((char *)eap->do_ecmd_cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4422,7 +4422,7 @@ static void ex_blast(exarg_T *eap)
|
|||||||
{
|
{
|
||||||
goto_buffer(eap, DOBUF_LAST, BACKWARD, 0);
|
goto_buffer(eap, DOBUF_LAST, BACKWARD, 0);
|
||||||
if (eap->do_ecmd_cmd != NULL) {
|
if (eap->do_ecmd_cmd != NULL) {
|
||||||
do_cmdline_cmd(eap->do_ecmd_cmd);
|
do_cmdline_cmd((char *)eap->do_ecmd_cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6622,7 +6622,7 @@ do_exedit (
|
|||||||
readonlymode = n;
|
readonlymode = n;
|
||||||
} else {
|
} else {
|
||||||
if (eap->do_ecmd_cmd != NULL)
|
if (eap->do_ecmd_cmd != NULL)
|
||||||
do_cmdline_cmd(eap->do_ecmd_cmd);
|
do_cmdline_cmd((char *)eap->do_ecmd_cmd);
|
||||||
n = curwin->w_arg_idx_invalid;
|
n = curwin->w_arg_idx_invalid;
|
||||||
check_arg_idx(curwin);
|
check_arg_idx(curwin);
|
||||||
if (n != curwin->w_arg_idx_invalid)
|
if (n != curwin->w_arg_idx_invalid)
|
||||||
@@ -9423,7 +9423,7 @@ static void ex_terminal(exarg_T *eap)
|
|||||||
snprintf(ex_cmd, sizeof(ex_cmd),
|
snprintf(ex_cmd, sizeof(ex_cmd),
|
||||||
":enew%s | call termopen(%s%s%s) | startinsert",
|
":enew%s | call termopen(%s%s%s) | startinsert",
|
||||||
eap->forceit==TRUE ? "!" : "", lquote, name, rquote);
|
eap->forceit==TRUE ? "!" : "", lquote, name, rquote);
|
||||||
do_cmdline_cmd((uint8_t *)ex_cmd);
|
do_cmdline_cmd(ex_cmd);
|
||||||
|
|
||||||
if (name != (char *)p_sh) {
|
if (name != (char *)p_sh) {
|
||||||
xfree(name);
|
xfree(name);
|
||||||
|
|||||||
@@ -1588,8 +1588,8 @@ void conv_to_pvim(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Following lines contains Farsi encoded character.
|
// Following lines contains Farsi encoded character.
|
||||||
do_cmdline_cmd((char_u *)"%s/\202\231/\232/g");
|
do_cmdline_cmd("%s/\202\231/\232/g");
|
||||||
do_cmdline_cmd((char_u *)"%s/\201\231/\370\334/g");
|
do_cmdline_cmd("%s/\201\231/\370\334/g");
|
||||||
|
|
||||||
// Assume the screen has been messed up: clear it and redraw.
|
// Assume the screen has been messed up: clear it and redraw.
|
||||||
redraw_later(CLEAR);
|
redraw_later(CLEAR);
|
||||||
@@ -1603,7 +1603,7 @@ void conv_to_pstd(void)
|
|||||||
int lnum, llen, i;
|
int lnum, llen, i;
|
||||||
|
|
||||||
// Following line contains Farsi encoded character.
|
// Following line contains Farsi encoded character.
|
||||||
do_cmdline_cmd((char_u *)"%s/\232/\202\231/g");
|
do_cmdline_cmd("%s/\232/\202\231/g");
|
||||||
for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) {
|
for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) {
|
||||||
ptr = ml_get((linenr_T)lnum);
|
ptr = ml_get((linenr_T)lnum);
|
||||||
llen = (int)STRLEN(ptr);
|
llen = (int)STRLEN(ptr);
|
||||||
@@ -2044,11 +2044,11 @@ void farsi_fkey(cmdarg_T *cap)
|
|||||||
if (p_altkeymap) {
|
if (p_altkeymap) {
|
||||||
if (curwin->w_farsi & W_R_L) {
|
if (curwin->w_farsi & W_R_L) {
|
||||||
p_fkmap = 0;
|
p_fkmap = 0;
|
||||||
do_cmdline_cmd((char_u *)"set norl");
|
do_cmdline_cmd("set norl");
|
||||||
MSG("");
|
MSG("");
|
||||||
} else {
|
} else {
|
||||||
p_fkmap = 1;
|
p_fkmap = 1;
|
||||||
do_cmdline_cmd((char_u *)"set rl");
|
do_cmdline_cmd("set rl");
|
||||||
MSG("");
|
MSG("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,10 +84,10 @@ typedef struct {
|
|||||||
char_u *use_vimrc; /* vimrc from -u argument */
|
char_u *use_vimrc; /* vimrc from -u argument */
|
||||||
|
|
||||||
int n_commands; /* no. of commands from + or -c */
|
int n_commands; /* no. of commands from + or -c */
|
||||||
char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c arg. */
|
char *commands[MAX_ARG_CMDS]; // commands from + or -c arg
|
||||||
char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */
|
char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */
|
||||||
int n_pre_commands; /* no. of commands from --cmd */
|
int n_pre_commands; /* no. of commands from --cmd */
|
||||||
char_u *pre_commands[MAX_ARG_CMDS]; /* commands from --cmd argument */
|
char *pre_commands[MAX_ARG_CMDS]; // commands from --cmd argument
|
||||||
|
|
||||||
int edit_type; /* type of editing to do */
|
int edit_type; /* type of editing to do */
|
||||||
char_u *tagname; /* tag from -t argument */
|
char_u *tagname; /* tag from -t argument */
|
||||||
@@ -286,15 +286,14 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// open terminals when opening files that start with term://
|
// open terminals when opening files that start with term://
|
||||||
do_cmdline_cmd((uint8_t *)
|
do_cmdline_cmd("autocmd BufReadCmd term://* "
|
||||||
"autocmd BufReadCmd term://* "
|
":call termopen( "
|
||||||
":call termopen( "
|
// Capture the command string
|
||||||
// Capture the command string
|
"matchstr(expand(\"<amatch>\"), "
|
||||||
"matchstr(expand(\"<amatch>\"), "
|
"'\\c\\mterm://\\%(.\\{-}//\\%(\\d\\+:\\)\\?\\)\\?\\zs.*'), "
|
||||||
"'\\c\\mterm://\\%(.\\{-}//\\%(\\d\\+:\\)\\?\\)\\?\\zs.*'), "
|
// capture the working directory
|
||||||
// capture the working directory
|
"{'cwd': get(matchlist(expand(\"<amatch>\"), "
|
||||||
"{'cwd': get(matchlist(expand(\"<amatch>\"), "
|
"'\\c\\mterm://\\(.\\{-}\\)//'), 1, '')})");
|
||||||
"'\\c\\mterm://\\(.\\{-}\\)//'), 1, '')})");
|
|
||||||
|
|
||||||
/* Execute --cmd arguments. */
|
/* Execute --cmd arguments. */
|
||||||
exe_pre_commands(¶ms);
|
exe_pre_commands(¶ms);
|
||||||
@@ -872,9 +871,9 @@ static void command_line_scan(mparm_T *parmp)
|
|||||||
mainerr(ME_EXTRA_CMD, NULL);
|
mainerr(ME_EXTRA_CMD, NULL);
|
||||||
argv_idx = -1; /* skip to next argument */
|
argv_idx = -1; /* skip to next argument */
|
||||||
if (argv[0][1] == NUL)
|
if (argv[0][1] == NUL)
|
||||||
parmp->commands[parmp->n_commands++] = (char_u *)"$";
|
parmp->commands[parmp->n_commands++] = "$";
|
||||||
else
|
else
|
||||||
parmp->commands[parmp->n_commands++] = (char_u *)&(argv[0][1]);
|
parmp->commands[parmp->n_commands++] = &(argv[0][1]);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Optional argument.
|
* Optional argument.
|
||||||
@@ -1116,7 +1115,7 @@ static void command_line_scan(mparm_T *parmp)
|
|||||||
if (argv[0][argv_idx] != NUL) {
|
if (argv[0][argv_idx] != NUL) {
|
||||||
if (parmp->n_commands >= MAX_ARG_CMDS)
|
if (parmp->n_commands >= MAX_ARG_CMDS)
|
||||||
mainerr(ME_EXTRA_CMD, NULL);
|
mainerr(ME_EXTRA_CMD, NULL);
|
||||||
parmp->commands[parmp->n_commands++] = (char_u *)argv[0]
|
parmp->commands[parmp->n_commands++] = argv[0]
|
||||||
+ argv_idx;
|
+ argv_idx;
|
||||||
argv_idx = -1;
|
argv_idx = -1;
|
||||||
break;
|
break;
|
||||||
@@ -1174,10 +1173,10 @@ static void command_line_scan(mparm_T *parmp)
|
|||||||
p = xmalloc(STRLEN(a) + 4);
|
p = xmalloc(STRLEN(a) + 4);
|
||||||
sprintf((char *)p, "so %s", a);
|
sprintf((char *)p, "so %s", a);
|
||||||
parmp->cmds_tofree[parmp->n_commands] = TRUE;
|
parmp->cmds_tofree[parmp->n_commands] = TRUE;
|
||||||
parmp->commands[parmp->n_commands++] = p;
|
parmp->commands[parmp->n_commands++] = (char *)p;
|
||||||
} else
|
} else {
|
||||||
parmp->commands[parmp->n_commands++] =
|
parmp->commands[parmp->n_commands++] = argv[0];
|
||||||
(char_u *)argv[0];
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '-':
|
case '-':
|
||||||
@@ -1185,8 +1184,7 @@ static void command_line_scan(mparm_T *parmp)
|
|||||||
/* "--cmd {command}" execute command */
|
/* "--cmd {command}" execute command */
|
||||||
if (parmp->n_pre_commands >= MAX_ARG_CMDS)
|
if (parmp->n_pre_commands >= MAX_ARG_CMDS)
|
||||||
mainerr(ME_EXTRA_CMD, NULL);
|
mainerr(ME_EXTRA_CMD, NULL);
|
||||||
parmp->pre_commands[parmp->n_pre_commands++] =
|
parmp->pre_commands[parmp->n_pre_commands++] = argv[0];
|
||||||
(char_u *)argv[0];
|
|
||||||
}
|
}
|
||||||
/* "--startuptime <file>" already handled */
|
/* "--startuptime <file>" already handled */
|
||||||
break;
|
break;
|
||||||
@@ -1376,9 +1374,9 @@ static char_u *get_fname(mparm_T *parmp)
|
|||||||
/* Temporarily add '(' and ')' to 'isfname'. These are valid
|
/* Temporarily add '(' and ')' to 'isfname'. These are valid
|
||||||
* filename characters but are excluded from 'isfname' to make
|
* filename characters but are excluded from 'isfname' to make
|
||||||
* "gf" work on a file name in parenthesis (e.g.: see vim.h). */
|
* "gf" work on a file name in parenthesis (e.g.: see vim.h). */
|
||||||
do_cmdline_cmd((char_u *)":set isf+=(,)");
|
do_cmdline_cmd(":set isf+=(,)");
|
||||||
alist_expand(NULL, 0);
|
alist_expand(NULL, 0);
|
||||||
do_cmdline_cmd((char_u *)":set isf&");
|
do_cmdline_cmd(":set isf&");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return alist_name(&GARGLIST[0]);
|
return alist_name(&GARGLIST[0]);
|
||||||
@@ -1438,7 +1436,7 @@ static void handle_tag(char_u *tagname)
|
|||||||
swap_exists_did_quit = FALSE;
|
swap_exists_did_quit = FALSE;
|
||||||
|
|
||||||
vim_snprintf((char *)IObuff, IOSIZE, "ta %s", tagname);
|
vim_snprintf((char *)IObuff, IOSIZE, "ta %s", tagname);
|
||||||
do_cmdline_cmd(IObuff);
|
do_cmdline_cmd((char *)IObuff);
|
||||||
TIME_MSG("jumping to tag");
|
TIME_MSG("jumping to tag");
|
||||||
|
|
||||||
/* If the user doesn't want to edit the file then we quit here. */
|
/* If the user doesn't want to edit the file then we quit here. */
|
||||||
@@ -1715,7 +1713,7 @@ static void edit_buffers(mparm_T *parmp)
|
|||||||
*/
|
*/
|
||||||
static void exe_pre_commands(mparm_T *parmp)
|
static void exe_pre_commands(mparm_T *parmp)
|
||||||
{
|
{
|
||||||
char_u **cmds = parmp->pre_commands;
|
char **cmds = parmp->pre_commands;
|
||||||
int cnt = parmp->n_pre_commands;
|
int cnt = parmp->n_pre_commands;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -1904,12 +1902,11 @@ process_env (
|
|||||||
int is_viminit /* when TRUE, called for VIMINIT */
|
int is_viminit /* when TRUE, called for VIMINIT */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
char_u *initstr;
|
|
||||||
char_u *save_sourcing_name;
|
char_u *save_sourcing_name;
|
||||||
linenr_T save_sourcing_lnum;
|
linenr_T save_sourcing_lnum;
|
||||||
scid_T save_sid;
|
scid_T save_sid;
|
||||||
|
|
||||||
initstr = (char_u *)os_getenv((char *)env);
|
char *initstr = (char *)os_getenv((char *)env);
|
||||||
if (initstr != NULL && *initstr != NUL) {
|
if (initstr != NULL && *initstr != NUL) {
|
||||||
if (is_viminit)
|
if (is_viminit)
|
||||||
vimrc_found(NULL, NULL);
|
vimrc_found(NULL, NULL);
|
||||||
|
|||||||
@@ -498,9 +498,9 @@ void free_all_mem(void)
|
|||||||
/* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */
|
/* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */
|
||||||
p_ea = FALSE;
|
p_ea = FALSE;
|
||||||
if (first_tabpage->tp_next != NULL)
|
if (first_tabpage->tp_next != NULL)
|
||||||
do_cmdline_cmd((char_u *)"tabonly!");
|
do_cmdline_cmd("tabonly!");
|
||||||
if (firstwin != lastwin)
|
if (firstwin != lastwin)
|
||||||
do_cmdline_cmd((char_u *)"only!");
|
do_cmdline_cmd("only!");
|
||||||
|
|
||||||
/* Free all spell info. */
|
/* Free all spell info. */
|
||||||
spell_free_all();
|
spell_free_all();
|
||||||
@@ -509,18 +509,18 @@ void free_all_mem(void)
|
|||||||
ex_comclear(NULL);
|
ex_comclear(NULL);
|
||||||
|
|
||||||
/* Clear menus. */
|
/* Clear menus. */
|
||||||
do_cmdline_cmd((char_u *)"aunmenu *");
|
do_cmdline_cmd("aunmenu *");
|
||||||
do_cmdline_cmd((char_u *)"menutranslate clear");
|
do_cmdline_cmd("menutranslate clear");
|
||||||
|
|
||||||
/* Clear mappings, abbreviations, breakpoints. */
|
/* Clear mappings, abbreviations, breakpoints. */
|
||||||
do_cmdline_cmd((char_u *)"lmapclear");
|
do_cmdline_cmd("lmapclear");
|
||||||
do_cmdline_cmd((char_u *)"xmapclear");
|
do_cmdline_cmd("xmapclear");
|
||||||
do_cmdline_cmd((char_u *)"mapclear");
|
do_cmdline_cmd("mapclear");
|
||||||
do_cmdline_cmd((char_u *)"mapclear!");
|
do_cmdline_cmd("mapclear!");
|
||||||
do_cmdline_cmd((char_u *)"abclear");
|
do_cmdline_cmd("abclear");
|
||||||
do_cmdline_cmd((char_u *)"breakdel *");
|
do_cmdline_cmd("breakdel *");
|
||||||
do_cmdline_cmd((char_u *)"profdel *");
|
do_cmdline_cmd("profdel *");
|
||||||
do_cmdline_cmd((char_u *)"set keymap=");
|
do_cmdline_cmd("set keymap=");
|
||||||
|
|
||||||
free_titles();
|
free_titles();
|
||||||
free_findfile();
|
free_findfile();
|
||||||
|
|||||||
@@ -4172,11 +4172,11 @@ static void nv_Zet(cmdarg_T *cap)
|
|||||||
if (!checkclearopq(cap->oap)) {
|
if (!checkclearopq(cap->oap)) {
|
||||||
switch (cap->nchar) {
|
switch (cap->nchar) {
|
||||||
/* "ZZ": equivalent to ":x". */
|
/* "ZZ": equivalent to ":x". */
|
||||||
case 'Z': do_cmdline_cmd((char_u *)"x");
|
case 'Z': do_cmdline_cmd("x");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* "ZQ": equivalent to ":q!" (Elvis compatible). */
|
/* "ZQ": equivalent to ":q!" (Elvis compatible). */
|
||||||
case 'Q': do_cmdline_cmd((char_u *)"q!");
|
case 'Q': do_cmdline_cmd("q!");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: clearopbeep(cap->oap);
|
default: clearopbeep(cap->oap);
|
||||||
@@ -4392,7 +4392,7 @@ static void nv_ident(cmdarg_T *cap)
|
|||||||
add_to_history(HIST_SEARCH, buf, true, NUL);
|
add_to_history(HIST_SEARCH, buf, true, NUL);
|
||||||
(void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0);
|
(void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0);
|
||||||
} else
|
} else
|
||||||
do_cmdline_cmd(buf);
|
do_cmdline_cmd((char *)buf);
|
||||||
|
|
||||||
xfree(buf);
|
xfree(buf);
|
||||||
}
|
}
|
||||||
@@ -4704,9 +4704,9 @@ static void nv_down(cmdarg_T *cap)
|
|||||||
/* In a quickfix window a <CR> jumps to the error under the cursor. */
|
/* In a quickfix window a <CR> jumps to the error under the cursor. */
|
||||||
if (bt_quickfix(curbuf) && cap->cmdchar == CAR)
|
if (bt_quickfix(curbuf) && cap->cmdchar == CAR)
|
||||||
if (curwin->w_llist_ref == NULL)
|
if (curwin->w_llist_ref == NULL)
|
||||||
do_cmdline_cmd((char_u *)".cc"); /* quickfix window */
|
do_cmdline_cmd(".cc"); /* quickfix window */
|
||||||
else
|
else
|
||||||
do_cmdline_cmd((char_u *)".ll"); /* location list window */
|
do_cmdline_cmd(".ll"); /* location list window */
|
||||||
else {
|
else {
|
||||||
/* In the cmdline window a <CR> executes the command. */
|
/* In the cmdline window a <CR> executes the command. */
|
||||||
if (cmdwin_type != 0 && cap->cmdchar == CAR)
|
if (cmdwin_type != 0 && cap->cmdchar == CAR)
|
||||||
@@ -6018,7 +6018,7 @@ static void nv_suspend(cmdarg_T *cap)
|
|||||||
clearop(cap->oap);
|
clearop(cap->oap);
|
||||||
if (VIsual_active)
|
if (VIsual_active)
|
||||||
end_visual_mode(); /* stop Visual mode */
|
end_visual_mode(); /* stop Visual mode */
|
||||||
do_cmdline_cmd((char_u *)"st");
|
do_cmdline_cmd("st");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -6045,7 +6045,7 @@ static void nv_g_cmd(cmdarg_T *cap)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '&':
|
case '&':
|
||||||
do_cmdline_cmd((char_u *)"%s//~/&");
|
do_cmdline_cmd("%s//~/&");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -12901,7 +12901,7 @@ void ex_spelldump(exarg_T *eap)
|
|||||||
get_option_value((char_u*)"spl", &dummy, &spl, OPT_LOCAL);
|
get_option_value((char_u*)"spl", &dummy, &spl, OPT_LOCAL);
|
||||||
|
|
||||||
// Create a new empty buffer in a new window.
|
// Create a new empty buffer in a new window.
|
||||||
do_cmdline_cmd((char_u *)"new");
|
do_cmdline_cmd("new");
|
||||||
|
|
||||||
// enable spelling locally in the new window
|
// enable spelling locally in the new window
|
||||||
set_option_value((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL);
|
set_option_value((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL);
|
||||||
|
|||||||
@@ -3268,7 +3268,7 @@ static void syn_cmd_reset(exarg_T *eap, int syncing)
|
|||||||
eap->nextcmd = check_nextcmd(eap->arg);
|
eap->nextcmd = check_nextcmd(eap->arg);
|
||||||
if (!eap->skip) {
|
if (!eap->skip) {
|
||||||
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset");
|
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset");
|
||||||
do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim");
|
do_cmdline_cmd("runtime! syntax/syncolor.vim");
|
||||||
do_unlet((char_u *)"g:syntax_cmd", TRUE);
|
do_unlet((char_u *)"g:syntax_cmd", TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3291,12 +3291,12 @@ static void syn_cmd_off(exarg_T *eap, int syncing)
|
|||||||
|
|
||||||
static void syn_cmd_onoff(exarg_T *eap, char *name)
|
static void syn_cmd_onoff(exarg_T *eap, char *name)
|
||||||
{
|
{
|
||||||
char_u buf[100];
|
char buf[100];
|
||||||
|
|
||||||
eap->nextcmd = check_nextcmd(eap->arg);
|
eap->nextcmd = check_nextcmd(eap->arg);
|
||||||
if (!eap->skip) {
|
if (!eap->skip) {
|
||||||
STRCPY(buf, "so ");
|
strcpy(buf, "so ");
|
||||||
vim_snprintf((char *)buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name);
|
vim_snprintf(buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name);
|
||||||
do_cmdline_cmd(buf);
|
do_cmdline_cmd(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2511,7 +2511,7 @@ jumpto_tag (
|
|||||||
check_cursor();
|
check_cursor();
|
||||||
} else {
|
} else {
|
||||||
curwin->w_cursor.lnum = 1; /* start command in line 1 */
|
curwin->w_cursor.lnum = 1; /* start command in line 1 */
|
||||||
do_cmdline_cmd(pbuf);
|
do_cmdline_cmd((char *)pbuf);
|
||||||
retval = OK;
|
retval = OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ end:
|
|||||||
ui_busy_stop();
|
ui_busy_stop();
|
||||||
if (close) {
|
if (close) {
|
||||||
term->opts.close_cb(term->opts.data);
|
term->opts.close_cb(term->opts.data);
|
||||||
do_cmdline_cmd((uint8_t *)"bwipeout!");
|
do_cmdline_cmd("bwipeout!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ do_window (
|
|||||||
linenr_T lnum = -1;
|
linenr_T lnum = -1;
|
||||||
int type = FIND_DEFINE;
|
int type = FIND_DEFINE;
|
||||||
size_t len;
|
size_t len;
|
||||||
char_u cbuf[40];
|
char cbuf[40];
|
||||||
|
|
||||||
if (Prenum == 0)
|
if (Prenum == 0)
|
||||||
Prenum1 = 1;
|
Prenum1 = 1;
|
||||||
@@ -124,7 +124,7 @@ do_window (
|
|||||||
case Ctrl_HAT:
|
case Ctrl_HAT:
|
||||||
case '^':
|
case '^':
|
||||||
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum);
|
cmd_with_count("split #", (char_u *)cbuf, sizeof(cbuf), Prenum);
|
||||||
do_cmdline_cmd(cbuf);
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -135,12 +135,12 @@ do_window (
|
|||||||
newwindow:
|
newwindow:
|
||||||
if (Prenum)
|
if (Prenum)
|
||||||
/* window height */
|
/* window height */
|
||||||
vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%" PRId64, (int64_t)Prenum);
|
vim_snprintf(cbuf, sizeof(cbuf) - 5, "%" PRId64, (int64_t)Prenum);
|
||||||
else
|
else
|
||||||
cbuf[0] = NUL;
|
cbuf[0] = NUL;
|
||||||
if (nchar == 'v' || nchar == Ctrl_V)
|
if (nchar == 'v' || nchar == Ctrl_V)
|
||||||
STRCAT(cbuf, "v");
|
strcat(cbuf, "v");
|
||||||
STRCAT(cbuf, "new");
|
strcat(cbuf, "new");
|
||||||
do_cmdline_cmd(cbuf);
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ newwindow:
|
|||||||
case Ctrl_Q:
|
case Ctrl_Q:
|
||||||
case 'q':
|
case 'q':
|
||||||
reset_VIsual_and_resel(); /* stop Visual mode */
|
reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
cmd_with_count("quit", cbuf, sizeof(cbuf), Prenum);
|
cmd_with_count("quit", (char_u *)cbuf, sizeof(cbuf), Prenum);
|
||||||
do_cmdline_cmd(cbuf);
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ newwindow:
|
|||||||
case Ctrl_C:
|
case Ctrl_C:
|
||||||
case 'c':
|
case 'c':
|
||||||
reset_VIsual_and_resel(); /* stop Visual mode */
|
reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
cmd_with_count("close", cbuf, sizeof(cbuf), Prenum);
|
cmd_with_count("close", (char_u *)cbuf, sizeof(cbuf), Prenum);
|
||||||
do_cmdline_cmd(cbuf);
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ newwindow:
|
|||||||
case Ctrl_Z:
|
case Ctrl_Z:
|
||||||
case 'z':
|
case 'z':
|
||||||
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
do_cmdline_cmd((char_u *)"pclose");
|
do_cmdline_cmd("pclose");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* cursor to preview window */
|
/* cursor to preview window */
|
||||||
@@ -182,7 +182,7 @@ newwindow:
|
|||||||
case Ctrl_O:
|
case Ctrl_O:
|
||||||
case 'o':
|
case 'o':
|
||||||
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
|
||||||
cmd_with_count("only", cbuf, sizeof(cbuf), Prenum);
|
cmd_with_count("only", (char_u *)cbuf, sizeof(cbuf), Prenum);
|
||||||
do_cmdline_cmd(cbuf);
|
do_cmdline_cmd(cbuf);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ wingotofile:
|
|||||||
* cursor in a new window.
|
* cursor in a new window.
|
||||||
*/
|
*/
|
||||||
if (bt_quickfix(curbuf)) {
|
if (bt_quickfix(curbuf)) {
|
||||||
sprintf((char *)cbuf, "split +%" PRId64 "%s",
|
sprintf(cbuf, "split +%" PRId64 "%s",
|
||||||
(int64_t)curwin->w_cursor.lnum,
|
(int64_t)curwin->w_cursor.lnum,
|
||||||
(curwin->w_llist_ref == NULL) ? "cc" : "ll");
|
(curwin->w_llist_ref == NULL) ? "cc" : "ll");
|
||||||
do_cmdline_cmd(cbuf);
|
do_cmdline_cmd(cbuf);
|
||||||
|
|||||||
Reference in New Issue
Block a user