This commit is contained in:
qugalet 2024-11-29 20:35:44 +02:00
parent 996ea07546
commit e8653392c7
11 changed files with 316 additions and 36 deletions

View file

@ -0,0 +1,10 @@
function DetectGoHtmlTmpl()
if expand('%:e') == "html" && search("{{") != 0
setfiletype gohtmltmpl
endif
endfunction
augroup filetypedetect
" gohtmltmpl
au BufRead,BufNewFile *.html call DetectGoHtmlTmpl()
augroup END

View file

@ -0,0 +1,5 @@
vim.keymap.set("n", "j", "gj")
vim.keymap.set("n", "k", "gk")
vim.cmd([[set wrap]])
vim.cmd([[set linebreak]])

1
after/ftplugin/tex.lua Normal file
View file

@ -0,0 +1 @@
vim.opt_local.textwidth = 80

View file

@ -1,7 +1,8 @@
require('java').setup()
local lsp_zero = require("lsp-zero")
local lspconfig = require("lspconfig")
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
@ -64,7 +65,7 @@ end)
vim.filetype.add({ extension = { templ = "templ" } })
lsp_zero.setup_servers({ "gopls", "lua_ls", "nil_ls", "pylsp", "clangd" })
lsp_zero.setup_servers({ "gopls", "lua_ls", "nil_ls", "pylsp", "clangd", "jdtls" })
lspconfig.html.setup {
cmd = { "vscode-html-language-server", "--stdio" },
@ -136,6 +137,7 @@ lspconfig.lua_ls.setup({
-- })
local cmp = require("cmp")
local lspkind = require("lspkind")
local cmp_action = require("lsp-zero").cmp_action()
local cmp_select = { behavior = cmp.SelectBehavior.Select }
@ -166,9 +168,17 @@ cmp.setup({
end,
},
sources = {
{ name = 'path' },
{ name = 'nvim_lsp', keyword_length = 1 },
{ name = 'vim-dadbod-completion', keyword_length = 1 },
{ name = 'buffer', keyword_length = 3 },
{ name = "copilot", group_index = 2 },
-- Other Sources
{ name = "nvim_lsp", group_index = 2, keyword_length = 1 },
{ name = "path", group_index = 2 },
{ name = "luasnip", group_index = 2 },
},
formatting = {
format = lspkind.cmp_format({
mode = "symbol",
max_width = 50,
symbol_map = { Copilot = "" }
})
}
})

195
after/plugin/statusline.lua Normal file
View file

