[vim/vim] Add a new attribute to `command` and offer functions to change Vim-modes more free. (Issue #14157)

15 views
Skip to first unread message

appleWhiteMm

unread,
Mar 7, 2024, 4:39:59 AM3/7/24
to vim/vim, Subscribed

Add a new attribute to command and offer some functions to change Vim-modes more free.

I want to use a command to accomplish these:

  1. Stay in to the command-line mode after running the command;
  2. And the put a new command in the command-line without leaving the command-line mode -- so I can do some (casual) edit to the new command before execute it manually or by setcmdline().

But the problem: after running the Vim command, Vim will enter into the normal mode automatically, in which setcmdline() takes no effect.

The alternatives I've considered, but I prefer not to adopt them for some personal reasions:

  • Using feedkeys(): it's hacky;
  • Using map, setcmdline(): for example, cnoremap kk <Cmd>call setcmdline(':echon 1')<CR>: I don't want use map, but just want to use the "command" way!
  • Using input(): it cannot lead to the command-line mode.
  • Using -nargs attribute of command: it's too rigid to make make changes to the command content.

So, the feature requests or solutions I'd like are:

  • Offering a command( for example, :startcmdline, just like :startinsert) and a function( for example, setcmdmode(), just like setcmdline()) to enter into and stay in the command-line mode, by which user can use setcmdline() to input some new commands.
    • May setnormalmode(), setinsertmode() are also needed.
  • Offering an new attribute to command, to make command work like <Cmd> -- it begins a "new command mapping", and executes the command directly without changing modes.

--Thanks for the valuable contributions to Vim!


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/14157@github.com>

Reply all
Reply to author
Forward
0 new messages