Added jdtls for nvim + auto folding for import statements + some minor config updates
parent
238c6f4628
commit
d15b6100c0
|
|
@ -16,7 +16,7 @@ blur = true
|
|||
[font]
|
||||
# normal = { family = "FiraCode Nerd Font", style = "Bold" }
|
||||
normal = { family = "JetBrainsMonoNerdFont", style = "Regular" }
|
||||
size = 12
|
||||
size = 10.5
|
||||
|
||||
[cursor]
|
||||
style = { shape = "Block", blinking = "Always" }
|
||||
|
|
|
|||
|
|
@ -2,34 +2,36 @@
|
|||
|
||||
## plugins used
|
||||
|
||||
- [nui.nvim](https://github.com/MunifTanjim/nui.nvim.git)
|
||||
- [nvim-ts-autotag](https://github.com/windwp/nvim-ts-autotag.git)
|
||||
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter.git)
|
||||
- [Comment.nvim](https://github.com/numToStr/Comment.nvim.git)
|
||||
- [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git)
|
||||
- [nvim-surround](https://github.com/kylechui/nvim-surround.git)
|
||||
- [vim-cool](https://github.com/romainl/vim-cool.git)
|
||||
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig.git)
|
||||
- [hurl.nvim](https://github.com/jellydn/hurl.nvim.git)
|
||||
- [nvim-notify](https://github.com/rcarriga/nvim-notify.git)
|
||||
- [git-conflict.nvim](https://github.com/akinsho/git-conflict.nvim.git)
|
||||
- [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim.git)
|
||||
- [nvim-colorizer.lua](https://github.com/catgoose/nvim-colorizer.lua.git)
|
||||
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git)
|
||||
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim.git)
|
||||
- [telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim.git)
|
||||
- [conform.nvim](https://github.com/stevearc/conform.nvim.git)
|
||||
- [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons.git)
|
||||
- [blink.cmp](https://github.com/saghen/blink.cmp.git)
|
||||
- [nui.nvim](https://github.com/MunifTanjim/nui.nvim.git)
|
||||
- [friendly-snippets](https://github.com/rafamadriz/friendly-snippets.git)
|
||||
- [trouble.nvim](https://github.com/folke/trouble.nvim.git)
|
||||
- [which-key.nvim](https://github.com/folke/which-key.nvim.git)
|
||||
- [nvim-surround](https://github.com/kylechui/nvim-surround.git)
|
||||
- [lazy.nvim](https://github.com/folke/lazy.nvim.git)
|
||||
- [git-conflict.nvim](https://github.com/akinsho/git-conflict.nvim.git)
|
||||
- [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig.git)
|
||||
- [outline.nvim](https://github.com/hedyhli/outline.nvim.git)
|
||||
- [hurl.nvim](https://github.com/jellydn/hurl.nvim.git)
|
||||
- [fidget.nvim](https://github.com/j-hui/fidget.nvim.git)
|
||||
- [vim-cool](https://github.com/romainl/vim-cool.git)
|
||||
- [lazydev.nvim](https://github.com/folke/lazydev.nvim.git)
|
||||
- [nvim-notify](https://github.com/rcarriga/nvim-notify.git)
|
||||
- [catppuccin](https://github.com/catppuccin/nvim.git)
|
||||
- [luvit-meta](https://github.com/Bilal2453/luvit-meta.git)
|
||||
- [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git)
|
||||
- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter.git)
|
||||
- [nvim-lsp-file-operations](https://github.com/antosha417/nvim-lsp-file-operations.git)
|
||||
- [nvim-ts-autotag](https://github.com/windwp/nvim-ts-autotag.git)
|
||||
- [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git)
|
||||
- [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim.git)
|
||||
- [dressing.nvim](https://github.com/stevearc/dressing.nvim.git)
|
||||
- [telescope-fzf-native.nvim](https://github.com/nvim-telescope/telescope-fzf-native.nvim.git)
|
||||
- [blink.cmp](https://github.com/saghen/blink.cmp.git)
|
||||
- [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim.git)
|
||||
- [plenary.nvim](https://github.com/nvim-lua/plenary.nvim.git)
|
||||
- [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons.git)
|
||||
- [conform.nvim](https://github.com/stevearc/conform.nvim.git)
|
||||
- [luvit-meta](https://github.com/Bilal2453/luvit-meta.git)
|
||||
- [nvim-lsp-file-operations](https://github.com/antosha417/nvim-lsp-file-operations.git)
|
||||
- [nvim-jdtls](https://github.com/mfussenegger/nvim-jdtls.git)
|
||||
- [outline.nvim](https://github.com/hedyhli/outline.nvim.git)
|
||||
- [lazydev.nvim](https://github.com/folke/lazydev.nvim.git)
|
||||
- [fidget.nvim](https://github.com/j-hui/fidget.nvim.git)
|
||||
- [dressing.nvim](https://github.com/stevearc/dressing.nvim.git)
|
||||
- [catppuccin](https://github.com/catppuccin/nvim.git)
|
||||
- [mini.map](https://github.com/echasnovski/mini.map.git)
|
||||
|
|
|
|||
|
|
@ -1,34 +1,134 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
|
||||
"catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" },
|
||||
"conform.nvim": { "branch": "master", "commit": "5ac2bb57a9096f00ca50e1a3c46020d5930319b8" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"git-conflict.nvim": { "branch": "main", "commit": "4bbfdd92d547d2862a75b4e80afaf30e73f7bbb4" },
|
||||
"hurl.nvim": { "branch": "main", "commit": "0e5430d5130fe95fc1b8b015491b50274aa2e796" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"luvit-meta": { "branch": "main", "commit": "0ea4ff636c5bb559ffa78108561d0976f4de9682" },
|
||||
"mini.map": { "branch": "main", "commit": "32a3a5d9a7c074dbb0a4a1d5943d09cb8edbab3f" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "338409dd8a6ed74767bad3eb5269f1b903ffb3cf" },
|
||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "b9c795d3973e8eec22706af14959bc60c579e771" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" },
|
||||
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
|
||||
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "d19def46c112c26c17adeef88dd1253cc6d623a1" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" },
|
||||
"outline.nvim": { "branch": "main", "commit": "1967ef50036b0b1eac4977aeede55915a741afe0" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a8c2223ea6b185701090ccb1ebc7f4e41c4c9784" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" },
|
||||
"vim-cool": { "branch": "master", "commit": "9ea940c0d537e55de0de4c0298c04b976960fb12" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
"Comment.nvim": {
|
||||
"branch": "master",
|
||||
"commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb"
|
||||
},
|
||||
"blink.cmp": {
|
||||
"branch": "main",
|
||||
"commit": "b19413d214068f316c78978b08264ed1c41830ec"
|
||||
},
|
||||
"catppuccin": {
|
||||
"branch": "main",
|
||||
"commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd"
|
||||
},
|
||||
"conform.nvim": {
|
||||
"branch": "master",
|
||||
"commit": "5ac2bb57a9096f00ca50e1a3c46020d5930319b8"
|
||||
},
|
||||
"dressing.nvim": {
|
||||
"branch": "master",
|
||||
"commit": "2d7c2db2507fa3c4956142ee607431ddb2828639"
|
||||
},
|
||||
"fidget.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970"
|
||||
},
|
||||
"friendly-snippets": {
|
||||
"branch": "main",
|
||||
"commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175"
|
||||
},
|
||||
"git-conflict.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "4bbfdd92d547d2862a75b4e80afaf30e73f7bbb4"
|
||||
},
|
||||
"hurl.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "0e5430d5130fe95fc1b8b015491b50274aa2e796"
|
||||
},
|
||||
"lazy.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "306a05526ada86a7b30af95c5cc81ffba93fef97"
|
||||
},
|
||||
"lazydev.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d"
|
||||
},
|
||||
"lualine.nvim": {
|
||||
"branch": "master",
|
||||
"commit": "47f91c416daef12db467145e16bed5bbfe00add8"
|
||||
},
|
||||
"luvit-meta": {
|
||||
"branch": "main",
|
||||
"commit": "0ea4ff636c5bb559ffa78108561d0976f4de9682"
|
||||
},
|
||||
"mini.map": {
|
||||
"branch": "main",
|
||||
"commit": "32a3a5d9a7c074dbb0a4a1d5943d09cb8edbab3f"
|
||||
},
|
||||
"neo-tree.nvim": {
|
||||
"branch": "v3.x",
|
||||
"commit": "f3df514fff2bdd4318127c40470984137f87b62e"
|
||||
},
|
||||
"nui.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "de740991c12411b663994b2860f1a4fd0937c130"
|
||||
},
|
||||
"nvim-colorizer.lua": {
|
||||
"branch": "master",
|
||||
"commit": "338409dd8a6ed74767bad3eb5269f1b903ffb3cf"
|
||||
},
|
||||
"nvim-jdtls": {
|
||||
"branch": "master",
|
||||
"commit": "77ccaeb422f8c81b647605da5ddb4a7f725cda90"
|
||||
},
|
||||
"nvim-lsp-file-operations": {
|
||||
"branch": "master",
|
||||
"commit": "b9c795d3973e8eec22706af14959bc60c579e771"
|
||||
},
|
||||
"nvim-lspconfig": {
|
||||
"branch": "master",
|
||||
"commit": "92ee7d42320edfbb81f3cad851314ab197fa324a"
|
||||
},
|
||||
"nvim-notify": {
|
||||
"branch": "master",
|
||||
"commit": "8701bece920b38ea289b457f902e2ad184131a5d"
|
||||
},
|
||||
"nvim-surround": {
|
||||
"branch": "main",
|
||||
"commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1"
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"branch": "main",
|
||||
"commit": "d19def46c112c26c17adeef88dd1253cc6d623a1"
|
||||
},
|
||||
"nvim-ts-autotag": {
|
||||
"branch": "main",
|
||||
"commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc"
|
||||
},
|
||||
"nvim-web-devicons": {
|
||||
"branch": "master",
|
||||
"commit": "803353450c374192393f5387b6a0176d0972b848"
|
||||
},
|
||||
"outline.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "1967ef50036b0b1eac4977aeede55915a741afe0"
|
||||
},
|
||||
"plenary.nvim": {
|
||||
"branch": "master",
|
||||
"commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509"
|
||||
},
|
||||
"telescope-fzf-native.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c"
|
||||
},
|
||||
"telescope.nvim": {
|
||||
"branch": "master",
|
||||
"commit": "a8c2223ea6b185701090ccb1ebc7f4e41c4c9784"
|
||||
},
|
||||
"todo-comments.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668"
|
||||
},
|
||||
"trouble.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a"
|
||||
},
|
||||
"vim-cool": {
|
||||
"branch": "master",
|
||||
"commit": "9ea940c0d537e55de0de4c0298c04b976960fb12"
|
||||
},
|
||||
"which-key.nvim": {
|
||||
"branch": "main",
|
||||
"commit": "3aab2147e74890957785941f0c1ad87d0a44c15a"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ map("x", "p", '"_dP')
|
|||
map({ "n", "v", "x" }, "x", '"_d')
|
||||
map({ "n", "v", "x" }, "<Del>", '"_x')
|
||||
-- filthy casual save keybind
|
||||
map({ "n", "i" }, "<C-s>", "<cmd>w<cr>", { desc = "File Save" })
|
||||
map({ "n", "i", "v" }, "<C-s>", "<cmd>w<cr>", { desc = "File Save" })
|
||||
-- easy way to close the current buffer
|
||||
map("n", "<C-X>", "<cmd>bd!<cr>", { desc = "Close Buffer" })
|
||||
-- moves the selection up or down using K and J (uppercase)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,130 @@
|
|||
---@module Foldtext
|
||||
---Based on https://www.reddit.com/r/neovim/comments/16sqyjz/finally_we_can_have_highlighted_folds/
|
||||
---Updated with vim.treesitter._fold.foldtext()
|
||||
---Snatched from https://github.com/Wansmer/nvim-config/blob/9f1bc81e32eb32000bad80f9912238f9e36a903a/lua/modules/foldtext.lua
|
||||
|
||||
local function parse_line(linenr)
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
local line = vim.api.nvim_buf_get_lines(bufnr, linenr - 1, linenr, false)[1]
|
||||
if not line then
|
||||
return nil
|
||||
end
|
||||
|
||||
local ok, parser = pcall(vim.treesitter.get_parser, bufnr)
|
||||
if not ok then
|
||||
return nil
|
||||
end
|
||||
|
||||
local query = vim.treesitter.query.get(parser:lang(), "highlights")
|
||||
if not query then
|
||||
return nil
|
||||
end
|
||||
|
||||
local tree = parser:parse({ linenr - 1, linenr })[1]
|
||||
|
||||
local result = {}
|
||||
|
||||
local line_pos = 0
|
||||
|
||||
for id, node, metadata in query:iter_captures(tree:root(), 0, linenr - 1, linenr) do
|
||||
local name = query.captures[id]
|
||||
local start_row, start_col, end_row, end_col = node:range()
|
||||
|
||||
local priority = tonumber(metadata.priority or vim.highlight.priorities.treesitter)
|
||||
|
||||
if start_row == linenr - 1 and end_row == linenr - 1 then
|
||||
-- check for characters ignored by treesitter
|
||||
if start_col > line_pos then
|
||||
table.insert(result, {
|
||||
line:sub(line_pos + 1, start_col),
|
||||
{ { "Folded", priority } },
|
||||
range = { line_pos, start_col },
|
||||
})
|
||||
end
|
||||
line_pos = end_col
|
||||
|
||||
local text = line:sub(start_col + 1, end_col)
|
||||
table.insert(result, { text, { { "@" .. name, priority } }, range = { start_col, end_col } })
|
||||
end
|
||||
end
|
||||
|
||||
local i = 1
|
||||
while i <= #result do
|
||||
-- find first capture that is not in current range and apply highlights on the way
|
||||
local j = i + 1
|
||||
while j <= #result and result[j].range[1] >= result[i].range[1] and result[j].range[2] <= result[i].range[2] do
|
||||
for k, v in ipairs(result[i][2]) do
|
||||
if not vim.tbl_contains(result[j][2], v) then
|
||||
table.insert(result[j][2], k, v)
|
||||
end
|
||||
end
|
||||
j = j + 1
|
||||
end
|
||||
|
||||
-- remove the parent capture if it is split into children
|
||||
if j > i + 1 then
|
||||
table.remove(result, i)
|
||||
else
|
||||
-- highlights need to be sorted by priority, on equal prio, the deeper nested capture (earlier
|
||||
-- in list) should be considered higher prio
|
||||
if #result[i][2] > 1 then
|
||||
table.sort(result[i][2], function(a, b)
|
||||
return a[2] < b[2]
|
||||
end)
|
||||
end
|
||||
|
||||
result[i][2] = vim.tbl_map(function(tbl)
|
||||
return tbl[1]
|
||||
end, result[i][2])
|
||||
result[i] = { result[i][1], result[i][2] }
|
||||
|
||||
i = i + 1
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
function HighlightedFoldtext()
|
||||
local result = parse_line(vim.v.foldstart)
|
||||
if not result then
|
||||
return vim.fn.foldtext()
|
||||
end
|
||||
|
||||
local folded = {
|
||||
{ " ", "FoldedIcon" },
|
||||
{ "+" .. vim.v.foldend - vim.v.foldstart .. " lines", "FoldedText" },
|
||||
{ " ", "FoldedIcon" },
|
||||
}
|
||||
|
||||
for _, item in ipairs(folded) do
|
||||
table.insert(result, item)
|
||||
end
|
||||
|
||||
local result2 = parse_line(vim.v.foldend)
|
||||
if result2 and #result2 > 0 then
|
||||
local first = result2[1]
|
||||
result2[1] = { vim.trim(first[1]), first[2] }
|
||||
for _, item in ipairs(result2) do
|
||||
table.insert(result, item)
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local function set_fold_hl()
|
||||
local nf = vim.api.nvim_get_hl(0, { name = "NormalFloat", link = false })
|
||||
local comment = vim.api.nvim_get_hl(0, { name = "Comment", link = false })
|
||||
vim.api.nvim_set_hl(0, "FoldedIcon", { fg = nf.bg })
|
||||
vim.api.nvim_set_hl(0, "FoldedText", { bg = nf.bg, fg = comment.fg, italic = true })
|
||||
end
|
||||
|
||||
set_fold_hl()
|
||||
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
callback = set_fold_hl,
|
||||
})
|
||||
|
||||
return 'luaeval("HighlightedFoldtext")()'
|
||||
|
|
@ -48,10 +48,12 @@ o.splitbelow = true
|
|||
o.inccommand = "split"
|
||||
|
||||
-- folding
|
||||
o.foldmethod = "indent"
|
||||
o.foldmethod = "expr"
|
||||
o.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
o.foldtext = require("nvwynd.modules.foldtext")
|
||||
o.foldnestmax = 10
|
||||
o.foldenable = true
|
||||
o.foldlevel = 5
|
||||
o.foldlevel = 99
|
||||
g.markdown_folding = 1
|
||||
|
||||
-- tab size
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ return {
|
|||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
pattern = { "neo-tree*" },
|
||||
callback = function()
|
||||
-- prevents the list scrolling when clicking on bottom/top elements due to scrolloff
|
||||
vim.wo[0][0].scrolloff = 0
|
||||
|
||||
local filetype = vim.filetype.match({ buf = 0 })
|
||||
if filetype == nil then
|
||||
vim.cmd("stopinsert")
|
||||
|
|
@ -52,6 +55,7 @@ return {
|
|||
filesystem = {
|
||||
follow_current_file = { enabled = true },
|
||||
use_libuv_file_watcher = true,
|
||||
group_empty_dirs = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ return {
|
|||
cmd = { "ConformInfo" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>fc",
|
||||
-- "<leader>fc",
|
||||
"<C-f>",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_fallback = true })
|
||||
end,
|
||||
|
|
@ -39,6 +40,13 @@ return {
|
|||
},
|
||||
init = function()
|
||||
vim.o.formatexpr = "v:lua.require('conform').formatexpr()"
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "java",
|
||||
callback = function()
|
||||
vim.b.disable_autoformat = true
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ return {
|
|||
vim.lsp.enable("pyright")
|
||||
|
||||
-- Rust
|
||||
vim.lsp.enable("rust_analyzer")
|
||||
vim.lsp.config("rust_analyzer", {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
|
|
@ -28,9 +27,9 @@ return {
|
|||
},
|
||||
procMacro = {
|
||||
enable = true,
|
||||
ignored = "*",
|
||||
},
|
||||
checkOnSave = {
|
||||
checkOnSave = true,
|
||||
check = {
|
||||
command = "clippy",
|
||||
},
|
||||
hover = {
|
||||
|
|
@ -46,6 +45,44 @@ return {
|
|||
},
|
||||
},
|
||||
})
|
||||
vim.lsp.enable("rust_analyzer")
|
||||
|
||||
-- Java
|
||||
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ":p:h:t")
|
||||
local workspace_dir = vim.fn.stdpath("data")
|
||||
.. package.config:sub(1, 1)
|
||||
.. "jdtls-workspace"
|
||||
.. package.config:sub(1, 1)
|
||||
.. project_name
|
||||
|
||||
vim.lsp.config("jdtls", {
|
||||
cmd = {
|
||||
"jdtls",
|
||||
"-data",
|
||||
workspace_dir,
|
||||
},
|
||||
|
||||
root_dir = vim.fs.root(0, { "gradlew", ".git", "mvnw" }),
|
||||
|
||||
settings = {
|
||||
java = {
|
||||
format = {
|
||||
enable = false,
|
||||
settings = {
|
||||
-- wget -O ~/.local/share/google-style.xml https://google.github.io/styleguide/eclipse-java-google-style.xml
|
||||
-- could also set thee url directly but local ftw
|
||||
url = "~/.local/share/google-style.xml",
|
||||
profile = "GoogleStyle",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
init_options = {
|
||||
bundles = {},
|
||||
},
|
||||
})
|
||||
vim.lsp.enable("jdtls")
|
||||
|
||||
-- C
|
||||
vim.lsp.enable("clangd")
|
||||
|
|
@ -55,7 +92,6 @@ return {
|
|||
table.insert(lua_rtp, "lua/?.lua")
|
||||
table.insert(lua_rtp, "lua/?/init.lua")
|
||||
|
||||
vim.lsp.enable("lua_ls")
|
||||
vim.lsp.config("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
|
|
@ -75,6 +111,7 @@ return {
|
|||
},
|
||||
},
|
||||
})
|
||||
vim.lsp.enable("lua_ls")
|
||||
|
||||
-- Zig
|
||||
-- vim.lsp.enable("zls")
|
||||
|
|
@ -92,16 +129,16 @@ return {
|
|||
vim.lsp.enable("bashls")
|
||||
|
||||
-- HTML
|
||||
vim.lsp.enable("html")
|
||||
vim.lsp.config("html", {
|
||||
filetypes = { "html", "templ", "htmldjango", "handlebars" },
|
||||
})
|
||||
vim.lsp.enable("html")
|
||||
|
||||
-- HTMX
|
||||
vim.lsp.enable("htmx")
|
||||
vim.lsp.config("htmx", {
|
||||
filetypes = { "html", "templ", "htmldjango" },
|
||||
})
|
||||
vim.lsp.enable("htmx")
|
||||
|
||||
-- CSS
|
||||
vim.lsp.enable("cssls")
|
||||
|
|
@ -170,4 +207,6 @@ return {
|
|||
},
|
||||
opts = {},
|
||||
},
|
||||
|
||||
{ "mfussenegger/nvim-jdtls" },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,20 +63,60 @@ return {
|
|||
"desktop",
|
||||
})
|
||||
|
||||
local function close_import_fold()
|
||||
-- see if there's a parser associated with the current buffer
|
||||
local ok, parser = pcall(vim.treesitter.get_parser, 0)
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
local import_nodes = {
|
||||
rust = "use_declaration",
|
||||
java = "import_declaration",
|
||||
}
|
||||
|
||||
local ft = vim.bo.filetype
|
||||
|
||||
-- check the language of the buffer and the TS node associated with the import section
|
||||
local target = import_nodes[ft]
|
||||
if not target then
|
||||
return
|
||||
end
|
||||
|
||||
local tree = parser:parse()[1]
|
||||
local root = tree:root()
|
||||
|
||||
-- parse all the nodes until finding the import nodes
|
||||
for node in root:iter_children() do
|
||||
if node:type() == target then
|
||||
local start_row, _, _, _ = node:range()
|
||||
|
||||
-- close the fold starting with the first line of the chunk
|
||||
-- the function usage is to avoid some annoying warning because vim.cmd is seen as a table and pcall takes a function
|
||||
local _, _ = pcall(function()
|
||||
vim.cmd(start_row + 1 .. "foldclose")
|
||||
end)
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Prize for most retarded upgrade goes to....
|
||||
-- Auto enable TS if language is installed because it can't do that by myself anymore
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function(args)
|
||||
-- highlighting
|
||||
if vim.list_contains(ts.get_installed(), vim.treesitter.language.get_lang(args.match)) then
|
||||
vim.treesitter.start(args.buf)
|
||||
end
|
||||
|
||||
-- indentation
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
|
||||
close_import_fold()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.wo[0][0].foldmethod = "expr"
|
||||
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,8 +98,18 @@ return {
|
|||
-- {
|
||||
-- "3rd/image.nvim",
|
||||
-- event = "VeryLazy",
|
||||
-- build = false,
|
||||
-- opts = {
|
||||
-- backend = "ueberzug",
|
||||
-- integrations = {
|
||||
-- markdown = {
|
||||
-- enabled = true,
|
||||
-- clear_in_insert_mode = false,
|
||||
-- download_remote_images = true,
|
||||
-- only_render_image_at_cursor = true,
|
||||
-- filetypes = { "markdown" },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,13 +120,16 @@ alias gd='git diff'
|
|||
alias gdc="git diff --cached"
|
||||
alias glg="git log --graph --pretty='%Cred%h%Creset %C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
|
||||
alias glo="git log --pretty='format:%C(yellow)%as %C(blue)%cn %C(green)%h %C(reset)%s' --no-merges"
|
||||
alias gld="git log --pretty='format:%C(yellow)%as %C(blue)%cn %C(green)%h %C(reset)%s' --no-merges HEAD"
|
||||
alias glm="git_last_modified"
|
||||
|
||||
# takes the number of days back to get changes (5 by default)
|
||||
function git_last_modified() {(
|
||||
days=${1:-5}
|
||||
git diff $(git log -1 --before=@{$days.days.ago} --format=%H) --stat
|
||||
)}
|
||||
|
||||
# takes a date as param such as: 2025-01-01
|
||||
function days_since() {(
|
||||
now=$(date --date="now" +%s)
|
||||
input=$(date --date=$1 +%s)
|
||||
|
|
@ -140,6 +143,7 @@ alias repos5y="~/.local/bin/scripts/repos5y.sh"
|
|||
alias repoc5y="~/.local/bin/scripts/repoc5y.sh"
|
||||
|
||||
export PATH="/home/wynd/.local/bin/scripts:$PATH"
|
||||
export PATH="/home/wynd/.local/lib/jdt-language-server-1.54.0-202511200503/bin:$PATH"
|
||||
|
||||
# private SSH stuff
|
||||
source ~/.piwrc
|
||||
|
|
|
|||
Loading…
Reference in New Issue