@ -0,0 +1,195 @@
local modes = {
["n"] = "NORMAL",
["no"] = "NORMAL",
["v"] = "VISUAL",
["V"] = "VISUAL LINE",
[""] = "VISUAL BLOCK",
["s"] = "SELECT",
["S"] = "SELECT LINE",
[""] = "SELECT BLOCK",
["i"] = "INSERT",
["ic"] = "INSERT",
["R"] = "REPLACE",
["Rv"] = "VISUAL REPLACE",
["c"] = "COMMAND",
["cv"] = "VIM EX",
["ce"] = "EX",
["r"] = "PROMPT",
["rm"] = "MOAR",
["r?"] = "CONFIRM",
["!"] = "SHELL",
["t"] = "TERMINAL",
}
local function mode()
local current_mode = vim.api.nvim_get_mode().mode
return string.format(" %s ", modes[current_mode]):upper()
end
local hlgroups = {
Statusline = { bg = "#282828" },
StatuslineAccent = { fg = "#282828", bg = "#ebdbb2" },
StatuslineInsertAccent = { fg = "#ebdbb2", bg = "#83a598" },
StatuslineVisualAccent = { fg = "#ebdbb2", bg = "#d65d0e" },
StatuslineReplaceAccent = { fg = "#ebdbb2", bg = "#fb4934" },
StatuslineCmdLineAccent = { fg = "#ebdbb2", bg = "#b8bb26" },
StatusLineExtra = { fg = "#ebdbb2", bg = "#665c54" },
StatusLineNC = { fg = "#ebdbb2", bg = "#282828" },
LspDiagnosticsSignError = { fg = "#cc241d", bg = "#282828" },
LspDiagnosticsSignWarning = { fg = "#d79921", bg = "#282828" },
LspDiagnosticsSignHint = { fg = "#ebdbb2", bg = "#282828" },
LspDiagnosticsSignInformation = { fg = "#ebdbb2", bg = "#282828" },
GitSignsAdd = { fg = "#ebdbb2", bg = "#282828" },
GitSignsChange = { fg = "#ebdbb2", bg = "#282828" },
GitSignsDelete = { fg = "#ebdbb2", bg = "#282828" },
}
for hlgroup_name, hlgroup_attr in pairs(hlgroups) do
vim.api.nvim_set_hl(0, hlgroup_name, hlgroup_attr)
end
local function update_mode_colors()
local current_mode = vim.api.nvim_get_mode().mode
local mode_color = "%#StatusLineAccent#"
if current_mode == "n" then
mode_color = "%#StatuslineAccent#"
elseif current_mode == "i" or current_mode == "ic" then
mode_color = "%#StatuslineInsertAccent#"
elseif current_mode == "v" or current_mode == "V" or current_mode == "" then
mode_color = "%#StatuslineVisualAccent#"
elseif current_mode == "R" then
mode_color = "%#StatuslineReplaceAccent#"
elseif current_mode == "c" then
mode_color = "%#StatuslineCmdLineAccent#"
elseif current_mode == "t" then
mode_color = "%#StatuslineTerminalAccent#"
end
return mode_color
end
local function filepath()
local fpath = vim.fn.fnamemodify(vim.fn.expand "%", ":~:.:h")
if fpath == "" or fpath == "." then
return " "
end
return string.format(" %%<%s/", fpath)
end
local function filename()
local fname = vim.fn.expand "%:t"
if fname == "" then
return ""
end
return fname .. " "
end
local function lsp()
local count = {}
local levels = {
errors = "Error",
warnings = "Warn",
info = "Info",
hints = "Hint",
}
for k, level in pairs(levels) do
count[k] = vim.tbl_count(vim.diagnostic.get(0, { severity = level }))
end
local errors = ""
local warnings = ""
local hints = ""
local info = ""
if count["errors"] ~= 0 then
errors = " %#LspDiagnosticsSignError# " .. count["errors"]
end
if count["warnings"] ~= 0 then
warnings = " %#LspDiagnosticsSignWarning# " .. count["warnings"]
end
if count["hints"] ~= 0 then
hints = " %#LspDiagnosticsSignHint# " .. count["hints"]
end
if count["info"] ~= 0 then
info = " %#LspDiagnosticsSignInformation# " .. count["info"]
end
return errors .. warnings .. hints .. info .. "%#Statusline#"
end
local function filetype()
return string.format(" %s ", vim.bo.filetype):upper()
end
local function lineinfo()
if vim.bo.filetype == "alpha" then
return ""
end
return " %P %l:%c "
end
local vcs = function()
local git_info = vim.b.gitsigns_status_dict
if not git_info or git_info.head == "" then
return ""
end
local added = git_info.added and ("%#GitSignsAdd#+" .. git_info.added .. " ") or ""
local changed = git_info.changed and ("%#GitSignsChange#~" .. git_info.changed .. " ") or ""
local removed = git_info.removed and ("%#GitSignsDelete#-" .. git_info.removed .. " ") or ""
if git_info.added == 0 then
added = ""
end
if git_info.changed == 0 then
changed = ""
end
if git_info.removed == 0 then
removed = ""
end
return table.concat {
" ",
added,
changed,
removed,
" ",
"%#GitSignsAdd# ",
git_info.head,
" %#Statusline#",
}
end
Statusline = {}
Statusline.active = function()
return table.concat {
"%#Statusline#",
update_mode_colors(),
mode(),
"%#StatusLineNC# ",
filepath(),
filename(),
"%#StatusLineNC#",
lsp(),
vcs(),
"%=%#StatusLineExtra#",
filetype(),
lineinfo(),
}
end
function Statusline.inactive()
return " %F"
end
function Statusline.short()
return "%#StatusLineNC#  NvimTree"
end
vim.api.nvim_exec([[
augroup Statusline
au!
au WinEnter,BufEnter * setlocal statusline=%!v:lua.Statusline.active()
au WinLeave,BufLeave * setlocal statusline=%!v:lua.Statusline.inactive()
au WinEnter,BufEnter,FileType NvimTree setlocal statusline=%!v:lua.Statusline.short()
augroup END
]], false)

