From cc64688d2c82a0b42294df803408c05af31e2dc8 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Sat, 24 Jan 2015 22:42:29 +0100 Subject: [PATCH] Don't end :open command at pipe (#159). The pipe as command separator is now also removed for :open and :tabopen commands as well as for all mapping commands, like in pendatactyl. --- doc/vimb.1 | 36 ++++++++++++++++++++++++------------ src/ex.c | 16 ++++++++-------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/doc/vimb.1 b/doc/vimb.1 index c0d09fa..c0d87fb 100644 --- a/doc/vimb.1 +++ b/doc/vimb.1 @@ -399,6 +399,29 @@ exists any command that uses the count. Commands that are typed interactive (from inputbox or from socket) are normally recorded into command history and register. To avoid this, the commands can be prefixed by one or more additional `:' or whitespace. +.PP +Multiple commands, separated by a `|' can be given in a single command line +and will be executed consecutively. The pipe can be included as an argument to +a command by escaping it with a backslash. +.br +Following commands process the entire command-line string literally. These +commands will include any `|' as part of their argument string and so cannot +be followed by another command. +.PP +.PD 0 +.IP - 2 +autocmd +.IP - +cmap, cnoremap, imap, inoremap, nmap, nnoremap +.IP - +eval +.IP - +normal +.IP - +open, tabopen +.IP - +shellcmd +.PD .SS Command Line Editing .TP .B , CTRL\-[, CTRL-C @@ -636,9 +659,6 @@ Removes all entries from queue. An autocommand is a command that is executed automatically in response to some event, such as a URI being opened. Autocommands are very powerful. Use them with care and they will help you avoid typing many commands. -.PP -Note: The ":autocmd" command cannot be followed by another command, since -any '|' is considered part of the command. .RS 0 .TP Autocommands are built with following properties. @@ -764,10 +784,7 @@ Example Runs given shell \fIcmd\fP syncron and print the output into inputbox. Following pattern in \fIcmd\fP are expanded, '~username', '~/', '$VAR' and '${VAR}'. A '\\' before these patterns disables the expansion. - .RS -Note: The ":shellcmd" command cannot be followed by another command, since -any '|' is considered part of the command. .PP .PD 0 Following environment variables are set for called shell commands. @@ -848,9 +865,6 @@ URL of the hint. Runs the given \fIjavascript\fP in the current page and display the evaluated value. -This comman cannot be followed by antoher command, since any '|' is considered -part of the command. - Example: :eval document.cookie .TP .BI :e[val]! " javascript" @@ -859,11 +873,9 @@ Like :eval, but there is nothing print to the input box. .BI ":no[rmal] [" cmds ] Execute normal mode commands \fIcmds\fP. This makes it possible to execute normal mode commands typed on the input box. - +.br \fIcmds\fP cannot start with a space. Put a count of 1 (one) before it, "1 " is one space. -This comman cannot be followed by antoher command, since any '|' is considered -part of the command. Example: :set scripts!|no! R .TP diff --git a/src/ex.c b/src/ex.c index 89d31a3..de10699 100644 --- a/src/ex.c +++ b/src/ex.c @@ -170,21 +170,21 @@ static ExInfo commands[] = { #endif {"bma", EX_BMA, ex_bookmark, EX_FLAG_RHS}, {"bmr", EX_BMR, ex_bookmark, EX_FLAG_RHS}, - {"cmap", EX_CMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS}, - {"cnoremap", EX_CNOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS}, + {"cmap", EX_CMAP, ex_map, EX_FLAG_LHS|EX_FLAG_CMD}, + {"cnoremap", EX_CNOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_CMD}, {"cunmap", EX_CUNMAP, ex_unmap, EX_FLAG_LHS}, {"hardcopy", EX_HARDCOPY, ex_hardcopy, EX_FLAG_NONE}, {"handler-add", EX_HANDADD, ex_handlers, EX_FLAG_RHS}, {"handler-remove", EX_HANDREM, ex_handlers, EX_FLAG_RHS}, {"eval", EX_EVAL, ex_eval, EX_FLAG_CMD|EX_FLAG_BANG}, - {"imap", EX_IMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS}, - {"inoremap", EX_INOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS}, + {"imap", EX_IMAP, ex_map, EX_FLAG_LHS|EX_FLAG_CMD}, + {"inoremap", EX_INOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_CMD}, {"iunmap", EX_IUNMAP, ex_unmap, EX_FLAG_LHS}, - {"nmap", EX_NMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS}, - {"nnoremap", EX_NNOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_RHS}, + {"nmap", EX_NMAP, ex_map, EX_FLAG_LHS|EX_FLAG_CMD}, + {"nnoremap", EX_NNOREMAP, ex_map, EX_FLAG_LHS|EX_FLAG_CMD}, {"normal", EX_NORMAL, ex_normal, EX_FLAG_BANG|EX_FLAG_CMD}, {"nunmap", EX_NUNMAP, ex_unmap, EX_FLAG_LHS}, - {"open", EX_OPEN, ex_open, EX_FLAG_RHS}, + {"open", EX_OPEN, ex_open, EX_FLAG_CMD}, {"quit", EX_QUIT, ex_quit, EX_FLAG_NONE|EX_FLAG_BANG}, #ifdef FEATURE_QUEUE {"qunshift", EX_QUNSHIFT, ex_queue, EX_FLAG_RHS}, @@ -199,7 +199,7 @@ static ExInfo commands[] = { {"shortcut-add", EX_SCA, ex_shortcut, EX_FLAG_RHS}, {"shortcut-default", EX_SCD, ex_shortcut, EX_FLAG_RHS}, {"shortcut-remove", EX_SCR, ex_shortcut, EX_FLAG_RHS}, - {"tabopen", EX_TABOPEN, ex_open, EX_FLAG_RHS}, + {"tabopen", EX_TABOPEN, ex_open, EX_FLAG_CMD}, }; static struct { -- 2.20.1