You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
5.0 KiB

  1. require('go').setup({
  2. disable_defaults = false, -- true|false when true set false to all boolean settings and replace all table
  3. -- settings with {}
  4. go='go', -- go command, can be go[default] or go1.18beta1
  5. goimport='gopls', -- goimport command, can be gopls[default] or goimport
  6. fillstruct = 'gopls', -- can be nil (use fillstruct, slower) and gopls
  7. gofmt = 'gofumpt', --gofmt cmd,
  8. max_line_len = 128, -- max line length in golines format, Target maximum line length for golines
  9. tag_transform = false, -- can be transform option("snakecase", "camelcase", etc) check gomodifytags for details and more options
  10. gotests_template = "", -- sets gotests -template parameter (check gotests for details)
  11. gotests_template_dir = "", -- sets gotests -template_dir parameter (check gotests for details)
  12. comment_placeholder = '' , -- comment_placeholder your cool placeholder e.g. ﳑ    
  13. icons = {breakpoint = '🧘', currentpos = '🏃'}, -- setup to `false` to disable icons setup
  14. verbose = false, -- output loginf in messages
  15. lsp_cfg = false, -- true: use non-default gopls setup specified in go/lsp.lua
  16. -- false: do nothing
  17. -- if lsp_cfg is a table, merge table with with non-default gopls setup in go/lsp.lua, e.g.
  18. -- lsp_cfg = {settings={gopls={matcher='CaseInsensitive', ['local'] = 'your_local_module_path', gofumpt = true }}}
  19. lsp_gofumpt = false, -- true: set default gofmt in gopls format to gofumpt
  20. lsp_on_attach = nil, -- nil: use on_attach function defined in go/lsp.lua,
  21. -- when lsp_cfg is true
  22. -- if lsp_on_attach is a function: use this function as on_attach function for gopls
  23. lsp_keymaps = true, -- set to false to disable gopls/lsp keymap
  24. lsp_codelens = true, -- set to false to disable codelens, true by default, you can use a function
  25. -- function(bufnr)
  26. -- vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>F", "<cmd>lua vim.lsp.buf.formatting()<CR>", {noremap=true, silent=true})
  27. -- end
  28. -- to setup a table of codelens
  29. lsp_diag_hdlr = true, -- hook lsp diag handler
  30. -- virtual text setup
  31. lsp_diag_virtual_text = { space = 0, prefix = "" },
  32. lsp_diag_signs = true,
  33. lsp_diag_update_in_insert = false,
  34. lsp_document_formatting = true,
  35. -- set to true: use gopls to format
  36. -- false if you want to use other formatter tool(e.g. efm, nulls)
  37. lsp_inlay_hints = {
  38. enable = true,
  39. -- Only show inlay hints for the current line
  40. only_current_line = false,
  41. -- Event which triggers a refersh of the inlay hints.
  42. -- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
  43. -- not that this may cause higher CPU usage.
  44. -- This option is only respected when only_current_line and
  45. -- autoSetHints both are true.
  46. only_current_line_autocmd = "CursorHold",
  47. -- whether to show variable name before type hints with the inlay hints or not
  48. -- default: false
  49. show_variable_name = true,
  50. -- prefix for parameter hints
  51. parameter_hints_prefix = "",
  52. show_parameter_hints = true,
  53. -- prefix for all the other hints (type, chaining)
  54. other_hints_prefix = "=> ",
  55. -- whether to align to the lenght of the longest line in the file
  56. max_len_align = false,
  57. -- padding from the left if max_len_align is true
  58. max_len_align_padding = 1,
  59. -- whether to align to the extreme right or not
  60. right_align = false,
  61. -- padding from the right if right_align is true
  62. right_align_padding = 6,
  63. -- The color of the hints
  64. highlight = "Comment",
  65. },
  66. gopls_cmd = nil, -- if you need to specify gopls path and cmd, e.g {"/home/user/lsp/gopls", "-logfile","/var/log/gopls.log" }
  67. gopls_remote_auto = true, -- add -remote=auto to gopls
  68. gocoverage_sign = "",
  69. sign_priority = 5, -- change to a higher number to override other signs
  70. dap_debug = true, -- set to false to disable dap
  71. dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua
  72. -- false: do not use keymap in go/dap.lua. you must define your own.
  73. -- windows: use visual studio keymap
  74. dap_debug_gui = true, -- set to true to enable dap gui, highly recommand
  75. dap_debug_vt = true, -- set to true to enable dap virtual text
  76. -- build_tags = "tag1,tag2", -- set default build tags
  77. textobjects = true, -- enable default text jobects through treesittter-text-objects
  78. test_runner = 'go', -- one of {`go`, `richgo`, `dlv`, `ginkgo`}
  79. verbose_tests = true, -- set to add verbose flag to tests
  80. run_in_floaterm = false, -- set to true to run in float window. :GoTermClose closes the floatterm
  81. -- float term recommand if you use richgo/ginkgo with terminal color
  82. trouble = false, -- true: use trouble to open quickfix
  83. test_efm = false, -- errorfomat for quickfix, default mix mode, set to true will be efm only
  84. luasnip = false, -- enable included luasnip snippets. you can also disable while add lua/snips folder to luasnip load
  85. -- Do not enable this if you already added the path, that will duplicate the entries
  86. })