GNU/Linux ◆ screen-256color ◆ zsh 2256 views

Search selected text and apply macro in match

These are the keymaps I used in the demo.

-- Begin a "searchable" macro
vim.keymap.set('x', 'qi', [[y<cmd>let @/=substitute(escape(@", '/'), '\n', '\\n', 'g')<cr>gvqi]])

-- Apply macro in the next instance of the search
vim.keymap.set('n', '<F8>', 'gn@i')