View file

@ -1,4 +1,4 @@
require'nvim-treesitter.configs'.setup {
require 'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "python", "go" },
@ -19,3 +19,5 @@ require'nvim-treesitter.configs'.setup {
additional_vim_regex_highlighting = false,
},
}
vim.treesitter.language.register('markdown', 'vimwiki')

View file

@ -1,47 +1,59 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"LuaSnip": { "branch": "master", "commit": "659c4479529a05cc9b05ef762639a09d366cc690" },
"auto-pairs": { "branch": "master", "commit": "39f06b873a8449af8ff6a3eee716d3da14d63a76" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"conform.nvim": { "branch": "master", "commit": "40d4e98fcc3e6f485f0e8924c63734bc7e305967" },
"conform.nvim": { "branch": "master", "commit": "023f795dbcf32d4351b6a9ed2e613d471b5bb812" },
"copilot-cmp": { "branch": "master", "commit": "b6e5286b3d74b04256d0a7e3bd2908eabec34b44" },
"copilot.lua": { "branch": "master", "commit": "f8d8d872bb319f640d5177dad5fbf01f7a16d7d0" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"firenvim": { "branch": "master", "commit": "64f9389b88c8b0c7667d45c171a5f25c42d852fb" },
"gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" },
"go.nvim": { "branch": "master", "commit": "fb612d13c34d3d1d2caa4d5785733abe70dc22f0" },
"gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" },
"go.nvim": { "branch": "master", "commit": "6368756601a358b1491ac2ff10d0e2939a76df5e" },
"gruvbox.nvim": { "branch": "main", "commit": "49d9c0b150ba70efcd831ec7b3cb8ee740067045" },
"guihua.lua": { "branch": "master", "commit": "225db770e36aae6a1e9e3a65578095c8eb4038d3" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"indent-blankline.nvim": { "branch": "master", "commit": "e7a4442e055ec953311e77791546238d1eaae507" },
"guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" },
"harpoon": { "branch": "harpoon2", "commit": "a84ab829eaf3678b586609888ef52f7779102263" },
"indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" },
"inlay-hints.nvim": { "branch": "master", "commit": "af84dee42cd118af6d592b06c1c0e45d6432a6c0" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "56db3d5ce5476b183783160e6045f7337ba12b83" },
"lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "ab2a3413646fedd77aa0eab4214a6473e62f6a64" },
"lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" },
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"lspkind.nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" },
"lua-async-await": { "branch": "main", "commit": "652d94df34e97abe2d4a689edbc4270e7ead1a98" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.nvim": { "branch": "main", "commit": "0a8a1072137d916406507c941698a4bfa9dbbe7a" },
"mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" },
"mini.nvim": { "branch": "main", "commit": "7b4d5d48b6b5a75009d63f8f3e4ef4819b7e8139" },
"neo-tree.nvim": { "branch": "v3.x", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
"neogit": { "branch": "master", "commit": "001f43f50d9589d837cec59004fd92486ab06870" },
"neogit": { "branch": "master", "commit": "89d13fb9898619774d359a3900959181d60dd02f" },
"no-neck-pain.nvim": { "branch": "main", "commit": "c7efdbd0b739646c58d22fa44f6fffa2973f303e" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" },
"nvim-dap-python": { "branch": "master", "commit": "03fe9592409236b9121c03b66a682dfca15a5cac" },
"nvim-cmp": { "branch": "main", "commit": "f17d9b4394027ff4442b298398dfcaab97e40c4f" },
"nvim-dap": { "branch": "master", "commit": "6bf4de67dbe90271608e1c81797e5edc79ec6335" },
"nvim-dap-python": { "branch": "master", "commit": "3e3dd98d4d83715c9e0e429b4a5da7bd706e6ceb" },
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
"nvim-lspconfig": { "branch": "master", "commit": "b1de227da4ca6baf6ba865bec75917e4b4053844" },
"nvim-java": { "branch": "main", "commit": "905013eb83c58bda992724b3ecbe20f60b58513f" },
"nvim-java-core": { "branch": "main", "commit": "5b03dca22fee76524a89e1c2dc1d73a9f0b1a3bb" },
"nvim-java-dap": { "branch": "main", "commit": "55f239532f7a3789d21ea68d1e795abc77484974" },
"nvim-java-refactor": { "branch": "main", "commit": "ea1420fed5463c9cc976c2b4175f434b3646f0f7" },
"nvim-java-test": { "branch": "main", "commit": "7f0f40e9c5b7eab5096d8bec6ac04251c6e81468" },
"nvim-lspconfig": { "branch": "master", "commit": "d2d153a179ed59aa7134d7ebdf4d7dcb156efa22" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" },
"nvim-treesitter": { "branch": "master", "commit": "5a2ff8b7ca5470b1011ed82ef3fdd53139ffc467" },
"nvim-treesitter": { "branch": "master", "commit": "6389ceb1758b8f62a15194e3b790e33268304cb8" },
"nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" },
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"oil.nvim": { "branch": "master", "commit": "21705a1debe6d85a53c138ab944484b685432b2b" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"telescope.nvim": { "branch": "master", "commit": "df534c3042572fb958586facd02841e10186707c" },
"render-markdown.nvim": { "branch": "main", "commit": "634acd5da964c32f6947cd0c7802d7a116662665" },
"spring-boot.nvim": { "branch": "main", "commit": "218c0c26c14d99feca778e4d13f5ec3e8b1b60f0" },
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" },
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
"vim-fugitive": { "branch": "master", "commit": "d4877e54cef67f5af4f950935b1ade19ed6b7370" },
"vim-tmux-navigator": { "branch": "master", "commit": "a9b52e7d36114d40350099f254b5f299a35df978" },
"vimtex": { "branch": "master", "commit": "ded1d899afa51f42b71bed607680e21338d18c74" },
"vim-tmux-navigator": { "branch": "master", "commit": "424b5caa154bff34dc258ee53cec5a8e36cf7ea8" },
"vimtex": { "branch": "master", "commit": "6ee92c7ed2cdc876f499bd5561a65d04dee10d1f" },
"vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" },
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" },
"which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" },
"window-picker": { "branch": "main", "commit": "41cfaa428577c53552200a404ae9b3a0b5719706" },
"xkbswitch.nvim": { "branch": "master", "commit": "1e14fe0ff9e11ff1671c9db30a8702d9d21f3816" }
}

