diff --git a/lazy-lock.json b/lazy-lock.json index 4b036d4..7f5e309 100755 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -27,7 +27,7 @@ "headlines.nvim": { "branch": "master", "commit": "618ef1b2502c565c82254ef7d5b04402194d9ce3" }, "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, "kiwi.nvim": { "branch": "master", "commit": "1a625771e3d3d9f50ca28a4501c11842f6c1ec1e" }, - "lazy.nvim": { "branch": "main", "commit": "b0ba3f9399bf48c86abaa4db1a40bd0b681d5018" }, + "lazy.nvim": { "branch": "main", "commit": "70f2c090d3ffb14f8702d468e05beb240b768881" }, "llm.nvim": { "branch": "main", "commit": "6a90755cfabb56ab99c919b1323e26b5c429f6fb" }, "lsp_signature.nvim": { "branch": "master", "commit": "e92b4e7073345b2a30a56b20db3d541a9aa2771e" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, @@ -52,11 +52,11 @@ "nvim-jdtls": { "branch": "master", "commit": "a5c6f38f8151d7b4f5b32c005a95022fa66f4c9d" }, "nvim-lightbulb": { "branch": "master", "commit": "02aacd93b9b2367e6dbdd20f43b525f701faf834" }, "nvim-lint": { "branch": "master", "commit": "1a3a8d047bc01f1760ae4a0f5e80f111ea222e67" }, - "nvim-lspconfig": { "branch": "master", "commit": "d1ab6b6051976b04948e127b0f302a465b1394d6" }, + "nvim-lspconfig": { "branch": "master", "commit": "92166b89ab4b3d60f24e58170cac53b7141fd032" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, "nvim-scrollbar": { "branch": "main", "commit": "d09f14aa16c9f2748e77008f9da7b1f76e4e7b85" }, - "nvim-treesitter": { "branch": "master", "commit": "49e4e2b4b62360677568c47b6467f31c809b391c" }, + "nvim-treesitter": { "branch": "master", "commit": "3a74b5831058d0daf8952a5b8c556c61b30a3f46" }, "nvim-treesitter-context": { "branch": "master", "commit": "5efba33af0f39942e426340da7bc15d7dec16474" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, "nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" }, @@ -71,11 +71,11 @@ "telescope.nvim": { "branch": "master", "commit": "dfa230be84a044e7f546a6c2b0a403c739732b86" }, "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, "toggleterm.nvim": { "branch": "main", "commit": "066cccf48a43553a80a210eb3be89a15d789d6e6" }, - "trouble.nvim": { "branch": "main", "commit": "46a19388d3507f4c4bebb9994bf821a79b3bc342" }, + "trouble.nvim": { "branch": "main", "commit": "7a9c235806d4d9e2e74889f7e359f183a6d0e20d" }, "venv-selector.nvim": { "branch": "main", "commit": "9b1bfe5aea225853e14358f504c656d4af007035" }, "vim-bbye": { "branch": "master", "commit": "903f5eb17f72ebf7b0b1524bbb792c0b36761af6" }, "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, "vim-visual-multi": { "branch": "master", "commit": "1c9207b28c8898ab01b54e6d6b61b0b820a814bc" }, - "which-key.nvim": { "branch": "main", "commit": "4b7167f8fb2dba3d01980735e3509e172c024c29" }, + "which-key.nvim": { "branch": "main", "commit": "0539da005b98b02cf730c1d9da82b8e8edb1c2d2" }, "windows.nvim": { "branch": "main", "commit": "c7492552b23d0ab30325e90b56066ec51242adc8" } } \ No newline at end of file diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index d613453..eb0241f 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -97,15 +97,6 @@ vim.api.nvim_create_autocmd({ "FileType" }, { end, }) -vim.api.nvim_create_autocmd({ "TermOpen" }, { - pattern = { "*" }, - callback = function() - vim.opt_local["number"] = false - vim.opt_local["signcolumn"] = "no" - vim.opt_local["foldcolumn"] = "0" - end, -}) - -- ───────────────────────────────────────────────────────────────── -- fix comment on new line vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { diff --git a/lua/features/lsp/lang/python.lua b/lua/features/lsp/lang/python.lua index 98528ab..9d268cf 100755 --- a/lua/features/lsp/lang/python.lua +++ b/lua/features/lsp/lang/python.lua @@ -1,93 +1,85 @@ ---return { --- { --- "williamboman/mason.nvim", --- opts = function(_, opts) --- table.insert(opts.ensure_installed, "black") --- end, --- }, --- --- { --- "nvim-treesitter/nvim-treesitter", --- opts = function(_, opts) --- if type(opts.ensure_installed) == "table" then --- vim.list_extend(opts.ensure_installed, { "ninja", "python", "rst", "toml" }) --- end --- end, --- }, --- --- { --- "neovim/nvim-lspconfig", --- opts = { --- servers = { --- pyright = { --- keys = { --- { "lo", "PyrightOrganizeImports", desc = "Organize Imports" }, --- }, --- -- disable hint of pyright --- capabilities = (function() --- local capabilities = vim.lsp.protocol.make_client_capabilities() --- capabilities.textDocument.publishDiagnostics.tagSupport.valueSet = { 2 } --- return capabilities --- end)(), --- settings = { --- python = { --- analysis = { --- indexing = true, --- typeCheckingMode = "basic", --- diagnosticMode = "openFilesOnly", --- autoImportCompletions = true, --- autoSearchPaths = true, --- inlayHints = { --- variableTypes = true, --- functionReturnTypes = true, --- }, --- useLibraryCodeForTypes = true, --- diagnosticSeverityOverrides = { --- reportGeneralTypeIssues = "none", --- reportOptionalMemberAccess = "none", --- reportOptionalSubscript = "none", --- reportPrivateImportUsage = "none", --- }, --- }, --- }, --- }, --- }, --- }, --- attach_handlers = { --- pyright = function(client, _) --- local sc = client.server_capabilities --- sc.renameProvider = false -- rope is ok --- sc.hoverProvider = false -- pylsp includes also docstrings --- sc.signatureHelpProvider = false -- pyright typing of signature is weird --- sc.definitionProvider = true -- pyright does not follow imports correctly --- sc.referencesProvider = true -- pylsp does it --- sc.completionProvider = { --- resolveProvider = true, --- triggerCharacters = { "." }, --- } --- end, --- }, --- }, --- }, --- --- { --- "stevearc/conform.nvim", --- opts = { --- formatters_by_ft = { --- ["python"] = { "black" }, --- }, --- }, --- }, ---} return { + -- + -- { + -- "nvim-treesitter/nvim-treesitter", + -- opts = function(_, opts) + -- if type(opts.ensure_installed) == "table" then + -- vim.list_extend(opts.ensure_installed, { "ninja", "python", "rst", "toml" }) + -- end + -- end, + -- }, + -- + -- { + -- "neovim/nvim-lspconfig", + -- opts = { + -- servers = { + -- pyright = { + -- keys = { + -- { "lo", "PyrightOrganizeImports", desc = "Organize Imports" }, + -- }, + -- -- disable hint of pyright + -- capabilities = (function() + -- local capabilities = vim.lsp.protocol.make_client_capabilities() + -- capabilities.textDocument.publishDiagnostics.tagSupport.valueSet = { 2 } + -- return capabilities + -- end)(), + -- settings = { + -- python = { + -- analysis = { + -- indexing = true, + -- typeCheckingMode = "basic", + -- diagnosticMode = "openFilesOnly", + -- autoImportCompletions = true, + -- autoSearchPaths = true, + -- inlayHints = { + -- variableTypes = true, + -- functionReturnTypes = true, + -- }, + -- useLibraryCodeForTypes = true, + -- diagnosticSeverityOverrides = { + -- reportGeneralTypeIssues = "none", + -- reportOptionalMemberAccess = "none", + -- reportOptionalSubscript = "none", + -- reportPrivateImportUsage = "none", + -- }, + -- }, + -- }, + -- }, + -- }, + -- }, + -- attach_handlers = { + -- pyright = function(client, _) + -- local sc = client.server_capabilities + -- sc.renameProvider = false -- rope is ok + -- sc.hoverProvider = false -- pylsp includes also docstrings + -- sc.signatureHelpProvider = false -- pyright typing of signature is weird + -- sc.definitionProvider = true -- pyright does not follow imports correctly + -- sc.referencesProvider = true -- pylsp does it + -- sc.completionProvider = { + -- resolveProvider = true, + -- triggerCharacters = { "." }, + -- } + -- end, + -- }, + -- }, + -- }, + -- + -- { + -- "stevearc/conform.nvim", + -- opts = { + -- formatters_by_ft = { + -- ["python"] = { "black" }, + -- }, + -- }, + -- }, + --} -- Add `pyright` to mason { "williamboman/mason.nvim", opts = function(_, opts) - -- vim.list_extend(opts.ensure_installed, { "pyright", "black", "ruff-lsp", "ruff" }) vim.list_extend(opts.ensure_installed, { "black", - "ruff", + "pyright", }) end, }, @@ -156,11 +148,6 @@ return { { "lo", "PyrightOrganizeImports", desc = "Organize Imports" }, }, }, - ruff_lsp = { - -- handlers = { - -- ["textDocument/publishDiagnostics"] = function() end, - -- }, - }, jedi_language_server = {}, }, setup = { @@ -190,7 +177,7 @@ return { optional = true, opts = { formatters_by_ft = { - ["python"] = { { "black", "ruff" } }, + ["python"] = { { "black" } }, }, }, }, @@ -202,10 +189,7 @@ return { local nls = require("null-ls") opts.sources = vim.list_extend(opts.sources, { -- Order of formatters matters. They are used in order of appearance. - nls.builtins.formatting.ruff, nls.builtins.formatting.black, - - nls.builtins.diagnostics.ruff, }) end, }, diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 7ecfc89..a0329ed 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -287,7 +287,7 @@ return { }, current_line_blame_formatter = ", - ", preview_config = { - border = Utils.telescope.borderchars("thick", "tl-t-tr-r-br-b-bl-l"), -- [ top top top - right - bottom bottom bottom - left ] + border = Utils.ui.borderchars("thick", "tl-t-tr-r-br-b-bl-l"), -- [ top top top - right - bottom bottom bottom - left ] }, on_attach = function(bufnr) local gs = package.loaded.gitsigns @@ -350,9 +350,9 @@ return { prompt_prefix = "  ", selection_caret = "  ", entry_prefix = " ", - borderchars = is_telescope_bg_clear and Utils.telescope.borderchars("rounded") + borderchars = is_telescope_bg_clear and Utils.ui.borderchars("rounded") or { - prompt = Utils.telescope.borderchars("thick", nil, { + prompt = Utils.ui.borderchars("thick", nil, { top = "▄", top_left = "▄", left = "█", @@ -360,12 +360,12 @@ return { top_right = " ", bottom_right = " ", }), - results = Utils.telescope.borderchars( + results = Utils.ui.borderchars( "thick", nil, { top = "█", top_left = "█", right = " ", top_right = " ", bottom_right = " " } ), - preview = Utils.telescope.borderchars("thick", nil, { top = "▄", top_left = "▄", top_right = "▄" }), + preview = Utils.ui.borderchars("thick", nil, { top = "▄", top_left = "▄", top_right = "▄" }), }, dynamic_preview_title = true, hl_result_eol = true, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index ecaabba..87b92ca 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -239,7 +239,6 @@ return { "yaml", }, }), - formatting.markdown_toc, -- use `` before headers in your markdown file.` completion.luasnip, completion.tags, formatting.rubyfmt, @@ -251,7 +250,6 @@ return { diagnostics.deadnix, diagnostics.statix, diagnostics.todo_comments, - diagnostics.tsc, diagnostics.zsh, formatting.terraform_fmt, formatting.black, @@ -260,14 +258,10 @@ return { code_actions.ts_node_action, formatting.goimports, formatting.gofumpt, - code_actions.shellcheck, code_actions.refactoring.with({ filetypes = { "go", "javascript", "lua", "python", "typescript" }, }), formatting.alejandra, - formatting.fixjson, - formatting.trim_newlines, - formatting.trim_whitespace, code_actions.gitsigns, formatting.shfmt, formatting.leptosfmt, diff --git a/lua/utils/init.lua b/lua/utils/init.lua index d122059..57cf7a1 100644 --- a/lua/utils/init.lua +++ b/lua/utils/init.lua @@ -1,15 +1,5 @@ local Profile = require("profile") ----@class Util ----@field root utils.root ----@field telescope utils.telescope ----@field theme utils.theme ----@field plugin utils.plugin ----@field lualine utils.lualine ----@field cmd utils.cmd ----@field lsp utils.lsp ----@field string utils.string ----@field table utils.table local M = {} setmetatable(M, { diff --git a/lua/utils/lsp.lua b/lua/utils/lsp.lua index 3c1dfe2..ba1fe59 100644 --- a/lua/utils/lsp.lua +++ b/lua/utils/lsp.lua @@ -12,4 +12,17 @@ function M.on_attach(on_attach) }) end +function M.on_support_methods(method, fn) + return vim.api.nvim_create_autocmd("User", { + pattern = "LspSupportsMethod", + callback = function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + local buffer = args.data.buffer ---@type number + if client and method == args.data.method then + return fn(client, buffer) + end + end, + }) +end + return M diff --git a/lua/utils/ui.lua b/lua/utils/ui.lua new file mode 100644 index 0000000..c82f34a --- /dev/null +++ b/lua/utils/ui.lua @@ -0,0 +1,55 @@ +local Utils = require("utils") +local Icons = require("core.icons") + +local M = {} + +function M.borderchars(style, order, opts) + order = order or "t-r-b-l-tl-tr-br-bl" + local border_icons = Icons.borders + local border = vim.tbl_deep_extend("force", border_icons[style or "empty"], opts or {}) + + local borderchars = {} + + local extract_directions = (function() + local index = 1 + return function() + if index == nil then + return nil + end + -- Find the next occurence of `char` + local nextIndex = string.find(order, "-", index) + -- Extract the first direction + local direction = string.sub(order, index, nextIndex and nextIndex - 1) + -- Update the index to nextIndex + index = nextIndex and nextIndex + 1 or nil + return direction + end + end)() + + local mappings = { + t = "top", + r = "right", + b = "bottom", + l = "left", + tl = "top_left", + tr = "top_right", + br = "bottom_right", + bl = "bottom_left", + } + local direction = extract_directions() + while direction do + if mappings[direction] == nil then + Utils.notify(string.format("Invalid direction '%s'", direction), "ERROR") + end + borderchars[#borderchars + 1] = border[mappings[direction]] + direction = extract_directions() + end + + if #borderchars ~= 8 then + Utils.notify(string.format("Invalid order '%s'", order), "ERROR") + end + + return borderchars +end + +return M