diff --git a/lua/build.lua b/lua/build.lua index fa4ed92..286d837 100644 --- a/lua/build.lua +++ b/lua/build.lua @@ -151,17 +151,15 @@ function build.list_targets() return targets end -local buffer = vim.api.nvim_get_current_buf() - -- Create :BuildDir command -vim.api.nvim_buf_create_user_command(buffer, 'BuildDir', function(opts) +vim.api.nvim_create_user_command('BuildDir', function(opts) build.set_dir(opts.fargs[1]) end, { bang = true, nargs = '?', complete = build.list_dirs, }) -- Create :Build command -vim.api.nvim_buf_create_user_command(buffer, 'Build', function(opts) +vim.api.nvim_create_user_command('Build', function(opts) build.run(opts.fargs) end, { bang = true, nargs = '*', complete = build.list_targets,