Add tabwidth options and golang stuff

This commit is contained in:
Noah Håkansson 2024-01-30 17:24:57 +01:00
parent 721cb29480
commit 7911cca1ca
5 changed files with 131 additions and 1 deletions

View File

@ -621,7 +621,35 @@ require('mason-lspconfig').setup()
-- define the property 'filetypes' to the map in question.
local servers = {
clangd = {},
gopls = {},
gopls = {
gofumpt = true,
usePlaceholders = true,
completeUnimported = true,
matcher = 'Fuzzy',
diagnosticsDelay = '200ms',
symbolMatcher = 'fuzzy',
buildFlags = { '-tags', 'integration' },
-- codelenses
codelenses = {
generate = true, -- show the `go generate` lens.
gc_details = true, -- Show a code lens toggling the display of gc's choices.
test = true,
tidy = true,
vendor = true,
regenerate_cgo = true,
upgrade_dependency = true,
},
-- hints
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
},
pyright = {},
rust_analyzer = {},
-- tsserver = {},

View File

@ -12,9 +12,12 @@
"fidget.nvim": { "branch": "main", "commit": "1d1042d418ee8cb70d68f1e38db639844331c093" },
"friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" },
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
"go.nvim": { "branch": "master", "commit": "24d2fa373d55d9900cd4b502a88214dc17e6fab6" },
"guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
"harpoon": { "branch": "master", "commit": "ccae1b9bec717ae284906b0bf83d720e59d12b91" },
"indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" },
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
"lsp_signature.nvim": { "branch": "master", "commit": "fed2c8389c148ff1dfdcdca63c2b48d08a50dea0" },
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "b9084b1f42f790d6230dc66dbcb6bcc35b148552" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "3614a39aae98ccd34124b072939d6283853b3dd2" },

View File

@ -3,3 +3,6 @@
--
vim.o.cursorline = true
vim.o.expandtab = true
vim.o.shiftwidth = 2
vim.o.tabstop = 2

17
lua/custom/plugins/go.lua Normal file
View File

@ -0,0 +1,17 @@
local M = {
'ray-x/go.nvim',
dependencies = { -- optional packages
'ray-x/guihua.lua',
'neovim/nvim-lspconfig',
'nvim-treesitter/nvim-treesitter',
},
ft = { 'go', 'gomod' },
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
}
function M.config()
-- setup your go.nvim
require('go').setup({})
end
return M

View File

@ -0,0 +1,79 @@
local M = {
'ray-x/lsp_signature.nvim',
event = 'InsertEnter',
}
function M.config()
local cfg = {
debug = false, -- set to true to enable debug logging
log_path = vim.fn.stdpath('cache') .. '/lsp_signature.log', -- log dir when debug is on
-- default is ~/.cache/nvim/lsp_signature.log
verbose = false, -- show debug line number
bind = true, -- This is mandatory, otherwise border config won't get registered.
-- If you want to hook lspsaga or other signature handler, pls set to false
doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated);
-- set to 0 if you DO NOT want any API comments be shown
-- This setting only take effect in insert mode, it does not affect signature help in normal
-- mode, 10 by default
max_height = 12, -- max height of signature floating_window
max_width = 80, -- max_width of signature floating_window, line will be wrapped if exceed max_width
-- the value need >= 40
wrap = true, -- allow doc/signature text wrap inside floating_window, useful if your lsp return doc/sig is too long
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note:
-- will set to true when fully tested, set to false will use whichever side has more space
-- this setting will be helpful if you do not want the PUM and floating win overlap
floating_window_off_x = 1, -- adjust float windows x position.
-- can be either a number or function
floating_window_off_y = 0, -- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines
-- can be either number or function, see examples
close_timeout = 4000, -- close floating window after ms when laster parameter is entered
fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters
hint_enable = true, -- virtual hint enable
hint_prefix = '👉 ',
hint_scheme = 'String',
hint_inline = function()
return false
end, -- should the hint be inline(nvim 0.10 only)? default false
-- return true | 'inline' to show hint inline, return 'eol' to show hint at end of line, return false to disable
-- return 'right_align' to display hint right aligned in the current line
hi_parameter = 'LspSignatureActiveParameter', -- how your parameter will be highlight
handler_opts = {
border = 'rounded', -- double, rounded, single, shadow, none, or a table of borders
},
always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58
auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil.
extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","}
zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom
padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc
transparency = nil, -- disabled by default, allow floating win transparent value 1~100
shadow_blend = 36, -- if you using shadow as border use this set the opacity
shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315'
timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency
toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>'
toggle_key_flip_floatwin_setting = false, -- true: toggle floating_windows: true|false setting after toggle key pressed
-- false: floating_windows setup will not change, toggle_key will pop up signature helper, but signature
-- may not popup when typing depends on floating_window setting
select_signature_key = nil, -- cycle to next signature, e.g. '<M-n>' function overloading
move_cursor_key = nil, -- imap, use nvim_set_current_win to move cursor between current win and floating
}
-- recommended:
require('lsp_signature').setup(cfg) -- no need to specify bufnr if you don't use toggle_key
-- You can also do this inside lsp on_attach
-- note: on_attach deprecated
-- require'lsp_signature'.on_attach(cfg, bufnr) -- no need to specify bufnr if you don't use toggle_key, -- Panda for parameter, NOTE: for the terminal not support emoji, might crash
end
return M