Skip to content

Commit bd7660e

Browse files
committed
feat(test): change GoToTest to GoTestOpen
1 parent ae46e71 commit bd7660e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

after/ftplugin/go.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ vim.api.nvim_create_user_command(
7171
}
7272
)
7373
vim.api.nvim_create_user_command(
74-
'GoToTest',
74+
'GoTestOpen',
75+
'lua require("go.test").test_open(<f-args>)',
76+
{
77+
nargs = '?',
78+
complete = 'command',
79+
}
80+
)
81+
vim.api.nvim_create_user_command(
82+
'GoToTest', -- alias of GoTestOpen
7583
'lua require("go.test").test_open(<f-args>)',
7684
{
7785
nargs = '?',
@@ -183,7 +191,7 @@ vim.api.nvim_clear_autocmds({
183191
if opt.auto_format then
184192
vim.api.nvim_create_autocmd({ 'BufWritePre' }, {
185193
group = group,
186-
pattern = '*.go',
194+
pattern = '*.go',
187195
command = 'GoFormat',
188196
})
189197
end

doc/nvim-go.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ Commands~
165165
`:GoAddTest` *:GoAddTest*
166166
Generate unit test for current function.
167167

168-
`:GoToTest(cmd)` *:GoToTest*
168+
`:GoToTest(cmd)` *:GoTestOpen* *:GoToTest*
169+
`:GoTestOpen(cmd)`
169170
Go from `*.go` to `*_test.go` or go back. It will create new file if
170171
`*_test.go` does not exist. The default command is `edit`, you may pass
171172
`vsplit`, `split`, `tabedit` or commands like that.

0 commit comments

Comments
 (0)