diff --git a/lazy-lock.json b/lazy-lock.json index dc17480..fa4298c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -11,6 +11,7 @@ "nord.nvim": { "branch": "main", "commit": "1ee184dfd06ffadc19b7afc0ba4c5eca92dd836e" }, "nui.nvim": { "branch": "main", "commit": "8d5b0b568517935d3c84f257f272ef004d9f5a59" }, "nvim-lspconfig": { "branch": "master", "commit": "88d0824d85c0f74a012521d25678a5b01c76feb1" }, + "nvim-notify": { "branch": "master", "commit": "b5825cf9ee881dd8e43309c93374ed5b87b7a896" }, "nvim-treesitter": { "branch": "master", "commit": "3b308861a8d7d7bfbe9be51d52e54dcfd9fe3d38" }, "nvim-web-devicons": { "branch": "master", "commit": "50b5b06bff13a9b4eab946de7c7033649a6618a1" }, "rustaceanvim": { "branch": "master", "commit": "3a6af933d5870a419ee2be6e1bd397dfe46c96d2" }, diff --git a/lua/config/keys.lua b/lua/config/keys.lua index 56caa4e..4b9c27c 100644 --- a/lua/config/keys.lua +++ b/lua/config/keys.lua @@ -1,79 +1,79 @@ require("which-key").add({ - { "b", group = "buffer" }, - { "bd", ":bd", name = "delete current" }, + { "b", group = "buffer" }, + { "bd", ":bd", name = "delete current" }, - { "c", group = "code" }, - { "ca", vim.lsp.buf.code_action, name = "code action" }, - { "cd", vim.diagnostic.open_float, name = "diagnostic" }, - { "cr", vim.lsp.buf.rename, name = "rename" }, + { "c", group = "code" }, + { "ca", vim.lsp.buf.code_action, name = "code action" }, + { "cd", vim.diagnostic.open_float, name = "diagnostic" }, + { "cr", vim.lsp.buf.rename, name = "rename" }, - { "e", Snacks.explorer.open, name = "explorer" }, + { "e", Snacks.explorer.open, name = "explorer" }, - { "f", group = "find" }, - { "fb", Snacks.picker.buffers, name = "buffers" }, - { "ff", Snacks.picker.files, name = "files" }, - { "fg", Snacks.picker.grep, name = "grep" }, + { "f", group = "find" }, + { "fb", Snacks.picker.buffers, name = "buffers" }, + { "ff", Snacks.picker.files, name = "files" }, + { "fg", Snacks.picker.grep, name = "grep" }, - { "g", group = "git" }, - { "gb", group = "blame" }, - { "gbf", ":Gitsigns blame", name = "file" }, - { "gbh", ":Gitsigns blame_line", name = "hover" }, - { "gbl", ":Gitsigns toggle_current_line_blame", name = "virtual text" }, - { "gh", group = "hunk" }, - { "ghr", ":Gitsigns reset_hunk", name = "reset hunk" }, - { "ghp", ":Gitsigns preview_hunk", name = "preview hunk" }, + { "g", group = "git" }, + { "gb", group = "blame" }, + { "gbf", ":Gitsigns blame", name = "file" }, + { "gbh", ":Gitsigns blame_line", name = "hover" }, + { "gbl", ":Gitsigns toggle_current_line_blame", name = "virtual text" }, + { "gh", group = "hunk" }, + { "ghr", ":Gitsigns reset_hunk", name = "reset hunk" }, + { "ghp", ":Gitsigns preview_hunk", name = "preview hunk" }, - { "s", group = "search" }, - { "ss", Snacks.picker.lsp_workspace_symbols, name = "symbols" }, - { "sg", Snacks.picker.grep, name = "grep" }, + { "s", group = "search" }, + { "ss", Snacks.picker.lsp_workspace_symbols, name = "symbols" }, + { "sg", Snacks.picker.grep, name = "grep" }, - { "u", group = "ui" }, - { "ut", Snacks.picker.colorschemes, name = "colorschemes" }, - { - "ul", - function() - local ll = vim.diagnostic.config().virtual_lines - if ll == false then - ll = { current_line = true } - else - ll = false - end - vim.diagnostic.config({ virtual_lines = ll }) - end, - name = "toggle lsp lines", - }, + { "u", group = "ui" }, + { "ut", Snacks.picker.colorschemes, name = "colorschemes" }, + { + "ul", + function() + local ll = vim.diagnostic.config().virtual_lines + if ll == false then + ll = { current_line = true } + else + ll = false + end + vim.diagnostic.config({ virtual_lines = ll }) + end, + name = "toggle lsp lines", + }, - { "w", group = "window" }, - { "wh", "h", name = "left" }, - { "wj", "j", name = "down" }, - { "wk", "k", name = "right" }, - { "wl", "l", name = "up" }, - { "wq", ":q", name = "quit" }, + { "w", group = "window" }, + { "wh", "h", name = "left" }, + { "wj", "j", name = "down" }, + { "wk", "k", name = "right" }, + { "wl", "l", name = "up" }, + { "wq", ":q", name = "quit" }, - { "g", group = "goto" }, - { "gd", vim.lsp.buf.definition, name = "definition" }, - { "gr", Snacks.picker.lsp_references, nowait = true, name = "references" }, + { "g", group = "goto" }, + { "gd", vim.lsp.buf.definition, name = "definition" }, + { "gr", Snacks.picker.lsp_references, nowait = true, name = "references" }, - { "H", ":bprev", name = "previous buffer" }, - { "L", ":bnext", name = "next buffer" }, + { "H", ":bprev", name = "previous buffer" }, + { "L", ":bnext", name = "next buffer" }, - { - "[h", - function() - require("gitsigns").nav_hunk("prev") - end, - name = "Next Hunk", - }, - { - "]h", - function() - require("gitsigns").nav_hunk("next") - end, - name = "Next Hunk", - }, + { + "[h", + function() + require("gitsigns").nav_hunk("prev") + end, + name = "Next Hunk", + }, + { + "]h", + function() + require("gitsigns").nav_hunk("next") + end, + name = "Next Hunk", + }, - { "[h", function() require("gitsigns").nav_hunk("prev") end, name = "previous hunk" }, - { "]h", function() require("gitsigns").nav_hunk("next") end, name = "next hunk" }, + { "[h", function() require("gitsigns").nav_hunk("prev") end, name = "previous hunk" }, + { "]h", function() require("gitsigns").nav_hunk("next") end, name = "next hunk" }, }) Snacks.toggle.diagnostics():map("ud") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 0f45208..6222172 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -1,17 +1,17 @@ -- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end end vim.opt.rtp:prepend(lazypath) @@ -23,16 +23,16 @@ vim.g.maplocalleader = "\\" -- Setup lazy.nvim require("lazy").setup({ - spec = { - -- import your plugins - { import = "plugins" }, - }, - -- Configure any other settings here. See the documentation for more details. - -- colorscheme that will be used when installing plugins. - install = {}, - -- automatically check for plugin updates - checker = { - enabled = true, - notify = false, - }, + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = {}, + -- automatically check for plugin updates + checker = { + enabled = true, + notify = false, + }, }) diff --git a/lua/config/lsp.lua b/lua/config/lsp.lua index 64003fb..5f1a0fc 100644 --- a/lua/config/lsp.lua +++ b/lua/config/lsp.lua @@ -6,102 +6,102 @@ require("lspconfig").ruff.setup({ capabilities = capabilities }) require("lspconfig").ccls.setup({ capabilities = capabilities }) require("lspconfig").lua_ls.setup({ - on_init = function(client) - if client.workspace_folders then - local path = client.workspace_folders[1].name - if - path ~= vim.fn.stdpath("config") - and (vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc")) - then - return - end - end + on_init = function(client) + if client.workspace_folders then + local path = client.workspace_folders[1].name + if + path ~= vim.fn.stdpath("config") + and (vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc")) + then + return + end + end - client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { - runtime = { - -- Tell the language server which version of Lua you're using - -- (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - -- Make the server aware of Neovim runtime files - workspace = { - checkThirdParty = false, - library = { - vim.env.VIMRUNTIME, - }, - }, - }) - end, - settings = { - Lua = {}, - }, - capabilities = capabilities, + client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { + runtime = { + -- Tell the language server which version of Lua you're using + -- (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + -- Make the server aware of Neovim runtime files + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME, + }, + }, + }) + end, + settings = { + Lua = {}, + }, + capabilities = capabilities, }) vim.g.rustaceanvim = { - -- Plugin configuration - -- tools = { - -- }, - -- LSP configuration - server = { - -- on_attach = function(client, bufnr) - -- -- you can also put keymaps in here - --end, - default_settings = { - -- rust-analyzer language server configuration - ["rust-analyzer"] = { - cargoWatch = true, - cargo = { - allFeatures = true, - allTargets = false, - loadOutDirsFromCheck = true, - buildScripts = { - enable = true, - }, - }, - checkOnSave = { - allFeatures = true, - allTargets = false, - }, - diagnostics = { - enable = true, - }, - procMacro = { - enable = true, - ignored = { - ["async-trait"] = { "async_trait" }, - ["napi-derive"] = { "napi" }, - ["async-recursion"] = { "async_recursion" }, - }, - }, - files = { - excludeDirs = { - ".direnv", - ".git", - ".github", - ".gitlab", - "bin", - "node_modules", - "target", - "venv", - ".venv", - }, - }, - }, - }, - }, - -- DAP configuration - dap = {}, + -- Plugin configuration + -- tools = { + -- }, + -- LSP configuration + server = { + -- on_attach = function(client, bufnr) + -- -- you can also put keymaps in here + --end, + default_settings = { + -- rust-analyzer language server configuration + ["rust-analyzer"] = { + cargoWatch = true, + cargo = { + allFeatures = true, + allTargets = false, + loadOutDirsFromCheck = true, + buildScripts = { + enable = true, + }, + }, + checkOnSave = { + allFeatures = true, + allTargets = false, + }, + diagnostics = { + enable = true, + }, + procMacro = { + enable = true, + ignored = { + ["async-trait"] = { "async_trait" }, + ["napi-derive"] = { "napi" }, + ["async-recursion"] = { "async_recursion" }, + }, + }, + files = { + excludeDirs = { + ".direnv", + ".git", + ".github", + ".gitlab", + "bin", + "node_modules", + "target", + "venv", + ".venv", + }, + }, + }, + }, + }, + -- DAP configuration + dap = {}, } vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("lsp", { clear = true }), - callback = function(args) - vim.api.nvim_create_autocmd("BufWritePre", { - buffer = args.buf, - callback = function() - vim.lsp.buf.format({ async = false, id = args.data.client_id }) - end, - }) - end, + group = vim.api.nvim_create_augroup("lsp", { clear = true }), + callback = function(args) + vim.api.nvim_create_autocmd("BufWritePre", { + buffer = args.buf, + callback = function() + vim.lsp.buf.format({ async = false, id = args.data.client_id }) + end, + }) + end, }) diff --git a/lua/config/opts.lua b/lua/config/opts.lua index c5910f8..0870ca3 100644 --- a/lua/config/opts.lua +++ b/lua/config/opts.lua @@ -1,22 +1,25 @@ vim.opt.termguicolors = true vim.cmd("colorscheme tokyonight") +vim.o.shiftwidth = 4 +vim.o.expandtab = true +vim.o.smartindent = true vim.wo.number = true vim.wo.relativenumber = true vim.diagnostic.config({ - virtual_text = true, - virtual_lines = { - current_line = true, - }, - update_in_insert = true, - signs = true, + virtual_text = true, + virtual_lines = { + current_line = true, + }, + update_in_insert = true, + signs = true, }) vim.api.nvim_create_autocmd("TextYankPost", { - desc = "Highlight when yanking (copying) text", - group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }), - callback = function() - vim.highlight.on_yank() - end, + desc = "Highlight when yanking (copying) text", + group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, }) diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 40c34a9..0f14e4d 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -1,8 +1,8 @@ return { - { "echasnovski/mini.pairs", event = "BufEnter", version = "*", opts = {} }, - { "echasnovski/mini.cursorword", event = "BufEnter", version = "*", opts = {} }, - { - "folke/trouble.nvim", - opts = {}, - }, + { "echasnovski/mini.pairs", event = "BufEnter", version = "*", opts = {} }, + { "echasnovski/mini.cursorword", event = "BufEnter", version = "*", opts = {} }, + { + "folke/trouble.nvim", + opts = {}, + }, } diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index ff56f10..7fa6026 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -1,22 +1,22 @@ return { - { - "lewis6991/gitsigns.nvim", - opts = { - signs = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "" }, - topdelete = { text = "" }, - changedelete = { text = "▎" }, - untracked = { text = "▎" }, - }, - signs_staged = { - add = { text = "▎" }, - change = { text = "▎" }, - delete = { text = "" }, - topdelete = { text = "" }, - changedelete = { text = "▎" }, - }, - }, - }, + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + signs_staged = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + }, + }, + }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index e8706cd..31f4b21 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,25 +1,25 @@ return { - "neovim/nvim-lspconfig", - { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - }, - { - "mrcjkb/rustaceanvim", - version = "^6", -- Recommended - lazy = false, -- This plugin is already lazy - enabled = true, - }, - { - "saghen/blink.cmp", - version = "1.*", - opts = { - keymap = { - preset = "super-tab", - }, - sources = { - default = { "lsp", "path", "buffer" }, - }, - }, - }, + "neovim/nvim-lspconfig", + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + }, + { + "mrcjkb/rustaceanvim", + version = "^6", -- Recommended + lazy = false, -- This plugin is already lazy + enabled = true, + }, + { + "saghen/blink.cmp", + version = "1.*", + opts = { + keymap = { + preset = "super-tab", + }, + sources = { + default = { "lsp", "path", "buffer" }, + }, + }, + }, } diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua index 5feb1af..22f6388 100644 --- a/lua/plugins/snacks.lua +++ b/lua/plugins/snacks.lua @@ -1,9 +1,9 @@ return { - "folke/snacks.nvim", - priority = 1000, - opts = { - picker = {}, - explorer = {}, - toggle = {}, - }, + "folke/snacks.nvim", + priority = 1000, + opts = { + picker = {}, + explorer = {}, + toggle = {}, + }, } diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua index f168ddb..56f52b5 100644 --- a/lua/plugins/theme.lua +++ b/lua/plugins/theme.lua @@ -1,21 +1,21 @@ return { - { - "marko-cerovac/material.nvim", - lazy = false, - priority = 1000, - config = function() - vim.g.material_style = "darker" - end, - }, - { - "folke/tokyonight.nvim", - lazy = true, - opts = { style = "moon" }, - }, - { - "dupeiran001/nord.nvim", - lazy = false, - priority = 1000, - opts = {}, - }, + { + "marko-cerovac/material.nvim", + lazy = false, + priority = 1000, + config = function() + vim.g.material_style = "darker" + end, + }, + { + "folke/tokyonight.nvim", + lazy = true, + opts = { style = "moon" }, + }, + { + "dupeiran001/nord.nvim", + lazy = false, + priority = 1000, + opts = {}, + }, } diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index c50a7a8..30e2b15 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -1,54 +1,54 @@ return { - { - "folke/which-key.nvim", - event = "VeryLazy", - }, - { - "echasnovski/mini.icons", - version = "*", - init = function() - package.preload["nvim-web-devicons"] = function() - require("mini.icons").mock_nvim_web_devicons() - return package.loaded["nvim-web-devicons"] - end - end, - }, - { - "akinsho/bufferline.nvim", - version = "*", - dependencies = "nvim-tree/nvim-web-devicons", - opts = { - options = { - diagnostics = "nvim_lsp", - show_close_icon = false, - separator_style = "slant", - offsets = { - { - filetype = "snacks_layout_box", - text = "󰙅 File Explorer", - separator = true, - }, - }, - }, - }, - }, - { - "folke/noice.nvim", - event = "VeryLazy", - dependencies = { - -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries - "MunifTanjim/nui.nvim", - -- OPTIONAL: - -- `nvim-notify` is only needed, if you want to use the notification view. - -- If not available, we use `mini` as the fallback - -- "rcarriga/nvim-notify", - }, - opts = { - -- you can enable a preset for easier configuration - presets = { - bottom_search = true, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - }, - }, - }, + { + "folke/which-key.nvim", + event = "VeryLazy", + }, + { + "echasnovski/mini.icons", + version = "*", + init = function() + package.preload["nvim-web-devicons"] = function() + require("mini.icons").mock_nvim_web_devicons() + return package.loaded["nvim-web-devicons"] + end + end, + }, + { + "akinsho/bufferline.nvim", + version = "*", + dependencies = "nvim-tree/nvim-web-devicons", + opts = { + options = { + diagnostics = "nvim_lsp", + show_close_icon = false, + separator_style = "slant", + offsets = { + { + filetype = "snacks_layout_box", + text = "󰙅 File Explorer", + separator = true, + }, + }, + }, + }, + }, + { + "folke/noice.nvim", + event = "VeryLazy", + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + "rcarriga/nvim-notify", + }, + opts = { + -- you can enable a preset for easier configuration + presets = { + bottom_search = true, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + }, + }, + }, }