diff options
| author | Elvis Claros Castro <elvis@claros.ar> | 2024-10-03 11:41:10 -0300 |
|---|---|---|
| committer | Elvis Claros Castro <elvis@claros.ar> | 2024-10-03 11:41:10 -0300 |
| commit | f032fb9e2fadaaec6f71aaf45ed1d94128ea45cd (patch) | |
| tree | 17bc2e9fe0a3614285b59c75ae801021d31e76df /lua/config | |
| parent | fa3e94e60b9edc7c3620f43e207b915eae84bab0 (diff) | |
| download | nvim-conf-f032fb9e2fadaaec6f71aaf45ed1d94128ea45cd.tar.gz nvim-conf-f032fb9e2fadaaec6f71aaf45ed1d94128ea45cd.zip | |
feat: add rust tools
Diffstat (limited to 'lua/config')
| -rw-r--r-- | lua/config/diagnostic.lua | 58 | ||||
| -rw-r--r-- | lua/config/keymaps.lua | 28 | ||||
| -rw-r--r-- | lua/config/lazy.lua | 178 |
3 files changed, 218 insertions, 46 deletions
diff --git a/lua/config/diagnostic.lua b/lua/config/diagnostic.lua index 84d57b5..011d83a 100644 --- a/lua/config/diagnostic.lua +++ b/lua/config/diagnostic.lua @@ -1,28 +1,50 @@ - vim.diagnostic.config { virtual_text = false, signs = { text = { [vim.diagnostic.severity.ERROR] = '', [vim.diagnostic.severity.WARN] = '', - [vim.diagnostic.severity.INFO] = '', - [vim.diagnostic.severity.HINT] = '', - }, - linehl = { - [vim.diagnostic.severity.ERROR] = 'ErrorMsg', - }, - numhl = { - [vim.diagnostic.severity.WARN] = 'WarningMsg', + [vim.diagnostic.severity.INFO] = '', + [vim.diagnostic.severity.HINT] = '' }, + -- linehl = { + -- [vim.diagnostic.severity.ERROR] = 'ErrorMsg', + -- }, + -- numhl = { + -- [vim.diagnostic.severity.WARN] = 'WarningMsg', + -- }, + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + -- focusable = true, + -- style = "minimal", + border = "rounded", + source = "if_many", + -- header = "", + -- prefix = "", }, } --- vim.diagnostic.config { --- virtual_text = false, --- } --- --- local signs = { Error = "", Warn = "", Hint = "", Info = "" } --- for type, icon in pairs(signs) do --- local hl = "DiagnosticSign" .. type --- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) --- end +-- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { +-- border = "rounded", +-- -- width = 100, +-- -- height = 10, +-- position = "center", +-- header = "", +-- prefix = "", +-- source = "always", +-- style = "minimal", +-- focusable = true, +-- }) + +-- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { +-- border = "rounded", +-- }) + +vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + -- delay update diagnostics + update_in_insert = false, +}) + diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 73478de..6002563 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -69,8 +69,6 @@ map( { desc = "Save the current file and source it for .vim and .lua files" } ) --- map("n", "<leader>vn", vim.diagnostic.goto_next, { desc = "Goes to next diagnostic error" }) --- map("n", "<leader>vp", vim.diagnostic.goto_prev, { desc = "Goes to prev diagnostic error" }) map( "n", "<leader>vn", @@ -129,24 +127,6 @@ map( function() require('nvim-python-repl').toggle_vertical() end, { desc = "Create REPL in vertical or horizontal split"} ) --- map( --- "n", --- "<leader>rl", --- function() require('rust-tools').inlay_hints.enable() end, --- {desc = "Enable inlay hints auto update and set them for all the buffers"} --- ) --- map( --- "n", --- "<leader>rdl", --- function() require('rust-tools').inlay_hints.disable() end, --- {desc = "Disable inlay hints auto update and unset them for all buffers"} --- ) --- map( --- "n", --- "<leader>rrn", --- function () require('rust-tools').runnables.runnables() end, --- {desc = "run rust"} --- ) map( "n", "-", @@ -167,3 +147,11 @@ vim.api.nvim_set_keymap( ':lua ToggleWrap()<CR>', { noremap = true, silent = true } ) +vim.keymap.set +( + "n", + "<leader>rrn", + ':RustLsp runnables<CR>', + {desc = "run rust"} +) + diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 81584d1..70aaec7 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -12,23 +12,160 @@ end vim.opt.rtp:prepend(lazypath) require("lazy").setup { - spec = { - { import = "plugins" }, + -- leave nil when passing the spec as the first argument to setup() + spec = { { import = "plugins" } }, + local_spec = true, -- load project specific .lazy.lua spec files. They will be added at the end of the spec. + defaults = { + -- Set this to `true` to have all your plugins lazy-loaded by default. + -- Only do this if you know what you are doing, as it can lead to unexpected behavior. + lazy = false, -- should plugins be lazy-loaded? + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = nil, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + -- default `cond` you can use to globally disable a lot of plugins + -- when running inside vscode for example + cond = nil, ---@type boolean|fun(self:LazyPlugin):boolean|nil }, - default = { - lazy = true, + lockfile = vim.fn.stdpath("config") .. "/lazy-lock.json", -- lockfile generated after running update. + ---@type number? limit the maximum amount of concurrent tasks + concurrency = jit.os:find("Windows") and (vim.uv.available_parallelism() * 2) or nil, + git = { + -- defaults for the `Lazy log` command + -- log = { "--since=3 days ago" }, -- show commits from the last 3 days + log = { "-8" }, -- show the last 8 commits + timeout = 120, -- kill processes that take more than 2 minutes + url_format = "https://github.com/%s.git", + -- lazy.nvim requires git >=2.19.0. If you really want to use lazy with an older version, + -- then set the below to false. This should work, but is NOT supported and will + -- increase downloads a lot. + filter = true, + }, + pkg = { + enabled = true, + cache = vim.fn.stdpath("state") .. "/lazy/pkg-cache.lua", + versions = true, -- Honor versions in pkg sources + -- the first package source that is found for a plugin will be used. + sources = { + "lazy", + "rockspec", + "packspec", + }, + }, + rocks = { + root = vim.fn.stdpath("data") .. "/lazy-rocks", + server = "https://nvim-neorocks.github.io/rocks-binaries/", }, - checker = { enabled = true, notify = false }, dev = { - path = "~/code/plugins", - fallback = true, - patterns = { "adalessa" }, + ---@type string | fun(plugin: LazyPlugin): string directory where you store your local plugin projects + path = "~/MIS-REPOS/neovim-plugins", + ---@type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub + patterns = {"elvis"}, -- For example {"folke"} + fallback = false, -- Fallback to git when local plugin doesn't exist + }, + install = { + -- install missing plugins on startup. This doesn't increase startup time. + missing = true, + -- try to load one of these colorschemes when starting an installation during startup + colorscheme = { "habamax" }, }, ui = { + -- a number <1 is a percentage., >1 is a fixed size + -- size = { width = 0.8, height = 0.8 }, + -- wrap = true, -- wrap the lines in the ui + -- The border to use for the UI window. Accepts same border values as |nvim_open_win()|. border = "rounded", + -- The backdrop opacity. 0 is fully opaque, 100 is fully transparent. + backdrop = 60, + title = nil, ---@type string only works when border is not "none" + title_pos = "center", ---@type "center" | "left" | "right" + -- Show pills on top of the Lazy window + pills = true, ---@type boolean + icons = { + cmd = " ", + config = "", + event = " ", + favorite = " ", + ft = " ", + init = " ", + import = " ", + keys = " ", + lazy = " ", + loaded = "●", + not_loaded = "○", + plugin = " ", + runtime = " ", + require = " ", + source = " ", + start = " ", + task = "✔ ", + list = { + "●", + "➜", + "★", + "‒", + }, + }, + -- leave nil, to automatically select a browser depending on your OS. + -- If you want to use a specific browser, you can define it here + browser = nil, ---@type string? + throttle = 20, -- how frequently should the ui process render events + custom_keys = { + -- You can define custom key maps here. If present, the description will + -- be shown in the help menu. + -- To disable one of the defaults, set it to false. + + ["<localleader>l"] = { + function(plugin) + require("lazy.util").float_term({ "lazygit", "log" }, { + cwd = plugin.dir, + }) + end, + desc = "Open lazygit log", + }, + + ["<localleader>t"] = { + function(plugin) + require("lazy.util").float_term(nil, { + cwd = plugin.dir, + }) + end, + desc = "Open terminal in plugin dir", + }, + }, + }, + diff = { + -- diff command <d> can be one of: + -- * browser: opens the github compare view. Note that this is always mapped to <K> as well, + -- so you can have a different command for diff <d> + -- * git: will run git diff and open a buffer with filetype git + -- * terminal_git: will open a pseudo terminal with git diff + -- * diffview.nvim: will open Diffview to show the diff + cmd = "git", + }, + checker = { + -- automatically check for plugin updates + enabled = true, + concurrency = nil, ---@type number? set to 1 to check for updates very slowly + notify = false, -- get a notification when new updates are found + frequency = 3600, -- check for updates every hour + check_pinned = false, -- check for pinned packages that can't be updated + }, + change_detection = { + -- automatically check for config file changes and reload the ui + enabled = true, + notify = true, -- get a notification when changes are found }, performance = { + cache = { + enabled = true, + }, + reset_packpath = true, -- reset the package path to improve startup time rtp = { + reset = true, -- reset the runtime path to $VIMRUNTIME and your config directory + ---@type string[] + paths = {}, -- add any custom paths here that you want to includes in the rtp + ---@type string[] list any plugins you want to disable here disabled_plugins = { "gzip", "matchit", @@ -41,4 +178,29 @@ require("lazy").setup { }, }, }, + -- lazy can generate helptags from the headings in markdown readme files, + -- so :help works even for plugins that don't have vim docs. + -- when the readme opens with :help it will be correctly displayed as markdown + readme = { + enabled = true, + root = vim.fn.stdpath("state") .. "/lazy/readme", + files = { "README.md", "lua/**/README.md" }, + -- only generate markdown helptags for plugins that dont have docs + skip_if_doc_exists = true, + }, + state = vim.fn.stdpath("state") .. "/lazy/state.json", -- state info for checker and other things + -- Enable profiling of lazy.nvim. This will add some overhead, + -- so only enable this when you are debugging lazy.nvim + profiling = { + -- Enables extra stats on the debug tab related to the loader cache. + -- Additionally gathers stats about all package.loaders + loader = false, + -- Track each new require in the Lazy profiling tab + require = false, + }, } + + + + + |