View file

@ -71,10 +71,10 @@ return {
config = true
},
{
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons", lazy = true },
},
-- {
-- "nvim-lualine/lualine.nvim",
-- dependencies = { "nvim-tree/nvim-web-devicons", lazy = true },
-- },
{
"lukas-reineke/indent-blankline.nvim",
@ -131,6 +131,25 @@ return {
},
},
"onsails/lspkind.nvim",
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = {
suggestion = { enabled = false },
panel = { enabled = false },
}
},
{
"zbirenbaum/copilot-cmp",
config = function()
require("copilot_cmp").setup()
end,
},
{ "rcarriga/nvim-dap-ui", dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" } },
{ "mfussenegger/nvim-dap-python", dependencies = { "mfussenegger/nvim-dap" } },
@ -190,11 +209,26 @@ return {
end
},
{
'MeanderingProgrammer/render-markdown.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {
filetypes = { 'markdown', 'vimwiki' },
},
},
{ 'glacambre/firenvim', build = ":call firenvim#install(0)" },
-- html
"windwp/nvim-ts-autotag",
-- java
'nvim-java/nvim-java',
{
"lervag/vimtex",
lazy = false, -- we don't want to lazy load VimTeX
@ -215,5 +249,19 @@ return {
config = function()
require("inlay-hints").setup()
end
},
{
'stevearc/oil.nvim',
---@module 'oil'
---@type oil.SetupOpts
opts = {},
config = function()
require('oil').setup()
vim.keymap.set("n", "<F6>", "<CMD>Oil<CR>", { desc = "Open parent directory" })
end,
-- Optional dependencies
dependencies = { { "echasnovski/mini.icons", opts = {} } },
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons
}
}

View file

@ -15,6 +15,3 @@ vim.keymap.set("x", "p", "\"_dP")
vim.keymap.set("v", ">", ">gv")
vim.keymap.set("v", "<", "<gv")
vim.keymap.set("n", "j", "gj")
vim.keymap.set("n", "k", "gk")