issue #35 config break sign

pull/38/head
ray-x 3 years ago
parent 94d4baac31
commit 37a4cfb1ad

@ -97,11 +97,11 @@ vim.api.nvim_exec([[ autocmd BufWritePre *.go :silent! lua require('go.format').
Note: auto fill struct also supported by gopls lsp-action
| command | Description |
| ------------ | ---------------- |
| GoFillStruct | auto fill struct |
| GoFillSwitch | fill switch |
| GoIfErr | Add if err |
| command | Description |
| ------------ | ------------------------------------------------------------- |
| GoFillStruct | auto fill struct |
| GoFillSwitch | fill switch |
| GoIfErr | Add if err |
| GoFixPlurals | change func foo(b int, a int, r int) -> func foo(b, a, r int) |
```go
@ -327,6 +327,7 @@ require('go').setup({
test_template = '', -- default to testify if not set; g:go_nvim_tests_template check gotests for details
test_template_dir = '', -- default to nil if not set; g:go_nvim_tests_template_dir check gotests for details
comment_placeholder = '' , -- comment_placeholder your cool placeholder e.g. ﳑ    
icons = {breakpoint = '🧘', currentpos = '🏃'},
verbose = false, -- output loginf in messages
lsp_cfg = false, -- true: apply go.nvim non-default gopls setup, if it is a list, will merge with gopls setup e.g.
-- lsp_cfg = {settings={gopls={matcher='CaseInsensitive', ['local'] = 'your_local_module_path', gofumpt = true }}}

@ -8,6 +8,7 @@ _GO_NVIM_CFG = {
tag_transform = false,
test_dir = '',
comment_placeholder = '',
icons = {breakpoint = '🧘', currentpos = '🏃'},
verbose = false,
log_path = vim.fn.expand("$HOME") .. "/tmp/gonvim.log",
lsp_cfg = false, -- true: apply go.nvim non-default gopls setup
@ -25,16 +26,24 @@ _GO_NVIM_CFG = {
}
local dap_config = function()
vim.fn.sign_define('DapBreakpoint', {text = '🧘', texthl = '', linehl = '', numhl = ''})
vim.fn.sign_define('DapStopped', {text = '🏃', texthl = '', linehl = '', numhl = ''})
vim.cmd(
[[command! BreakCondition lua require"dap".set_breakpoint(vim.fn.input("Breakpoint condition: "))]])
vim.fn.sign_define('DapBreakpoint', {
text = _GO_NVIM_CFG.icons.breakpoint,
texthl = '',
linehl = '',
numhl = ''
})
vim.fn.sign_define('DapStopped', {
text = _GO_NVIM_CFG.icons.currentpos,
texthl = '',
linehl = '',
numhl = ''
})
vim.cmd([[command! BreakCondition lua require"dap".set_breakpoint(vim.fn.input("Breakpoint condition: "))]])
vim.cmd([[command! ReplRun lua require"dap".repl.run_last()]])
vim.cmd([[command! ReplToggle lua require"dap".repl.toggle()]])
vim.cmd([[command! ReplOpen lua require"dap".repl.open(), 'split']])
vim.cmd(
[[command! DapRerun lua require'dap'.disconnect();require'dap'.close();require'dap'.run_last()]])
vim.cmd([[command! DapRerun lua require'dap'.disconnect();require'dap'.close();require'dap'.run_last()]])
vim.cmd([[command! DapStop lua require'go.dap'.stop()]])
vim.g.dap_virtual_text = true
@ -55,17 +64,14 @@ function go.setup(cfg)
vim.cmd([[command! -nargs=* GoImport lua require("go.format").goimport(<f-args>)]])
vim.cmd([[command! GoGenerate :setl makeprg=go\ generate | :GoMake]])
vim.cmd(
[[command! -nargs=* GoBuild :setl makeprg=go\ build | lua require'go.asyncmake'.make(<f-args>)]])
vim.cmd(
[[command! -nargs=* GoRun :setl makeprg=go\ run | lua require'go.asyncmake'.make(<f-args>)]])
vim.cmd([[command! -nargs=* GoBuild :setl makeprg=go\ build | lua require'go.asyncmake'.make(<f-args>)]])
vim.cmd([[command! -nargs=* GoRun :setl makeprg=go\ run | lua require'go.asyncmake'.make(<f-args>)]])
-- if you want to output to quickfix
-- vim.cmd(
-- [[command! -nargs=* GoTest :setl makeprg=go\ test\ -v\ ./...| lua require'go.asyncmake'.make(<f-args>)]])
-- example to running test in split buffer
vim.cmd(
[[command! -nargs=* GoTest :setl makeprg=go\ test\ -v\ ./...| lua require'go.runner'.make(<f-args>)]])
vim.cmd([[command! -nargs=* GoTest :setl makeprg=go\ test\ -v\ ./...| lua require'go.runner'.make(<f-args>)]])
vim.cmd([[command! -nargs=* GoCoverage lua require'go.coverage'.run(<f-args>)]])
-- vim.cmd([[command! GoTestCompile :setl makeprg=go\ build | :GoMake]])
@ -104,14 +110,12 @@ function go.setup(cfg)
dap_config()
vim.cmd([[command! -nargs=* GoDebug lua require"go.dap".run(<f-args>)]])
vim.cmd([[command! GoBreakToggle lua require"go.dap".breakpt()]])
vim.cmd(
[[command! BreakCondition lua require"dap".set_breakpoint(vim.fn.input("Breakpoint condition: "))]])
vim.cmd([[command! BreakCondition lua require"dap".set_breakpoint(vim.fn.input("Breakpoint condition: "))]])
vim.cmd([[command! ReplRun lua require"dap".repl.run_last()]])
vim.cmd([[command! ReplToggle lua require"dap".repl.toggle()]])
vim.cmd([[command! ReplOpen lua require"dap".repl.open(), 'split']])
vim.cmd(
[[command! DapRerun lua require'dap'.disconnect();require'dap'.close();require'dap'.run_last()]])
vim.cmd([[command! DapRerun lua require'dap'.disconnect();require'dap'.close();require'dap'.run_last()]])
vim.cmd([[command! GoDbgStop lua require'go.dap'.stop()]])

Loading…
Cancel
Save