00sapo / visual.nvim

First select, then edit. A helix/kakoune-like editing in neovim
GNU General Public License v3.0
181 stars 5 forks source link

Edit commands are not repeatable #8

Closed 00sapo closed 1 year ago

00sapo commented 1 year ago

This is due to the fact that the . command repeats edit commands that happened from normal mode only. We need to remap edit commands from visual ways to hook them and record the modification that happened.

00sapo commented 1 year ago

A solution is mapping . in visual and serendipity modes to a function that repeats the last edit command and then puts the . register. The options should then have a list of "edit" commands that are hooked for remembering them...

00sapo commented 1 year ago

Thanks to Matrix user, for getting last edit command:

local ffi = require('ffi')
ffi.cdef('char *get_inserted(void)')
function GetInserted() return ffi.string(ffi.C.get_inserted()) end

Which puts v before of the wanted command.

However, playing sequences of keys containing insert mode modifications is not possible with current neovim.

See https://github.com/neovim/neovim/issues/19086 and #7

00sapo commented 1 year ago

12a9f10cec255351032f02c73e62089cfb867ae2 and 12a9f10cec255351032f02c73e62089cfb867ae2 partially fix this issue for edit commands. Non-edit commands are not supported by <A-,>. Repeating commands from normal mode works as usual via .