feat(nvim): smaller updates
This commit is contained in:
parent
531e4dee02
commit
86091c0e15
4 changed files with 146 additions and 49 deletions
|
@ -20,6 +20,7 @@ vim.o.list = true
|
||||||
-- always show status & tab line
|
-- always show status & tab line
|
||||||
vim.o.laststatus = 3
|
vim.o.laststatus = 3
|
||||||
vim.o.showtabline = 2
|
vim.o.showtabline = 2
|
||||||
|
vim.g.termguicolors = false
|
||||||
-- completion height
|
-- completion height
|
||||||
vim.o.pumheight = 15
|
vim.o.pumheight = 15
|
||||||
-- split directions
|
-- split directions
|
||||||
|
@ -29,6 +30,10 @@ vim.o.wrap = false
|
||||||
-- redefine word boundaries - '_' is a word seperator, this helps with snake_case
|
-- redefine word boundaries - '_' is a word seperator, this helps with snake_case
|
||||||
vim.opt.iskeyword:remove("_")
|
vim.opt.iskeyword:remove("_")
|
||||||
|
|
||||||
|
-- netrw is handled by nvim-tree
|
||||||
|
vim.g.loaded_netrw = 1
|
||||||
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
function Map(mode, shortcut, command, opt)
|
function Map(mode, shortcut, command, opt)
|
||||||
opt = opt or { noremap = true, silent = true }
|
opt = opt or { noremap = true, silent = true }
|
||||||
vim.keymap.set(mode, shortcut, command, opt)
|
vim.keymap.set(mode, shortcut, command, opt)
|
||||||
|
|
|
@ -46,7 +46,7 @@ require("catppuccin").setup({
|
||||||
},
|
},
|
||||||
barbar = false,
|
barbar = false,
|
||||||
bufferline = true,
|
bufferline = true,
|
||||||
dashboard = true, -- manually set
|
dashboard = true,
|
||||||
fern = false,
|
fern = false,
|
||||||
gitgutter = false,
|
gitgutter = false,
|
||||||
gitsigns = true,
|
gitsigns = true,
|
||||||
|
@ -70,6 +70,7 @@ require("catppuccin").setup({
|
||||||
DashboardCenter = { fg = colors.peach },
|
DashboardCenter = { fg = colors.peach },
|
||||||
DashboardShortCut = { fg = colors.yellow },
|
DashboardShortCut = { fg = colors.yellow },
|
||||||
DashboardFooter = { fg = colors.maroon },
|
DashboardFooter = { fg = colors.maroon },
|
||||||
|
["InlayHint"] = { fg = colors.surface0, style = { "italic" } },
|
||||||
FloatBorder = { fg = colors.overlay0 },
|
FloatBorder = { fg = colors.overlay0 },
|
||||||
TelescopeBorder = { link = "FloatBorder" },
|
TelescopeBorder = { link = "FloatBorder" },
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
-- vim:fdm=marker
|
||||||
require("mason").setup({
|
require("mason").setup({
|
||||||
ui = {
|
ui = {
|
||||||
border = "none",
|
border = "none",
|
||||||
|
@ -12,6 +13,7 @@ require("mason-lspconfig").setup({ automatic_installation = true })
|
||||||
|
|
||||||
vim.opt.completeopt = "menu,menuone,noselect"
|
vim.opt.completeopt = "menu,menuone,noselect"
|
||||||
|
|
||||||
|
-- cmp {{{
|
||||||
local present, cmp = pcall(require, "cmp")
|
local present, cmp = pcall(require, "cmp")
|
||||||
if not present or not cmp then
|
if not present or not cmp then
|
||||||
return
|
return
|
||||||
|
@ -116,10 +118,12 @@ cmp.setup.cmdline(":", {
|
||||||
{ name = "cmdline" },
|
{ name = "cmdline" },
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
|
-- }}}
|
||||||
|
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(
|
local capabilities = require("cmp_nvim_lsp").default_capabilities(
|
||||||
vim.lsp.protocol.make_client_capabilities()
|
vim.lsp.protocol.make_client_capabilities()
|
||||||
)
|
)
|
||||||
|
|
||||||
---@diagnostic disable-next-line: unused-local
|
---@diagnostic disable-next-line: unused-local
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
@ -153,44 +157,7 @@ local on_attach = function(client, bufnr)
|
||||||
end
|
end
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
lspconfig.gopls.setup({
|
-- lua {{{
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
require("go").setup({
|
|
||||||
disable_defaults = true,
|
|
||||||
lsp_inlay_hints = {
|
|
||||||
enable = true,
|
|
||||||
-- Only show inlay hints for the current line
|
|
||||||
only_current_line = false,
|
|
||||||
-- Event which triggers a refersh of the inlay hints.
|
|
||||||
-- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
|
|
||||||
-- not that this may cause higher CPU usage.
|
|
||||||
-- This option is only respected when only_current_line and
|
|
||||||
-- autoSetHints both are true.
|
|
||||||
only_current_line_autocmd = "CursorHold",
|
|
||||||
-- whether to show variable name before type hints with the inlay hints or not
|
|
||||||
-- default: false
|
|
||||||
show_variable_name = true,
|
|
||||||
-- prefix for parameter hints
|
|
||||||
parameter_hints_prefix = " ",
|
|
||||||
show_parameter_hints = true,
|
|
||||||
-- prefix for all the other hints (type, chaining)
|
|
||||||
other_hints_prefix = "=> ",
|
|
||||||
-- whether to align to the lenght of the longest line in the file
|
|
||||||
max_len_align = false,
|
|
||||||
-- padding from the left if max_len_align is true
|
|
||||||
max_len_align_padding = 1,
|
|
||||||
-- whether to align to the extreme right or not
|
|
||||||
right_align = false,
|
|
||||||
-- padding from the right if right_align is true
|
|
||||||
right_align_padding = 6,
|
|
||||||
-- The color of the hints
|
|
||||||
highlight = "Comment",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig.sumneko_lua.setup({
|
lspconfig.sumneko_lua.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
@ -212,6 +179,9 @@ lspconfig.sumneko_lua.setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- webdev {{{
|
||||||
lspconfig["emmet_ls"].setup({
|
lspconfig["emmet_ls"].setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
@ -239,6 +209,117 @@ lspconfig.denols.setup({
|
||||||
root_dir = lspconfig.util.root_pattern("deps.ts"),
|
root_dir = lspconfig.util.root_pattern("deps.ts"),
|
||||||
single_file_support = false,
|
single_file_support = false,
|
||||||
})
|
})
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- go (with nvim-go) {{{
|
||||||
|
require("go").setup({
|
||||||
|
disable_defaults = false, -- true|false when true set false to all boolean settings and replace all table
|
||||||
|
-- settings with {}
|
||||||
|
go = "go", -- go command, can be go[default] or go1.18beta1
|
||||||
|
goimport = "gopls", -- goimport command, can be gopls[default] or goimport
|
||||||
|
fillstruct = "gopls", -- can be nil (use fillstruct, slower) and gopls
|
||||||
|
gofmt = "gofumpt", --gofmt cmd,
|
||||||
|
max_line_len = 128, -- max line length in golines format, Target maximum line length for golines
|
||||||
|
tag_transform = false, -- can be transform option("snakecase", "camelcase", etc) check gomodifytags for details and more options
|
||||||
|
gotests_template = "", -- sets gotests -template parameter (check gotests for details)
|
||||||
|
gotests_template_dir = "", -- sets gotests -template_dir parameter (check gotests for details)
|
||||||
|
comment_placeholder = "", -- comment_placeholder your cool placeholder e.g. ﳑ
|
||||||
|
icons = { breakpoint = "🧘", currentpos = "🏃" },
|
||||||
|
verbose = false, -- output loginf in messages
|
||||||
|
lsp_cfg = {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
},
|
||||||
|
lsp_gofumpt = false, -- true: set default gofmt in gopls format to gofumpt
|
||||||
|
lsp_on_attach = nil, -- nil: use on_attach function defined in go/lsp.lua,
|
||||||
|
-- when lsp_cfg is true
|
||||||
|
-- if lsp_on_attach is a function: use this function as on_attach function for gopls
|
||||||
|
lsp_keymaps = true, -- set to false to disable gopls/lsp keymap
|
||||||
|
lsp_codelens = true, -- set to false to disable codelens, true by default, you can use a function
|
||||||
|
-- function(bufnr)
|
||||||
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<space>F", "<cmd>lua vim.lsp.buf.formatting()<CR>", {noremap=true, silent=true})
|
||||||
|
-- end
|
||||||
|
-- to setup a table of codelens
|
||||||
|
lsp_diag_hdlr = true, -- hook lsp diag handler
|
||||||
|
lsp_diag_underline = true,
|
||||||
|
-- virtual text setup
|
||||||
|
lsp_diag_virtual_text = { space = 0, prefix = "" },
|
||||||
|
lsp_diag_signs = true,
|
||||||
|
lsp_diag_update_in_insert = false,
|
||||||
|
lsp_document_formatting = true,
|
||||||
|
-- set to true: use gopls to format
|
||||||
|
-- false if you want to use other formatter tool(e.g. efm, nulls)
|
||||||
|
lsp_inlay_hints = {
|
||||||
|
enable = true,
|
||||||
|
-- Only show inlay hints for the current line
|
||||||
|
only_current_line = false,
|
||||||
|
-- Event which triggers a refersh of the inlay hints.
|
||||||
|
-- You can make this "CursorMoved" or "CursorMoved,CursorMovedI" but
|
||||||
|
-- not that this may cause higher CPU usage.
|
||||||
|
-- This option is only respected when only_current_line and
|
||||||
|
-- autoSetHints both are true.
|
||||||
|
only_current_line_autocmd = "CursorHold",
|
||||||
|
-- whether to show variable name before type hints with the inlay hints or not
|
||||||
|
-- default: false
|
||||||
|
show_variable_name = true,
|
||||||
|
-- prefix for parameter hints
|
||||||
|
parameter_hints_prefix = " ",
|
||||||
|
show_parameter_hints = true,
|
||||||
|
-- prefix for all the other hints (type, chaining)
|
||||||
|
other_hints_prefix = "=> ",
|
||||||
|
-- whether to align to the lenght of the longest line in the file
|
||||||
|
max_len_align = false,
|
||||||
|
-- padding from the left if max_len_align is true
|
||||||
|
max_len_align_padding = 1,
|
||||||
|
-- whether to align to the extreme right or not
|
||||||
|
right_align = false,
|
||||||
|
-- padding from the right if right_align is true
|
||||||
|
right_align_padding = 6,
|
||||||
|
-- The color of the hints
|
||||||
|
highlight = "InlayHint",
|
||||||
|
},
|
||||||
|
gopls_cmd = nil, -- if you need to specify gopls path and cmd, e.g {"/home/user/lsp/gopls", "-logfile","/var/log/gopls.log" }
|
||||||
|
gopls_remote_auto = true, -- add -remote=auto to gopls
|
||||||
|
gocoverage_sign = "█",
|
||||||
|
sign_priority = 5, -- change to a higher number to override other signs
|
||||||
|
dap_debug = true, -- set to false to disable dap
|
||||||
|
dap_debug_keymap = true, -- true: use keymap for debugger defined in go/dap.lua
|
||||||
|
-- false: do not use keymap in go/dap.lua. you must define your own.
|
||||||
|
-- windows: use visual studio keymap
|
||||||
|
dap_debug_gui = true, -- set to true to enable dap gui, highly recommend
|
||||||
|
dap_debug_vt = true, -- set to true to enable dap virtual text
|
||||||
|
build_tags = "", -- set default build tags
|
||||||
|
textobjects = true, -- enable default text jobects through treesittter-text-objects
|
||||||
|
test_runner = "go", -- one of {`go`, `richgo`, `dlv`, `ginkgo`, `gotestsum`}
|
||||||
|
verbose_tests = true, -- set to add verbose flag to tests
|
||||||
|
run_in_floaterm = false, -- set to true to run in float window. :GoTermClose closes the floatterm
|
||||||
|
-- float term recommend if you use richgo/ginkgo with terminal color
|
||||||
|
|
||||||
|
trouble = false, -- true: use trouble to open quickfix
|
||||||
|
test_efm = false, -- errorfomat for quickfix, default mix mode, set to true will be efm only
|
||||||
|
luasnip = false, -- enable included luasnip snippets. you can also disable while add lua/snips folder to luasnip load
|
||||||
|
-- Do not enable this if you already added the path, that will duplicate the entries
|
||||||
|
})
|
||||||
|
-- }}}
|
||||||
|
|
||||||
|
-- DOCKERFILE
|
||||||
|
lspconfig.dockerls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
|
|
||||||
|
lspconfig.yamlls.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = {
|
||||||
|
yaml = {
|
||||||
|
schemas = {
|
||||||
|
["https://json.schemastore.org/github-workflow.json"] = "/.github/workflows/*",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
lspconfig.ltex.setup({
|
lspconfig.ltex.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
|
@ -254,11 +335,6 @@ lspconfig.ltex.setup({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig.yamlls.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
|
|
||||||
local null = require("null-ls")
|
local null = require("null-ls")
|
||||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||||
|
|
||||||
|
@ -268,6 +344,7 @@ null.setup({
|
||||||
null.builtins.formatting.stylua,
|
null.builtins.formatting.stylua,
|
||||||
null.builtins.formatting.stylua,
|
null.builtins.formatting.stylua,
|
||||||
null.builtins.formatting.deno_fmt,
|
null.builtins.formatting.deno_fmt,
|
||||||
|
null.builtins.formatting.prettier,
|
||||||
},
|
},
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
if client.supports_method("textDocument/formatting") then
|
if client.supports_method("textDocument/formatting") then
|
||||||
|
|
|
@ -67,7 +67,6 @@ return packer.startup({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- top bar
|
|
||||||
use({
|
use({
|
||||||
"akinsho/bufferline.nvim",
|
"akinsho/bufferline.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
|
@ -261,11 +260,19 @@ return packer.startup({
|
||||||
})
|
})
|
||||||
|
|
||||||
use({
|
use({
|
||||||
"andweeb/presence.nvim",
|
"nvim-tree/nvim-tree.lua",
|
||||||
config = function()
|
config = function()
|
||||||
require("config/presence")
|
Map("n", "<C-N>", ":NvimTreeToggle<CR>")
|
||||||
|
require("nvim-tree").setup()
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- use({
|
||||||
|
-- "andweeb/presence.nvim",
|
||||||
|
-- config = function()
|
||||||
|
-- require("config/presence")
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
use({ "iamcco/markdown-preview.nvim", run = "cd app && yarn install" })
|
use({ "iamcco/markdown-preview.nvim", run = "cd app && yarn install" })
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
|
@ -282,7 +289,10 @@ return packer.startup({
|
||||||
use("hrsh7th/vim-vsnip")
|
use("hrsh7th/vim-vsnip")
|
||||||
use("petertriho/cmp-git")
|
use("petertriho/cmp-git")
|
||||||
use("onsails/lspkind.nvim")
|
use("onsails/lspkind.nvim")
|
||||||
use("ray-x/go.nvim")
|
use({
|
||||||
|
"ray-x/go.nvim",
|
||||||
|
requires = "ray-x/guihua.lua",
|
||||||
|
})
|
||||||
use("rafamadriz/friendly-snippets")
|
use("rafamadriz/friendly-snippets")
|
||||||
use("jose-elias-alvarez/null-ls.nvim")
|
use("jose-elias-alvarez/null-ls.nvim")
|
||||||
use({
|
use({
|
||||||
|
@ -292,6 +302,10 @@ return packer.startup({
|
||||||
require("config/lspsaga")
|
require("config/lspsaga")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
use({ "rcarriga/nvim-dap-ui", requires = { "mfussenegger/nvim-dap" } })
|
||||||
|
use("theHamsta/nvim-dap-virtual-text")
|
||||||
|
|
||||||
use({ "barreiroleo/ltex-extra.nvim" })
|
use({ "barreiroleo/ltex-extra.nvim" })
|
||||||
|
|
||||||
use("b0o/schemastore.nvim")
|
use("b0o/schemastore.nvim")
|
||||||
|
@ -299,7 +313,7 @@ return packer.startup({
|
||||||
"github/copilot.vim",
|
"github/copilot.vim",
|
||||||
config = function()
|
config = function()
|
||||||
local opt = { noremap = true, silent = true, expr = true }
|
local opt = { noremap = true, silent = true, expr = true }
|
||||||
Map("i", "<C-J>", 'copilot#Accept("<CR>")', opt)
|
Map("i", "<C-J>", 'copilot#Accept("\\<CR>")', opt)
|
||||||
vim.g.copilot_no_tab_map = true
|
vim.g.copilot_no_tab_map = true
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue