Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
include:
- os: ubuntu-24.04
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz
steps:
- uses: actions/checkout@v4
- run: date +%F > todays-date
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ require("telescope").extensions = {
| <C-h> | Show key bindings |
| <C-n> | Rename selected entry |
| <C-q> | Run macro on files in quickfix list |
| <C-r> | Run macro |
| <C-r> | Run macro (supports v:count) |
| <C-s> | Save a macro/register |
| <C-x> | Edit register (<C-c> can be used to copy the register as printable) |

Expand Down
6 changes: 4 additions & 2 deletions lua/macrothis/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,11 @@ end
---
---@usage `require('macrothis').run()`
macrothis.run = function()
local count = vim.v.count1
local menuelem = macrothis.generate_menu_items()

vim.ui.select(menuelem, {
prompt = "Run on quickfix list",
prompt = "Run macro",
format_item = function(item)
return ("%s: %s"):format(item.label, item.value)
end,
Expand All @@ -219,7 +220,8 @@ macrothis.run = function()
utils.run_macro(
macrothis.opts,
macrothis.opts.run_register,
description.label
description.label,
count
)
macrothis.opts.last_used = description.label
end
Expand Down
9 changes: 7 additions & 2 deletions lua/macrothis/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,15 @@ utils.remove_entry = function(opts, description)
utils.save_data(opts, data)
end

utils.run_macro = function(opts, register, description)
utils.run_macro = function(opts, register, description, count)
utils.load_register(opts, register, description)
vim.api.nvim_feedkeys(
vim.api.nvim_replace_termcodes("@" .. register, true, false, true),
vim.api.nvim_replace_termcodes(
count .. "@" .. register,
true,
false,
true
),
"n",
false
)
Expand Down