Hi, On Tue, May 24, 2016 at 7:01 AM, Yegappan Lakshmanan <yegapp...@gmail.com> wrote: > Hi Bram, > > On Mon, May 23, 2016 at 12:57 PM, Bram Moolenaar <b...@moolenaar.net> wrote: >>> >> > >>> >> > We could make the modifiers available in <> form, so that the user >>> >> > command can apply them where needed. Possibly just <mods>, to pass on >>> >> > all modifiers. >>> >> >>> >> The attached patch adds support for the <mods> user command escape >>> >> sequence. >>> > >>> > Thanks. It would be nice if the help has an example that shows how the >>> > modifiers are applied to only one of the commands. E.g. do something >>> > else before the "split". >>> > >>> >>> We can use the example quoted by the OP: >>> >>> :command! -nargs=1 Foo <mods> split <args> >>> >>> Now the ":tab Foo bar" command will open the file in a new tab. >> >> It would be clearer if there is another command before or after the >> "split". E.g. >> <mods> split <args> | edit Results >> So that we see that <mods> only applies to "split", not to "edit". >> > > The above command will always load the file named Results. > How about this example? > > command! -nargs=+ -complete=file MyEdit for f in expand(<q-args>, 0, > 1) | exe '<mods> split ' . f | endfor > > This command opens one or more files in a new split window. If the > command modifiers like "vert" or "tab" are specified, then it opens them > in a vertically split windows or tab pages. >
And the below example for <q-mods>: function! SpecialEdit(files, mods) for f in expand(a:files, 0, 1) exe a:mods . ' split ' . f endfor endfunction command! -nargs=+ -complete=file Sedit \ call SpecialEdit(<q-args>, <q-mods>) - Yegappan -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.