feat(exmode): "1q:", :exmode #41010

Problem:
Want `gQ` for _le multicursor_.

Solution:
- Don't use `gQ` for exmode.
- Introduce `:exmode`.
- Introduce `[count]q:` as an alias to `:exmode`.
This commit is contained in:
Justin M. Keyes
2026-07-27 11:12:47 -04:00
committed by GitHub
parent 97a71ab484
commit fbcb7a056c
21 changed files with 97 additions and 66 deletions

View File

@@ -1,6 +1,6 @@
--- Ex mode.
--- - `run()`: non-interactive (`nvim -es`): executes stdin as Ex commands.
--- - `open()`: interactive (`gQ`, `nvim -e`), a keep-open "cmdwin" REPL.
--- - `open()`: interactive (`[count]q:`, `nvim -e`), a keep-open "cmdwin" REPL.
local api = vim.api
local N_ = vim.fn.gettext
@@ -101,6 +101,7 @@ function M.open()
return -- cmdwin failed to open (E1292 already echoed).
end
local buf = api.nvim_get_current_buf()
api.nvim_buf_set_name(buf, N_('[Ex mode]'))
local block_start = api.nvim_buf_line_count(buf)
cont_lines = {}
vim.wo[0][0].statuscolumn = '%#NonText#%{v:lua.require("vim._core.exmode")._statuscolumn()}'
@@ -216,7 +217,7 @@ function M.open()
vim.keymap.set({ 'n', 'i' }, '<CR>', run, { buffer = buf })
vim.keymap.set({ 'n', 'i' }, '<NL>', run, { buffer = buf })
-- Enter Insert mode before any already-typed keys, so `gQcmd<CR>` types "cmd" into the REPL.
-- Enter Insert mode before any already-typed keys, so `1q:cmd<CR>` types "cmd" into the REPL.
api.nvim_feedkeys('i', 'ni', false)
end