summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
Diffstat (limited to 'nvim')
-rw-r--r--nvim/.config/nvim/init.lua425
-rw-r--r--nvim/.config/nvim/lazy-lock.json2
-rw-r--r--nvim/.config/nvim/stylua.toml2
3 files changed, 252 insertions, 177 deletions
diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua
index 6543477..ece2cf4 100644
--- a/nvim/.config/nvim/init.lua
+++ b/nvim/.config/nvim/init.lua
@@ -1,8 +1,8 @@
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
-vim.g.mapleader = ' '
-vim.g.maplocalleader = ' '
+vim.g.mapleader = " "
+vim.g.maplocalleader = " "
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true
@@ -19,7 +19,7 @@ vim.o.number = true
-- vim.o.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
-vim.o.mouse = 'a'
+vim.o.mouse = "a"
-- Don't show the mode, since it's already in the status line
vim.o.showmode = false
@@ -28,7 +28,9 @@ vim.o.showmode = false
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
-vim.schedule(function() vim.o.clipboard = 'unnamedplus' end)
+vim.schedule(function()
+ vim.o.clipboard = "unnamedplus"
+end)
-- Enable break indent
vim.o.breakindent = true
@@ -41,7 +43,7 @@ vim.o.ignorecase = true
vim.o.smartcase = true
-- Keep signcolumn on by default
-vim.o.signcolumn = 'yes'
+vim.o.signcolumn = "yes"
-- Decrease update time
vim.o.updatetime = 250
@@ -62,10 +64,10 @@ vim.o.splitbelow = true
-- See `:help lua-options`
-- and `:help lua-guide-options`
vim.o.list = true
-vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
+vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
-- Preview substitutions live, as you type!
-vim.o.inccommand = 'split'
+vim.o.inccommand = "split"
-- Show which line your cursor is on
vim.o.cursorline = true
@@ -83,14 +85,14 @@ vim.o.confirm = true
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
-vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
+vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
-- Diagnostic Config & Keymaps
-- See :help vim.diagnostic.Opts
-vim.diagnostic.config {
+vim.diagnostic.config({
update_in_insert = false,
severity_sort = true,
- float = { border = 'rounded', source = 'if_many' },
+ float = { border = "rounded", source = "if_many" },
underline = { severity = { min = vim.diagnostic.severity.WARN } },
-- Can switch between these as you prefer
@@ -99,9 +101,9 @@ vim.diagnostic.config {
-- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d`
jump = { float = true },
-}
+})
-vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
+vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
@@ -109,7 +111,7 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
--
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode
-vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
+vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
@@ -121,10 +123,10 @@ vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' }
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
-vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
-vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
-vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
-vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
+vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
+vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
+vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
+vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
@@ -138,19 +140,23 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.hl.on_yank()`
-vim.api.nvim_create_autocmd('TextYankPost', {
- desc = 'Highlight when yanking (copying) text',
- group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
- callback = function() vim.hl.on_yank() end,
+vim.api.nvim_create_autocmd("TextYankPost", {
+ desc = "Highlight when yanking (copying) text",
+ group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
+ callback = function()
+ vim.hl.on_yank()
+ end,
})
-- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
-local lazypath = vim.fn.stdpath 'data' .. '/lazy/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 error('Error cloning lazy.nvim:\n' .. out) 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
+ error("Error cloning lazy.nvim:\n" .. out)
+ end
end
---@type vim.Option
@@ -168,9 +174,9 @@ rtp:prepend(lazypath)
-- :Lazy update
--
-- NOTE: Here is where you install your plugins.
-require('lazy').setup({
+require("lazy").setup({
-- NOTE: Plugins can be added via a link or github org/name. To run setup automatically, use `opts = {}`
- { 'NMAC427/guess-indent.nvim', opts = {} },
+ { "NMAC427/guess-indent.nvim", opts = {} },
-- Alternatively, use `config = function() ... end` for full control over the configuration.
-- If you prefer to call `setup` explicitly, use:
@@ -188,17 +194,17 @@ require('lazy').setup({
--
-- See `:help gitsigns` to understand what the configuration keys do
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
- 'lewis6991/gitsigns.nvim',
+ "lewis6991/gitsigns.nvim",
---@module 'gitsigns'
---@type Gitsigns.Config
---@diagnostic disable-next-line: missing-fields
opts = {
signs = {
- add = { text = '+' }, ---@diagnostic disable-line: missing-fields
- change = { text = '~' }, ---@diagnostic disable-line: missing-fields
- delete = { text = '_' }, ---@diagnostic disable-line: missing-fields
- topdelete = { text = '‾' }, ---@diagnostic disable-line: missing-fields
- changedelete = { text = '~' }, ---@diagnostic disable-line: missing-fields
+ add = { text = "+" }, ---@diagnostic disable-line: missing-fields
+ change = { text = "~" }, ---@diagnostic disable-line: missing-fields
+ delete = { text = "_" }, ---@diagnostic disable-line: missing-fields
+ topdelete = { text = "‾" }, ---@diagnostic disable-line: missing-fields
+ changedelete = { text = "~" }, ---@diagnostic disable-line: missing-fields
},
},
},
@@ -218,22 +224,56 @@ require('lazy').setup({
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
{ -- Useful plugin to show you pending keybinds.
- 'folke/which-key.nvim',
- event = 'VimEnter',
+ "folke/which-key.nvim",
+ event = "VimEnter",
---@module 'which-key'
---@type wk.Opts
---@diagnostic disable-next-line: missing-fields
opts = {
-- delay between pressing a key and opening which-key (milliseconds)
delay = 0,
- icons = { mappings = vim.g.have_nerd_font },
+ icons = {
+ mappings = vim.g.have_nerd_font,
+ keys = vim.g.have_nerd_font and {} or {
+ Up = "<Up> ",
+ Down = "<Down> ",
+ Left = "<Left> ",
+ Right = "<Right> ",
+ C = "<C-…> ",
+ M = "<M-…> ",
+ D = "<D-…> ",
+
+ S = "<S-…> ",
+ CR = "<CR> ",
+ Esc = "<Esc> ",
+ ScrollWheelDown = "<ScrollWheelDown> ",
+ ScrollWheelUp = "<ScrollWheelUp> ",
+ NL = "<NL> ",
+ BS = "<BS> ",
+ Space = "<Space> ",
+ Tab = "<Tab> ",
+ F1 = "<F1>",
+ F2 = "<F2>",
+
+ F3 = "<F3>",
+ F4 = "<F4>",
+ F5 = "<F5>",
+ F6 = "<F6>",
+ F7 = "<F7>",
+ F8 = "<F8>",
+ F9 = "<F9>",
+ F10 = "<F10>",
+ F11 = "<F11>",
+ F12 = "<F12>",
+ },
+ },
-- Document existing key chains
spec = {
- { '<leader>s', group = '[S]earch', mode = { 'n', 'v' } },
- { '<leader>t', group = '[T]oggle' },
- { '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } }, -- Enable gitsigns recommended keymaps first
- { 'gr', group = 'LSP Actions', mode = { 'n' } },
+ { "<leader>s", group = "[S]earch", mode = { "n", "v" } },
+ { "<leader>t", group = "[T]oggle" },
+ { "<leader>h", group = "Git [H]unk", mode = { "n", "v" } }, -- Enable gitsigns recommended keymaps first
+ { "gr", group = "LSP Actions", mode = { "n" } },
},
},
},
@@ -246,7 +286,7 @@ require('lazy').setup({
-- Use the `dependencies` key to specify the dependencies of a particular plugin
{ -- Fuzzy Finder (files, lsp, etc)
- 'nvim-telescope/telescope.nvim',
+ "nvim-telescope/telescope.nvim",
-- By default, Telescope is included and acts as your picker for everything.
-- If you would like to switch to a different picker (like snacks, or fzf-lua)
@@ -257,24 +297,26 @@ require('lazy').setup({
-- it’s best to remove the Telescope plugin config entirely
-- instead of just disabling it here, to keep your config clean.
enabled = true,
- event = 'VimEnter',
+ event = "VimEnter",
dependencies = {
- 'nvim-lua/plenary.nvim',
+ "nvim-lua/plenary.nvim",
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
- 'nvim-telescope/telescope-fzf-native.nvim',
+ "nvim-telescope/telescope-fzf-native.nvim",
-- `build` is used to run some command when the plugin is installed/updated.
-- This is only run then, not every time Neovim starts up.
- build = 'make',
+ build = "make",
-- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded.
- cond = function() return vim.fn.executable 'make' == 1 end,
+ cond = function()
+ return vim.fn.executable("make") == 1
+ end,
},
- { 'nvim-telescope/telescope-ui-select.nvim' },
+ { "nvim-telescope/telescope-ui-select.nvim" },
-- Useful for getting pretty icons, but requires a Nerd Font.
- { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
+ { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
},
config = function()
-- Telescope is a fuzzy finder that comes with a lot of different things that
@@ -298,7 +340,7 @@ require('lazy').setup({
-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
- require('telescope').setup {
+ require("telescope").setup({
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
@@ -309,111 +351,113 @@ require('lazy').setup({
-- },
-- pickers = {}
extensions = {
- ['ui-select'] = { require('telescope.themes').get_dropdown() },
+ ["ui-select"] = { require("telescope.themes").get_dropdown() },
},
- }
+ })
-- Enable Telescope extensions if they are installed
- pcall(require('telescope').load_extension, 'fzf')
- pcall(require('telescope').load_extension, 'ui-select')
+ pcall(require("telescope").load_extension, "fzf")
+ pcall(require("telescope").load_extension, "ui-select")
-- See `:help telescope.builtin`
- local builtin = require 'telescope.builtin'
- vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
- vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
- vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
- vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
- vim.keymap.set({ 'n', 'v' }, '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
- vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
- vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
- vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
- vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
- vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
- vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
+ local builtin = require("telescope.builtin")
+ vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
+ vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
+ vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
+ vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
+ vim.keymap.set({ "n", "v" }, "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
+ vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
+ vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
+ vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
+ vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
+ vim.keymap.set("n", "<leader>sc", builtin.commands, { desc = "[S]earch [C]ommands" })
+ vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
-- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info,
-- it is better explained there). This allows easily switching between pickers if you prefer using something else!
- vim.api.nvim_create_autocmd('LspAttach', {
- group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }),
+ vim.api.nvim_create_autocmd("LspAttach", {
+ group = vim.api.nvim_create_augroup("telescope-lsp-attach", { clear = true }),
callback = function(event)
local buf = event.buf
-- Find references for the word under your cursor.
- vim.keymap.set('n', 'grr', builtin.lsp_references, { buffer = buf, desc = '[G]oto [R]eferences' })
+ vim.keymap.set("n", "grr", builtin.lsp_references, { buffer = buf, desc = "[G]oto [R]eferences" })
-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
- vim.keymap.set('n', 'gri', builtin.lsp_implementations, { buffer = buf, desc = '[G]oto [I]mplementation' })
+ vim.keymap.set("n", "gri", builtin.lsp_implementations, { buffer = buf, desc = "[G]oto [I]mplementation" })
-- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
- vim.keymap.set('n', 'grd', builtin.lsp_definitions, { buffer = buf, desc = '[G]oto [D]efinition' })
+ vim.keymap.set("n", "grd", builtin.lsp_definitions, { buffer = buf, desc = "[G]oto [D]efinition" })
-- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc.
- vim.keymap.set('n', 'gO', builtin.lsp_document_symbols, { buffer = buf, desc = 'Open Document Symbols' })
+ vim.keymap.set("n", "gO", builtin.lsp_document_symbols, { buffer = buf, desc = "Open Document Symbols" })
-- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project.
- vim.keymap.set('n', 'gW', builtin.lsp_dynamic_workspace_symbols, { buffer = buf, desc = 'Open Workspace Symbols' })
+ vim.keymap.set(
+ "n",
+ "gW",
+ builtin.lsp_dynamic_workspace_symbols,
+ { buffer = buf, desc = "Open Workspace Symbols" }
+ )
-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*.
- vim.keymap.set('n', 'grt', builtin.lsp_type_definitions, { buffer = buf, desc = '[G]oto [T]ype Definition' })
+ vim.keymap.set("n", "grt", builtin.lsp_type_definitions, { buffer = buf, desc = "[G]oto [T]ype Definition" })
end,
})
-- Override default behavior and theme when searching
- vim.keymap.set('n', '<leader>/', function()
+ vim.keymap.set("n", "<leader>/", function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
- builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
+ builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
winblend = 10,
previewer = false,
- })
- end, { desc = '[/] Fuzzily search in current buffer' })
+ }))
+ end, { desc = "[/] Fuzzily search in current buffer" })
-- It's also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys
- vim.keymap.set(
- 'n',
- '<leader>s/',
- function()
- builtin.live_grep {
- grep_open_files = true,
- prompt_title = 'Live Grep in Open Files',
- }
- end,
- { desc = '[S]earch [/] in Open Files' }
- )
+ vim.keymap.set("n", "<leader>s/", function()
+ builtin.live_grep({
+ grep_open_files = true,
+ prompt_title = "Live Grep in Open Files",
+ })
+ end, { desc = "[S]earch [/] in Open Files" })
-- Shortcut for searching your Neovim configuration files
- vim.keymap.set('n', '<leader>sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' })
+ vim.keymap.set("n", "<leader>sn", function()
+ builtin.find_files({ cwd = vim.fn.stdpath("config") })
+ end, { desc = "[S]earch [N]eovim files" })
end,
},
-- LSP Plugins
{
-- Main LSP Configuration
- 'neovim/nvim-lspconfig',
+ "neovim/nvim-lspconfig",
dependencies = {
-- Automatically install LSPs and related tools to stdpath for Neovim
-- Mason must be loaded before its dependents so we need to set it up here.
-- NOTE: `opts = {}` is the same as calling `require('mason').setup({})`
{
- 'mason-org/mason.nvim',
+ "mason-org/mason.nvim",
---@module 'mason.settings'
---@type MasonSettings
---@diagnostic disable-next-line: missing-fields
opts = {},
},
-- Maps LSP server names between nvim-lspconfig and Mason package names.
- 'mason-org/mason-lspconfig.nvim',
- 'WhoIsSethDaniel/mason-tool-installer.nvim',
+ "mason-org/mason-lspconfig.nvim",
+ "WhoIsSethDaniel/mason-tool-installer.nvim",
-- Useful status updates for LSP.
- { 'j-hui/fidget.nvim', opts = {} },
+ { "j-hui/fidget.nvim", opts = {} },
},
config = function()
-- Brief aside: **What is LSP?**
@@ -445,8 +489,8 @@ require('lazy').setup({
-- That is to say, every time a new file is opened that is associated with
-- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
-- function will be executed to configure the current buffer
- vim.api.nvim_create_autocmd('LspAttach', {
- group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
+ vim.api.nvim_create_autocmd("LspAttach", {
+ group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }),
callback = function(event)
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself.
@@ -454,21 +498,21 @@ require('lazy').setup({
-- In this case, we create a function that lets us more easily define mappings specific
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode)
- mode = mode or 'n'
- vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
+ mode = mode or "n"
+ vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
end
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
- map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
+ map("grn", vim.lsp.buf.rename, "[R]e[n]ame")
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
- map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' })
+ map("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header.
- map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
+ map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
-- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while.
@@ -476,25 +520,25 @@ require('lazy').setup({
--
-- When you move your cursor, the highlights will be cleared (the second autocommand).
local client = vim.lsp.get_client_by_id(event.data.client_id)
- if client and client:supports_method('textDocument/documentHighlight', event.buf) then
- local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
+ if client and client:supports_method("textDocument/documentHighlight", event.buf) then
+ local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false })
+ vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.document_highlight,
})
- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
+ vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
buffer = event.buf,
group = highlight_augroup,
callback = vim.lsp.buf.clear_references,
})
- vim.api.nvim_create_autocmd('LspDetach', {
- group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
+ vim.api.nvim_create_autocmd("LspDetach", {
+ group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }),
callback = function(event2)
vim.lsp.buf.clear_references()
- vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
+ vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf })
end,
})
end
@@ -503,8 +547,10 @@ require('lazy').setup({
-- code, if the language server you are using supports them
--
-- This may be unwanted, since they displace some of your code
- if client and client:supports_method('textDocument/inlayHint', event.buf) then
- map('<leader>th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints')
+ if client and client:supports_method("textDocument/inlayHint", event.buf) then
+ map("<leader>th", function()
+ vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf }))
+ end, "[T]oggle Inlay [H]ints")
end
end,
})
@@ -532,21 +578,26 @@ require('lazy').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.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then return end
+ if
+ path ~= vim.fn.stdpath("config")
+ and (vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc"))
+ then
+ return
+ end
end
- client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
+ client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
runtime = {
- version = 'LuaJIT',
- path = { 'lua/?.lua', 'lua/?/init.lua' },
+ version = "LuaJIT",
+ path = { "lua/?.lua", "lua/?/init.lua" },
},
workspace = {
checkThirdParty = false,
-- NOTE: this is a lot slower and will cause issues when working on your own configuration.
-- See https://github.com/neovim/nvim-lspconfig/issues/3189
- library = vim.tbl_extend('force', vim.api.nvim_get_runtime_file('', true), {
- '${3rd}/luv/library',
- '${3rd}/busted/library',
+ library = vim.tbl_extend("force", vim.api.nvim_get_runtime_file("", true), {
+ "${3rd}/luv/library",
+ "${3rd}/busted/library",
}),
},
})
@@ -569,7 +620,7 @@ require('lazy').setup({
-- You can add other tools here that you want Mason to install
})
- require('mason-tool-installer').setup { ensure_installed = ensure_installed }
+ require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
for name, server in pairs(servers) do
vim.lsp.config(name, server)
@@ -579,15 +630,17 @@ require('lazy').setup({
},
{ -- Autoformat
- 'stevearc/conform.nvim',
- event = { 'BufWritePre' },
- cmd = { 'ConformInfo' },
+ "stevearc/conform.nvim",
+ event = { "BufWritePre" },
+ cmd = { "ConformInfo" },
keys = {
{
- '<leader>f',
- function() require('conform').format { async = true, lsp_format = 'fallback' } end,
- mode = '',
- desc = '[F]ormat buffer',
+ "<leader>f",
+ function()
+ require("conform").format({ async = true, lsp_format = "fallback" })
+ end,
+ mode = "",
+ desc = "[F]ormat buffer",
},
},
---@module 'conform'
@@ -604,12 +657,12 @@ require('lazy').setup({
else
return {
timeout_ms = 500,
- lsp_format = 'fallback',
+ lsp_format = "fallback",
}
end
end,
formatters_by_ft = {
- lua = { 'stylua' },
+ lua = { "stylua" },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
@@ -620,20 +673,22 @@ require('lazy').setup({
},
{ -- Autocompletion
- 'saghen/blink.cmp',
- event = 'VimEnter',
- version = '1.*',
+ "saghen/blink.cmp",
+ event = "VimEnter",
+ version = "1.*",
dependencies = {
-- Snippet Engine
{
- 'L3MON4D3/LuaSnip',
- version = '2.*',
+ "L3MON4D3/LuaSnip",
+ version = "2.*",
build = (function()
-- Build Step is needed for regex support in snippets.
-- This step is not supported in many windows environments.
-- Remove the below condition to re-enable on windows.
- if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then return end
- return 'make install_jsregexp'
+ if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
+ return
+ end
+ return "make install_jsregexp"
end)(),
dependencies = {
-- `friendly-snippets` contains a variety of premade snippets.
@@ -674,9 +729,9 @@ require('lazy').setup({
-- <c-k>: Toggle signature help
--
-- See :h blink-cmp-config-keymap for defining your own keymap
- preset = 'enter',
- ['<Tab>'] = { 'select_next', 'snippet_forward', 'fallback' },
- ['<S-Tab>'] = { 'select_prev', 'snippet_backward', 'fallback' },
+ preset = "enter",
+ ["<Tab>"] = { "select_next", "snippet_forward", "fallback" },
+ ["<S-Tab>"] = { "select_prev", "snippet_backward", "fallback" },
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
@@ -685,7 +740,7 @@ require('lazy').setup({
appearance = {
-- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
- nerd_font_variant = 'normal',
+ nerd_font_variant = "normal",
},
completion = {
@@ -696,10 +751,10 @@ require('lazy').setup({
},
sources = {
- default = { 'lsp', 'path', 'snippets' },
+ default = { "lsp", "path", "snippets" },
},
- snippets = { preset = 'luasnip' },
+ snippets = { preset = "luasnip" },
-- Blink.cmp includes an optional, recommended rust fuzzy matcher,
-- which automatically downloads a prebuilt binary when enabled.
@@ -708,7 +763,7 @@ require('lazy').setup({
-- the rust implementation via `'prefer_rust_with_warning'`
--
-- See :h blink-cmp-config-fuzzy for more information
- fuzzy = { implementation = 'lua' },
+ fuzzy = { implementation = "lua" },
-- Shows a signature help window while you type arguments for a function
signature = { enabled = true },
@@ -720,28 +775,28 @@ require('lazy').setup({
-- change the command in the config to whatever the name of that colorscheme is.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
- 'folke/tokyonight.nvim',
+ "folke/tokyonight.nvim",
priority = 1000, -- Make sure to load this before all the other start plugins.
config = function()
---@diagnostic disable-next-line: missing-fields
- require('tokyonight').setup {
+ require("tokyonight").setup({
styles = {
comments = { italic = false }, -- Disable italics in comments
},
- }
+ })
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
- vim.cmd.colorscheme 'tokyonight-night'
+ vim.cmd.colorscheme("tokyonight-night")
end,
},
-- Highlight todo, notes, etc in comments
{
- 'folke/todo-comments.nvim',
- event = 'VimEnter',
- dependencies = { 'nvim-lua/plenary.nvim' },
+ "folke/todo-comments.nvim",
+ event = "VimEnter",
+ dependencies = { "nvim-lua/plenary.nvim" },
---@module 'todo-comments'
---@type TodoOptions
---@diagnostic disable-next-line: missing-fields
@@ -749,7 +804,7 @@ require('lazy').setup({
},
{ -- Collection of various small independent plugins/modules
- 'nvim-mini/mini.nvim',
+ "nvim-mini/mini.nvim",
config = function()
-- Better Around/Inside textobjects
--
@@ -757,30 +812,32 @@ require('lazy').setup({
-- - va) - [V]isually select [A]round [)]paren
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
-- - ci' - [C]hange [I]nside [']quote
- require('mini.ai').setup { n_lines = 500 }
+ require("mini.ai").setup({ n_lines = 500 })
-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
- require('mini.surround').setup()
+ require("mini.surround").setup()
-- Auto-close brackets, parens, quotes, etc.
- require('mini.pairs').setup()
+ require("mini.pairs").setup()
-- Simple and easy statusline.
-- You could remove this setup call if you don't like it,
-- and try some other statusline plugin
- local statusline = require 'mini.statusline'
+ local statusline = require("mini.statusline")
-- set use_icons to true if you have a Nerd Font
- statusline.setup { use_icons = vim.g.have_nerd_font }
+ statusline.setup({ use_icons = vim.g.have_nerd_font })
-- You can configure sections in the statusline by overriding their
-- default behavior. For example, here we set the section for
-- cursor location to LINE:COLUMN
---@diagnostic disable-next-line: duplicate-set-field
- statusline.section_location = function() return '%2l:%-2v' end
+ statusline.section_location = function()
+ return "%2l:%-2v"
+ end
-- ... and there is more!
-- Check out: https://github.com/nvim-mini/mini.nvim
@@ -788,23 +845,39 @@ require('lazy').setup({
},
{ -- Highlight, edit, and navigate code
- 'nvim-treesitter/nvim-treesitter',
+ "nvim-treesitter/nvim-treesitter",
lazy = false,
- build = ':TSUpdate',
- branch = 'main',
+ build = ":TSUpdate",
+ branch = "main",
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
config = function()
- local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
- require('nvim-treesitter').install(parsers)
- vim.api.nvim_create_autocmd('FileType', {
+ local parsers = {
+ "bash",
+ "c",
+ "diff",
+ "html",
+ "lua",
+ "luadoc",
+ "markdown",
+ "markdown_inline",
+ "query",
+ "vim",
+ "vimdoc",
+ }
+ require("nvim-treesitter").install(parsers)
+ vim.api.nvim_create_autocmd("FileType", {
callback = function(args)
local buf, filetype = args.buf, args.match
local language = vim.treesitter.language.get_lang(filetype)
- if not language then return end
+ if not language then
+ return
+ end
-- check if parser exists and load it
- if not vim.treesitter.language.add(language) then return end
+ if not vim.treesitter.language.add(language) then
+ return
+ end
-- enables syntax highlighting and other treesitter features
vim.treesitter.start(buf, language)
@@ -851,19 +924,19 @@ require('lazy').setup({
-- If you are using a Nerd Font: set icons to an empty table which will use the
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
icons = vim.g.have_nerd_font and {} or {
- cmd = '⌘',
- config = '🛠',
- event = '📅',
- ft = '📂',
- init = '⚙',
- keys = '🗝',
- plugin = '🔌',
- runtime = '💻',
- require = '🌙',
- source = '📄',
- start = '🚀',
- task = '📌',
- lazy = '💤 ',
+ cmd = "⌘",
+ config = "🛠",
+ event = "📅",
+ ft = "📂",
+ init = "⚙",
+ keys = "🗝",
+ plugin = "🔌",
+ runtime = "💻",
+ require = "🌙",
+ source = "📄",
+ start = "🚀",
+ task = "📌",
+ lazy = "💤 ",
},
},
})
diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json
index e17fc90..1510adf 100644
--- a/nvim/.config/nvim/lazy-lock.json
+++ b/nvim/.config/nvim/lazy-lock.json
@@ -10,7 +10,7 @@
"mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" },
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
"mini.nvim": { "branch": "main", "commit": "9990c41f10f54f29a888d13024c9f765037bde23" },
- "nvim-lspconfig": { "branch": "master", "commit": "4d0724be90b633ddce51b328a631060e6acd7d66" },
+ "nvim-lspconfig": { "branch": "master", "commit": "dd261ad5266ab5bbec249d21efeceda98ff3e1a6" },
"nvim-treesitter": { "branch": "main", "commit": "2f5d4c3f3c675962242096bcc8e586d76dd72eb2" },
"nvim-web-devicons": { "branch": "master", "commit": "d7462543c9e366c0d196c7f67a945eaaf5d99414" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
diff --git a/nvim/.config/nvim/stylua.toml b/nvim/.config/nvim/stylua.toml
new file mode 100644
index 0000000..0435f67
--- /dev/null
+++ b/nvim/.config/nvim/stylua.toml
@@ -0,0 +1,2 @@
+indent_type = "Spaces"
+indent_width = 2