diff --git a/init.lua b/init.lua index 7b119ff..b87ed78 100644 --- a/init.lua +++ b/init.lua @@ -19,6 +19,9 @@ vim.api.nvim_create_autocmd("LspAttach", { vim.keymap.set("n", "for", function() vim.lsp.buf.format({ async = true }) end, opts) + vim.keymap.set("n", "e", vim.diagnostic.open_float, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.jump({ count = -1 }) end) + vim.keymap.set("n", "]d", function() vim.diagnostic.jump({ count = 1 }) end) end, }) diff --git a/lazy-lock.json b/lazy-lock.json index 15e22ed..4387c38 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,15 +1,16 @@ { - "blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" }, + "blink.cmp": { "branch": "main", "commit": "451168851e8e2466bc97ee3e026c3dcb9141ce07" }, "fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" }, "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, - "fzf-lua": { "branch": "main", "commit": "76ddd6b56875bf4f6fd13848728207e738bb75a3" }, - "gruvbox.nvim": { "branch": "main", "commit": "561126520034a1dac2f78ab063db025d12555998" }, + "fzf-lua": { "branch": "main", "commit": "bde73a6886b607246095aa59f396de5e0d036890" }, + "gruvbox.nvim": { "branch": "main", "commit": "334d5fd49fc8033f26408425366c66c6390c57bb" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, - "nvim-treesitter": { "branch": "main", "commit": "d660b7c002f3922b6bb3da47206645488a698426" }, + "nvim-treesitter": { "branch": "main", "commit": "7caec274fd19c12b55902a5b795100d21531391f" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "8fe8a95630f4f2c72a87ba1927af649e0bfaa244" }, "nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" }, - "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" }, - "rustaceanvim": { "branch": "master", "commit": "13f7f5c46d2db0b8daee64a842d8faebfe9064c0" } + "nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" }, + "rustaceanvim": { "branch": "master", "commit": "f2f0c1231a5b019dbc1fd6dafac1751c878925a3" }, + "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" } } diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 1fd5299..659b3c9 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) @@ -25,11 +25,11 @@ require("settings") -- Setup lazy.nvim require("lazy").setup({ - spec = { - { import = "plugins" }, - }, - checker = { - enabled = true, - notify = false, - }, + spec = { + { import = "plugins" }, + }, + checker = { + enabled = true, + notify = false, + }, }) diff --git a/lua/plugins/fzf.lua b/lua/plugins/fzf.lua index 67aa963..6d3adc2 100644 --- a/lua/plugins/fzf.lua +++ b/lua/plugins/fzf.lua @@ -13,6 +13,6 @@ return { { 'fh', function() require('fzf-lua').help_tags() end, desc = 'Help tags' }, { 'fr', function() require('fzf-lua').oldfiles() end, desc = 'Recent files' }, { 'fd', function() require('fzf-lua').diagnostic_document() end, desc = 'Diagnostics' }, - { 'fs', function() require('fzf-lua').lsp_document_symbosl() end, desc = 'LSP symbols' }, + { 'fs', function() require('fzf-lua').lsp_document_symbols() end, desc = 'LSP symbols' }, }, } diff --git a/lua/plugins/rustaceanvim.lua b/lua/plugins/rustaceanvim.lua index 970ee18..2e89672 100644 --- a/lua/plugins/rustaceanvim.lua +++ b/lua/plugins/rustaceanvim.lua @@ -3,7 +3,7 @@ return { version = '^8', lazy = false, init = function() - vim.g.rustaceamvim = { + vim.g.rustaceanvim = { server = { settings = { ['rust-analyzer'] = { diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua index e75ad72..f40de6c 100644 --- a/lua/plugins/theme.lua +++ b/lua/plugins/theme.lua @@ -2,5 +2,5 @@ return { "ellisonleao/gruvbox.nvim", priority = 1000, config = true, - opts = ..., + opts = {}, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 9bd0c70..e6d5d36 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -5,4 +5,3 @@ return { indent = { enable = true }, }, } - diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua new file mode 100644 index 0000000..90bb8fe --- /dev/null +++ b/lua/plugins/trouble.lua @@ -0,0 +1,23 @@ +return { + 'folke/trouble.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + opts = { + modes = { + diagnostics = { + mode = "diagnostics", + preview = { + type = "diagnostics", + relative = "win", + position = "right", + size = 0.4, + }, + }, + }, + }, + keys = { + { 'xx', 'Trouble diagnostics toggle', desc = 'Diagnostics (workspace)' }, + { 'xd', 'Trouble diagnostics toggle filter.buf=0', desc = 'Diagnostics (buffer)' }, + { ']t', function() require('trouble').next({ skip_groups = true, jump = true }) end, desc = 'Next trouble item' }, + { '[t', function() require('trouble').prev({ skip_groups = true, jump = true }) end, desc = 'Prev trouble item' }, + } +} diff --git a/lua/settings.lua b/lua/settings.lua index 44c443c..0f17daa 100644 --- a/lua/settings.lua +++ b/lua/settings.lua @@ -1,33 +1,41 @@ -- Line numbers -vim.opt.number = true -- show absolute line numbers -vim.opt.relativenumber = true -- show relative line numbers +vim.opt.number = true -- show absolute line numbers +vim.opt.relativenumber = true -- show relative line numbers -- Mouse & clipboard vim.opt.mouse = "a" -- enable mouse support vim.opt.clipboard = "unnamedplus" -- use system clipboard -- Visual behavior -vim.opt.termguicolors = true -- enable true colors -vim.opt.cursorline = true -- highlight the current line -vim.opt.wrap = false -- do not wrap long lines -vim.opt.signcolumn = "yes" -- always show the sign number (LSP, git) +vim.opt.termguicolors = true -- enable true colors +vim.opt.cursorline = true -- highlight the current line +vim.opt.wrap = false -- do not wrap long lines +vim.opt.signcolumn = "yes" -- always show the sign number (LSP, git) --- Scrolling -vim.opt.scrolloff = 8 -- keep space above/below cursor -vim.opt.sidescrolloff = 8 -- keep space left/right of cursor +-- Scrolling +vim.opt.scrolloff = 8 -- keep space above/below cursor +vim.opt.sidescrolloff = 8 -- keep space left/right of cursor -- Indentation -vim.opt.expandtab = true -- use spaces instead of tabs -vim.opt.tabstop = 2 -- how many spaces a tab looks like -vim.opt.shiftwidth = 2 -- how many spaces when indenting +vim.opt.expandtab = true -- use spaces instead of tabs +vim.opt.tabstop = 2 -- how many spaces a tab looks like +vim.opt.shiftwidth = 2 -- how many spaces when indenting -- Search -vim.opt.ignorecase = true -- case-insensitive search -vim.opt.smartcase = true -- case-sensitive if uppercase is used -vim.opt.incsearch = true -- show matches while typing -vim.opt.hlsearch = false -- do not keep matches highlighted +vim.opt.ignorecase = true -- case-insensitive search +vim.opt.smartcase = true -- case-sensitive if uppercase is used +vim.opt.incsearch = true -- show matches while typing +vim.opt.hlsearch = false -- do not keep matches highlighted -- Window splits -vim.opt.splitbelow = true -- horizontal splits open below -vim.opt.splitright = true -- vertical splits open to the right +vim.opt.splitbelow = true -- horizontal splits open below +vim.opt.splitright = true -- vertical splits open to the right +-- Diagnostics +vim.diagnostic.config({ + virtual_text = true, -- use virtual text for diagnostics + signs = true, -- use signs for diagnostics + underline = true, -- use underline for diagnostics + update_in_insert = false, -- update diagnostics in insert mod + severity_sort = true, -- sort diagnostics by severity +})