Skip to content

Commit dc67e85

Browse files
committed
doc: fix command expansion for Make and Grep recipes
1 parent 19aac04 commit dc67e85

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

doc/recipes.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,13 @@ The venerable vim-dispatch provides several commands, but the main `:Make` comma
9090

9191
```lua
9292
vim.api.nvim_create_user_command("Make", function(params)
93-
local args = vim.fn.expandcmd(params.args)
9493
-- Insert args at the '$*' in the makeprg
95-
local cmd, num_subs = vim.o.makeprg:gsub("%$%*", args)
94+
local cmd, num_subs = vim.o.makeprg:gsub("%$%*", params.args)
9695
if num_subs == 0 then
97-
cmd = cmd .. " " .. args
96+
cmd = cmd .. " " .. params.args
9897
end
9998
local task = require("overseer").new_task({
100-
cmd = cmd,
99+
cmd = vim.fn.expandcmd(cmd),
101100
components = {
102101
{ "on_output_quickfix", open = not params.bang, open_height = 8 },
103102
"default",
@@ -117,14 +116,13 @@ We can run `:grep` asynchronously, similar to what we did with `:make` in the ex
117116

118117
```lua
119118
vim.api.nvim_create_user_command("Grep", function(params)
120-
local args = vim.fn.expandcmd(params.args)
121119
-- Insert args at the '$*' in the grepprg
122-
local cmd, num_subs = vim.o.grepprg:gsub("%$%*", args)
120+
local cmd, num_subs = vim.o.grepprg:gsub("%$%*", params.args)
123121
if num_subs == 0 then
124-
cmd = cmd .. " " .. args
122+
cmd = cmd .. " " .. params.args
125123
end
126124
local task = overseer.new_task({
127-
cmd = cmd,
125+
cmd = vim.fn.expandcmd(cmd),
128126
components = {
129127
{
130128
"on_output_quickfix",

0 commit comments

Comments
 (0)