diff --git a/nvim/init.lua b/nvim/init.lua index 9cdb978..07c810e 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -51,936 +51,984 @@ vim.api.nvim_set_keymap("n", "", ":wqa!", { silent = true }) local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ - { - "folke/tokyonight.nvim", - lazy = false, - priority = 1000, - init = function() - vim.cmd([[colorscheme tokyonight]]) - end, - opts = { - style = "storm", - light_style = "day", - transparent = false, - terminal_colors = true, - }, - }, - { - "nvim-tree/nvim-tree.lua", - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - config = function() - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - vim.opt.termguicolors = true + { + "folke/tokyonight.nvim", + lazy = false, + priority = 1000, + init = function() + vim.cmd([[colorscheme tokyonight]]) + end, + opts = { + style = "storm", + light_style = "day", + transparent = false, + terminal_colors = true, + }, + }, + { + "nvim-tree/nvim-tree.lua", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + vim.opt.termguicolors = true - require("nvim-tree").setup({ - auto_reload_on_write = true, - sort_by = "case_sensitive", - view = { - width = 30, - }, - filters = { - dotfiles = false, - }, - }) - end, - }, - { - "nvim-telescope/telescope.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - }, - config = function() - require("telescope").setup({}) - end, - }, - { - "hrsh7th/nvim-cmp", - dependencies = { - "L3MON4D3/LuaSnip", - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - }, - config = function() - local cmp = require("cmp") + require("nvim-tree").setup({ + auto_reload_on_write = true, + sort_by = "case_sensitive", + view = { + width = 30, + }, + filters = { + dotfiles = false, + }, + }) + end, + }, + { + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + require("telescope").setup({}) + end, + }, + { + "hrsh7th/nvim-cmp", + dependencies = { + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + }, + config = function() + local cmp = require("cmp") - cmp.setup({ - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.complete(), - [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), - }), - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "path" }, - }, { - { name = "buffer" }, - }), - }) + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + }, { + { name = "buffer" }, + }), + }) - -- Set configuration for specific filetype. - cmp.setup.filetype("gitcommit", { - sources = cmp.config.sources({ - { name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). - }, { - { name = "buffer" }, - }), - }) + -- Set configuration for specific filetype. + cmp.setup.filetype("gitcommit", { + sources = cmp.config.sources({ + { name = "git" }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). + }, { + { name = "buffer" }, + }), + }) - -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won"t work anymore). - cmp.setup.cmdline({ "/", "?" }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, - }) + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won"t work anymore). + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) - -- Use cmdline & path source for ":" (if you enabled `native_menu`, this won"t work anymore). - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = "path" }, - }, { - { name = "cmdline" }, - }), - }) - end, - }, - { - "williamboman/mason.nvim", - opts = {}, - }, - { - "williamboman/mason-lspconfig.nvim", - dependencies = { - "williamboman/mason.nvim", - }, - opts = { - ensure_installed = { - "tsserver", - "lua_ls", - "volar", - "cssls", - "cssmodules_ls", - }, - }, - }, - { - "neovim/nvim-lspconfig", - event = "VeryLazy", - dependencies = { - "williamboman/mason-lspconfig.nvim", - }, - init = function() - local whichKey = require("which-key") + -- Use cmdline & path source for ":" (if you enabled `native_menu`, this won"t work anymore). + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = "path" }, + }, { + { name = "cmdline" }, + }), + }) + end, + }, + { + "williamboman/mason.nvim", + opts = {}, + }, + { + "williamboman/mason-lspconfig.nvim", + dependencies = { + "williamboman/mason.nvim", + }, + opts = { + ensure_installed = { + "tsserver", + "lua_ls", + "volar", + "cssls", + "cssmodules_ls", + }, + }, + }, + { + "neovim/nvim-lspconfig", + event = "VeryLazy", + dependencies = { + "williamboman/mason-lspconfig.nvim", + }, + init = function() + local whichKey = require("which-key") - -- Use LspAttach autocommand to only map the following keys - -- after the language server attaches to the current buffer - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), - callback = function(ev) - -- Enable completion triggered by - vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" + -- Use LspAttach autocommand to only map the following keys + -- after the language server attaches to the current buffer + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("UserLspConfig", {}), + callback = function(ev) + -- Enable completion triggered by + vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" - whichKey.register({ - ["l"] = { - name = "LSP", - d = { - name = "Diagnostic", - o = { - function() - vim.diagnostic.open_float() - end, - "Open", - }, - p = { - function() - vim.diagnostic.goto_prev() - end, - "Previous", - }, - n = { - function() - vim.diagnostic.goto_next() - end, - "Next", - }, - }, - b = { - name = "File", - d = { - function() - vim.lsp.buf.declaration() - end, - "Declaration", - buffer = ev.buf, - }, - D = { - function() - vim.lsp.buf.definition() - end, - "Definition", - buffer = ev.buf, - }, - h = { - function() - vim.lsp.buf.hover() - end, - "Hover", - buffer = ev.buf, - }, - i = { - function() - vim.lsp.buf.implementation() - end, - "Implementation", - buffer = ev.buf, - }, - s = { - function() - vim.lsp.buf.signature_help() - end, - "Signature", - buffer = ev.buf, - }, - t = { - function() - vim.lsp.buf.type_definition() - end, - "Type definition", - buffer = ev.buf, - }, - r = { - function() - vim.lsp.buf.rename() - end, - "Rename", - buffer = ev.buf, - }, - c = { - function() - vim.lsp.buf.code_action() - end, - "Code action", - buffer = ev.buf, - }, - R = { - function() - vim.lsp.buf.references() - end, - "References", - buffer = ev.buf, - }, - f = { - function() - vim.lsp.buf.format({ - async = true, - }) - end, - "Format", - buffer = ev.buf, - }, - }, - }, - }) - end, - }) - end, - config = function() - local lspconfig = require("lspconfig") + whichKey.register({ + ["l"] = { + name = "LSP", + d = { + name = "Diagnostic", + o = { + function() + vim.diagnostic.open_float() + end, + "Open", + }, + p = { + function() + vim.diagnostic.goto_prev() + end, + "Previous", + }, + n = { + function() + vim.diagnostic.goto_next() + end, + "Next", + }, + }, + b = { + name = "File", + d = { + function() + vim.lsp.buf.declaration() + end, + "Declaration", + buffer = ev.buf, + }, + D = { + function() + vim.lsp.buf.definition() + end, + "Definition", + buffer = ev.buf, + }, + h = { + function() + vim.lsp.buf.hover() + end, + "Hover", + buffer = ev.buf, + }, + i = { + function() + vim.lsp.buf.implementation() + end, + "Implementation", + buffer = ev.buf, + }, + s = { + function() + vim.lsp.buf.signature_help() + end, + "Signature", + buffer = ev.buf, + }, + t = { + function() + vim.lsp.buf.type_definition() + end, + "Type definition", + buffer = ev.buf, + }, + r = { + function() + vim.lsp.buf.rename() + end, + "Rename", + buffer = ev.buf, + }, + c = { + function() + vim.lsp.buf.code_action() + end, + "Code action", + buffer = ev.buf, + }, + R = { + function() + vim.lsp.buf.references() + end, + "References", + buffer = ev.buf, + }, + f = { + function() + vim.lsp.buf.format({ + async = true, + }) + end, + "Format", + buffer = ev.buf, + }, + }, + }, + }) + end, + }) + end, + config = function() + local lspconfig = require("lspconfig") - local capabilities = require("cmp_nvim_lsp").default_capabilities() + local capabilities = require("cmp_nvim_lsp").default_capabilities() - lspconfig.lua_ls.setup({ - capabilities = capabilities, - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you"re using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, - }) + lspconfig.lua_ls.setup({ + capabilities = capabilities, + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you"re using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, + }) - lspconfig.tsserver.setup({ - capabilities = capabilities, - }) + lspconfig.tsserver.setup({ + capabilities = capabilities, + }) - lspconfig.volar.setup({ - capabilities = capabilities, - filetypes = { - "typescript", - "javascript", - "javascriptreact", - "typescriptreact", - "vue", - }, - }) + lspconfig.volar.setup({ + capabilities = capabilities, + filetypes = { + "typescript", + "javascript", + "javascriptreact", + "typescriptreact", + "vue", + }, + }) - lspconfig.cssls.setup({ - capabilities = capabilities, - filetypes = { - "css", - "scss", - "sass", - "less", - }, - }) + lspconfig.cssls.setup({ + capabilities = capabilities, + filetypes = { + "css", + "scss", + "sass", + "less", + }, + }) - lspconfig.cssmodules_ls.setup({ - capabilities = capabilities, - filetypes = { - "javascript", - "javascriptreact", - "typescript", - "typescriptreact", - }, - }) - end, - }, - { - "jay-babu/mason-null-ls.nvim", - dependencies = { - "williamboman/mason.nvim", - }, - opts = { - ensure_installed = { - "stylua", - "eslint", - "stylelint", - }, - }, - }, - { - "jose-elias-alvarez/null-ls.nvim", - event = "VeryLazy", - dependencies = { - "jay-babu/mason-null-ls.nvim", - }, - config = function() - local null_ls = require("null-ls") + lspconfig.cssmodules_ls.setup({ + capabilities = capabilities, + filetypes = { + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + }, + }) + end, + }, + { + "jay-babu/mason-null-ls.nvim", + dependencies = { + "williamboman/mason.nvim", + }, + opts = { + ensure_installed = { + "stylua", + "eslint", + "stylelint", + }, + }, + }, + { + "jose-elias-alvarez/null-ls.nvim", + event = "VeryLazy", + dependencies = { + "jay-babu/mason-null-ls.nvim", + }, + config = function() + local null_ls = require("null-ls") - null_ls.setup({ - sources = { - null_ls.builtins.formatting.stylua.with({ - filetypes = { - "lua", - }, - }), - -- ESLint - null_ls.builtins.formatting.eslint.with({ - filetypes = { - "javascript", - "typescript", - "javascriptreact", - "typescriptreact", - "tsx", - "vue", - }, - }), - null_ls.builtins.diagnostics.eslint.with({ - filetypes = { - "javascript", - "typescript", - "javascriptreact", - "typescriptreact", - "tsx", - "vue", - }, - }), - null_ls.builtins.code_actions.eslint.with({ - filetypes = { - "javascript", - "typescript", - "javascriptreact", - "typescriptreact", - "tsx", - "vue", - }, - }), - -- StyleLint - null_ls.builtins.diagnostics.stylelint.with({ - filetypes = { - "scss", - "less", - "css", - "sass", - }, - }), - null_ls.builtins.formatting.stylelint.with({ - filetypes = { - "scss", - "less", - "css", - "sass", - }, - }), - }, - }) - end, - }, - { - "nvim-treesitter/nvim-treesitter", - event = "VeryLazy", - config = function() - require("nvim-treesitter.configs").setup({ - -- A list of parser names, or "all" (the five listed parsers should always be installed) - ensure_installed = { - "c", - "css", - "lua", - "vim", - "vimdoc", - "query", - "typescript", - "javascript", - "tsx", - "json", - "vue", - }, + null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua.with({ + filetypes = { + "lua", + }, + }), + -- ESLint + null_ls.builtins.formatting.eslint.with({ + filetypes = { + "javascript", + "typescript", + "javascriptreact", + "typescriptreact", + "tsx", + "vue", + }, + }), + null_ls.builtins.diagnostics.eslint.with({ + filetypes = { + "javascript", + "typescript", + "javascriptreact", + "typescriptreact", + "tsx", + "vue", + }, + }), + null_ls.builtins.code_actions.eslint.with({ + filetypes = { + "javascript", + "typescript", + "javascriptreact", + "typescriptreact", + "tsx", + "vue", + }, + }), + -- StyleLint + null_ls.builtins.diagnostics.stylelint.with({ + filetypes = { + "scss", + "less", + "css", + "sass", + }, + }), + null_ls.builtins.formatting.stylelint.with({ + filetypes = { + "scss", + "less", + "css", + "sass", + }, + }), + }, + }) + end, + }, + { + "nvim-treesitter/nvim-treesitter", + event = "VeryLazy", + config = function() + require("nvim-treesitter.configs").setup({ + -- A list of parser names, or "all" (the five listed parsers should always be installed) + ensure_installed = { + "c", + "css", + "lua", + "vim", + "vimdoc", + "query", + "typescript", + "javascript", + "tsx", + "json", + "vue", + }, - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally - auto_install = false, + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally + auto_install = false, - ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) - -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! - highlight = { - enable = true, + highlight = { + enable = true, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on "syntax" being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, - }) - end, - }, - { - "stevearc/dressing.nvim", - event = "VeryLazy", - opts = { - input = { - -- Set to false to disable the vim.ui.input implementation - enabled = true, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on "syntax" being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + }) + end, + }, + { + "stevearc/dressing.nvim", + event = "VeryLazy", + opts = { + input = { + -- Set to false to disable the vim.ui.input implementation + enabled = true, - -- Default prompt string - default_prompt = "Input:", + -- Default prompt string + default_prompt = "Input:", - -- Can be 'left', 'right', or 'center' - title_pos = "left", + -- Can be 'left', 'right', or 'center' + title_pos = "left", - -- When true, will close the modal - insert_only = true, + -- When true, will close the modal + insert_only = true, - -- When true, input will start in insert mode. - start_in_insert = true, + -- When true, input will start in insert mode. + start_in_insert = true, - -- These are passed to nvim_open_win - anchor = "SW", - border = "rounded", - -- 'editor' and 'win' will default to being centered - relative = "cursor", + -- These are passed to nvim_open_win + anchor = "SW", + border = "rounded", + -- 'editor' and 'win' will default to being centered + relative = "cursor", - -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - prefer_width = 40, - width = nil, - -- min_width and max_width can be a list of mixed types. - -- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total" - max_width = { 140, 0.9 }, - min_width = { 20, 0.2 }, + -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + prefer_width = 40, + width = nil, + -- min_width and max_width can be a list of mixed types. + -- min_width = {20, 0.2} means "the greater of 20 columns or 20% of total" + max_width = { 140, 0.9 }, + min_width = { 20, 0.2 }, - buf_options = {}, - win_options = { - -- Window transparency (0-100) - winblend = 10, - -- Disable line wrapping - wrap = false, - -- Indicator for when text exceeds window - list = true, - listchars = "precedes:…,extends:…", - -- Increase this for more context when text scrolls off the window - sidescrolloff = 0, - }, + buf_options = {}, + win_options = { + -- Window transparency (0-100) + winblend = 10, + -- Disable line wrapping + wrap = false, + -- Indicator for when text exceeds window + list = true, + listchars = "precedes:…,extends:…", + -- Increase this for more context when text scrolls off the window + sidescrolloff = 0, + }, - -- Set to `false` to disable - mappings = { - n = { - [""] = "Close", - [""] = "Confirm", - }, - i = { - [""] = "Close", - [""] = "Confirm", - [""] = "HistoryPrev", - [""] = "HistoryNext", - }, - }, + -- Set to `false` to disable + mappings = { + n = { + [""] = "Close", + [""] = "Confirm", + }, + i = { + [""] = "Close", + [""] = "Confirm", + [""] = "HistoryPrev", + [""] = "HistoryNext", + }, + }, - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf - end, + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, - -- see :help dressing_get_config - get_config = nil, - }, - select = { - -- Set to false to disable the vim.ui.select implementation - enabled = true, + -- see :help dressing_get_config + get_config = nil, + }, + select = { + -- Set to false to disable the vim.ui.select implementation + enabled = true, - -- Priority list of preferred vim.select implementations - backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" }, + -- Priority list of preferred vim.select implementations + backend = { "telescope", "fzf_lua", "fzf", "builtin", "nui" }, - -- Trim trailing `:` from prompt - trim_prompt = true, + -- Trim trailing `:` from prompt + trim_prompt = true, - -- Options for telescope selector - -- These are passed into the telescope picker directly. Can be used like: - -- telescope = require('telescope.themes').get_ivy({...}) - telescope = nil, + -- Options for telescope selector + -- These are passed into the telescope picker directly. Can be used like: + -- telescope = require('telescope.themes').get_ivy({...}) + telescope = nil, - -- Options for fzf selector - fzf = { - window = { - width = 0.5, - height = 0.4, - }, - }, + -- Options for fzf selector + fzf = { + window = { + width = 0.5, + height = 0.4, + }, + }, - -- Options for fzf-lua - fzf_lua = { - -- winopts = { - -- height = 0.5, - -- width = 0.5, - -- }, - }, + -- Options for fzf-lua + fzf_lua = { + -- winopts = { + -- height = 0.5, + -- width = 0.5, + -- }, + }, - -- Options for nui Menu - nui = { - position = "50%", - size = nil, - relative = "editor", - border = { - style = "rounded", - }, - buf_options = { - swapfile = false, - filetype = "DressingSelect", - }, - win_options = { - winblend = 10, - }, - max_width = 80, - max_height = 40, - min_width = 40, - min_height = 10, - }, + -- Options for nui Menu + nui = { + position = "50%", + size = nil, + relative = "editor", + border = { + style = "rounded", + }, + buf_options = { + swapfile = false, + filetype = "DressingSelect", + }, + win_options = { + winblend = 10, + }, + max_width = 80, + max_height = 40, + min_width = 40, + min_height = 10, + }, - -- Options for built-in selector - builtin = { - -- These are passed to nvim_open_win - anchor = "NW", - border = "rounded", - -- 'editor' and 'win' will default to being centered - relative = "editor", + -- Options for built-in selector + builtin = { + -- These are passed to nvim_open_win + anchor = "NW", + border = "rounded", + -- 'editor' and 'win' will default to being centered + relative = "editor", - buf_options = {}, - win_options = { - -- Window transparency (0-100) - winblend = 10, - cursorline = true, - cursorlineopt = "both", - }, + buf_options = {}, + win_options = { + -- Window transparency (0-100) + winblend = 10, + cursorline = true, + cursorlineopt = "both", + }, - -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- the min_ and max_ options can be a list of mixed types. - -- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total" - width = nil, - max_width = { 140, 0.8 }, - min_width = { 40, 0.2 }, - height = nil, - max_height = 0.9, - min_height = { 10, 0.2 }, + -- These can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- the min_ and max_ options can be a list of mixed types. + -- max_width = {140, 0.8} means "the lesser of 140 columns or 80% of total" + width = nil, + max_width = { 140, 0.8 }, + min_width = { 40, 0.2 }, + height = nil, + max_height = 0.9, + min_height = { 10, 0.2 }, - -- Set to `false` to disable - mappings = { - [""] = "Close", - [""] = "Close", - [""] = "Confirm", - }, + -- Set to `false` to disable + mappings = { + [""] = "Close", + [""] = "Close", + [""] = "Confirm", + }, - override = function(conf) - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - return conf - end, - }, + override = function(conf) + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + return conf + end, + }, - -- Used to override format_item. See :help dressing-format - format_item_override = {}, + -- Used to override format_item. See :help dressing-format + format_item_override = {}, - -- see :help dressing_get_config - get_config = nil, - }, - }, - }, - { - "kylechui/nvim-surround", - event = "BufEnter", - opts = {}, - }, - { - "romgrk/barbar.nvim", - event = "BufNew", - dependencies = { - "lewis6991/gitsigns.nvim", - "nvim-tree/nvim-web-devicons", - }, - init = function() - vim.g.barbar_auto_setup = false + -- see :help dressing_get_config + get_config = nil, + }, + }, + }, + { + "kylechui/nvim-surround", + event = "BufEnter", + opts = {}, + }, + { + "romgrk/barbar.nvim", + event = "BufNew", + dependencies = { + "lewis6991/gitsigns.nvim", + "nvim-tree/nvim-web-devicons", + }, + init = function() + vim.g.barbar_auto_setup = false - local map = vim.api.nvim_set_keymap - local opts = { noremap = true, silent = true } + local map = vim.api.nvim_set_keymap + local opts = { noremap = true, silent = true } - map("n", "", "BufferPrevious", opts) - map("n", "", "BufferNext", opts) - map("n", "", "BufferMovePrevious", opts) - map("n", ">", "BufferMoveNext", opts) - map("n", "", "BufferGoto 1", opts) - map("n", "", "BufferGoto 2", opts) - map("n", "", "BufferGoto 3", opts) - map("n", "", "BufferGoto 4", opts) - map("n", "", "BufferGoto 5", opts) - map("n", "", "BufferGoto 6", opts) - map("n", "", "BufferGoto 7", opts) - map("n", "", "BufferGoto 8", opts) - map("n", "", "BufferGoto 9", opts) - map("n", "", "BufferLast", opts) - map("n", "", "BufferPin", opts) - map("n", "", "BufferClose", opts) - map("n", "", "BufferPick", opts) - end, - opts = {}, - }, - { - "RRethy/vim-illuminate", - event = "BufEnter", - config = function() - require("illuminate").configure({ - -- providers: provider used to get references in the buffer, ordered by priority - providers = { - "lsp", - "treesitter", - "regex", - }, - -- delay: delay in milliseconds - delay = 100, - -- filetype_overrides: filetype specific overrides. - -- The keys are strings to represent the filetype while the values are tables that - -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist - filetype_overrides = {}, - -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist - filetypes_denylist = { - "dirvish", - "fugitive", - }, - -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist - filetypes_allowlist = {}, - -- modes_denylist: modes to not illuminate, this overrides modes_allowlist - -- See `:help mode()` for possible values - modes_denylist = {}, - -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist - -- See `:help mode()` for possible values - modes_allowlist = {}, - -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_denylist = {}, - -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_allowlist = {}, - -- under_cursor: whether or not to illuminate under the cursor - under_cursor = true, - -- large_file_cutoff: number of lines at which to use large_file_config - -- The `under_cursor` option is disabled when this cutoff is hit - large_file_cutoff = nil, - -- large_file_config: config to use for large files (based on large_file_cutoff). - -- Supports the same keys passed to .configure - -- If nil, vim-illuminate will be disabled for large files. - large_file_overrides = nil, - -- min_count_to_highlight: minimum number of matches required to perform highlighting - min_count_to_highlight = 1, - }) - end, - }, - { - "glepnir/dashboard-nvim", - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - event = "VimEnter", - config = function() - require("dashboard").setup({ - -- config - }) - end, - }, - { - "karb94/neoscroll.nvim", - event = "BufEnter", - opts = {}, - }, - { - "folke/lsp-colors.nvim", - dependencies = { - "neovim/nvim-lspconfig", - }, - opts = { - Error = "#db4b4b", - Warning = "#e0af68", - Information = "#0db9d7", - Hint = "#10B981", - }, - }, - { - "xiyaowong/link-visitor.nvim", - event = "BufEnter", - opts = { - open_cmd = nil, - silent = true, - skip_confirmation = true, - border = "rounded", - }, - }, - { - "numToStr/Comment.nvim", - opts = { - ---Add a space b/w comment and the line - padding = true, - ---Whether the cursor should stay at its position - sticky = true, - ---Lines to be ignored while (un)comment - ignore = nil, - ---LHS of toggle mappings in NORMAL mode - toggler = { - ---Line-comment toggle keymap - line = "gcc", - ---Block-comment toggle keymap - block = "gbc", - }, - ---LHS of operator-pending mappings in NORMAL and VISUAL mode - opleader = { - ---Line-comment keymap - line = "gc", - ---Block-comment keymap - block = "gb", - }, - ---LHS of extra mappings - extra = { - ---Add comment on the line above - above = "gcO", - ---Add comment on the line below - below = "gco", - ---Add comment at the end of line - eol = "gcA", - }, - ---Enable keybindings - ---NOTE: If given `false` then the plugin won't create any mappings - mappings = { - ---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}` - basic = true, - ---Extra mapping; `gco`, `gcO`, `gcA` - extra = true, - }, - ---Function to call before (un)comment - pre_hook = nil, - ---Function to call after (un)comment - post_hook = nil, - }, - }, - { - "folke/which-key.nvim", - event = "VeryLazy", - init = function() - vim.o.timeout = true - vim.o.timeoutlen = 0 - end, - config = function() - local whichKey = require("which-key") + map("n", "", "BufferPrevious", opts) + map("n", "", "BufferNext", opts) + map("n", "", "BufferMovePrevious", opts) + map("n", ">", "BufferMoveNext", opts) + map("n", "", "BufferGoto 1", opts) + map("n", "", "BufferGoto 2", opts) + map("n", "", "BufferGoto 3", opts) + map("n", "", "BufferGoto 4", opts) + map("n", "", "BufferGoto 5", opts) + map("n", "", "BufferGoto 6", opts) + map("n", "", "BufferGoto 7", opts) + map("n", "", "BufferGoto 8", opts) + map("n", "", "BufferGoto 9", opts) + map("n", "", "BufferLast", opts) + map("n", "", "BufferPin", opts) + map("n", "", "BufferClose", opts) + map("n", "", "BufferPick", opts) + end, + opts = {}, + }, + { + "RRethy/vim-illuminate", + event = "BufEnter", + config = function() + require("illuminate").configure({ + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + "lsp", + "treesitter", + "regex", + }, + -- delay: delay in milliseconds + delay = 100, + -- filetype_overrides: filetype specific overrides. + -- The keys are strings to represent the filetype while the values are tables that + -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist + filetype_overrides = {}, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + "dirvish", + "fugitive", + }, + -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + -- See `:help mode()` for possible values + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + -- See `:help mode()` for possible values + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + -- large_file_cutoff: number of lines at which to use large_file_config + -- The `under_cursor` option is disabled when this cutoff is hit + large_file_cutoff = nil, + -- large_file_config: config to use for large files (based on large_file_cutoff). + -- Supports the same keys passed to .configure + -- If nil, vim-illuminate will be disabled for large files. + large_file_overrides = nil, + -- min_count_to_highlight: minimum number of matches required to perform highlighting + min_count_to_highlight = 1, + }) + end, + }, + { + "glepnir/dashboard-nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + event = "VimEnter", + config = function() + require("dashboard").setup({ + -- config + }) + end, + }, + { + "karb94/neoscroll.nvim", + event = "BufEnter", + opts = {}, + }, + { + "folke/lsp-colors.nvim", + dependencies = { + "neovim/nvim-lspconfig", + }, + opts = { + Error = "#db4b4b", + Warning = "#e0af68", + Information = "#0db9d7", + Hint = "#10B981", + }, + }, + { + "xiyaowong/link-visitor.nvim", + event = "BufEnter", + opts = { + open_cmd = nil, + silent = true, + skip_confirmation = true, + border = "rounded", + }, + }, + { + "numToStr/Comment.nvim", + opts = { + ---Add a space b/w comment and the line + padding = true, + ---Whether the cursor should stay at its position + sticky = true, + ---Lines to be ignored while (un)comment + ignore = nil, + ---LHS of toggle mappings in NORMAL mode + toggler = { + ---Line-comment toggle keymap + line = "gcc", + ---Block-comment toggle keymap + block = "gbc", + }, + ---LHS of operator-pending mappings in NORMAL and VISUAL mode + opleader = { + ---Line-comment keymap + line = "gc", + ---Block-comment keymap + block = "gb", + }, + ---LHS of extra mappings + extra = { + ---Add comment on the line above + above = "gcO", + ---Add comment on the line below + below = "gco", + ---Add comment at the end of line + eol = "gcA", + }, + ---Enable keybindings + ---NOTE: If given `false` then the plugin won't create any mappings + mappings = { + ---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}` + basic = true, + ---Extra mapping; `gco`, `gcO`, `gcA` + extra = true, + }, + ---Function to call before (un)comment + pre_hook = nil, + ---Function to call after (un)comment + post_hook = nil, + }, + }, + { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + requires = { + "nvim-tree/nvim-web-devicons", + opt = true, + }, + opts = { + options = { + icons_enabled = true, + theme = "tokyonight", + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { "mode" }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { "filename" }, + lualine_x = { "encoding", "fileformat", "filetype" }, + lualine_y = { "progress" }, + lualine_z = { "location" }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { "filename" }, + lualine_x = { "location" }, + lualine_y = {}, + lualine_z = {}, + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {}, + }, + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 0 + end, + config = function() + local whichKey = require("which-key") - whichKey.register({ - ["n"] = { - name = "NvimTree", - t = { - function() - require("nvim-tree.api").tree.toggle() - end, - "Toggle", - }, - f = { - function() - require("nvim-tree.api").tree.focus() - end, - "Focus", - }, - e = { - function() - require("nvim-tree.api").tree.expand_all() - end, - "Expand", - }, - c = { - function() - require("nvim-tree.api").tree.collapse_all() - end, - "Collapse", - }, - }, - ["t"] = { - name = "Telescope", - t = { - function() - require("telescope.builtin").treesitter() - end, - "Explore the Abstract Syntax Tree", - }, - f = { - function() - require("telescope.builtin").find_files() - end, - "Find files", - }, - w = { - function() - require("telescope.builtin").live_grep() - end, - "Find words", - }, - c = { - function() - require("telescope.builtin").colorscheme() - end, - "Find color schemes", - }, - g = { - function() - require("telescope.builtin").git_files() - end, - "Find git files", - }, - l = { - name = "LSP", - e = { - function() - require("telescope.builtin").diagnostics() - end, - "List diagnostics for all open buffers", - }, - r = { - function() - require("telescope.builtin").lsp_references() - end, - "List all references for the word under the cursor", - }, - i = { - function() - require("telescope.builtin").lsp_implementation() - end, - "Go to the implementation of the word under the cursor", - }, - d = { - function() - require("telescope.builtin").lsp_definition() - end, - "Go to the definition of the word under the cursor", - }, - t = { - function() - require("telescope.builtin").lsp_type_definition() - end, - "Go to the type definition of the word under the cursor", - }, - }, - }, - ["v"] = { - name = "Visit link", - v = { - function() - require("link-visitor").visit() - end, - "Visit", - }, - l = { - function() - require("link-visitor").link_under_cursor() - end, - "Under cursor", - }, - n = { - function() - require("link-visitor").link_near_cursor() - end, - "Near cursor", - }, - N = { - function() - require("link-visitor").link_nearest() - end, - "Near cursor", - }, - }, - }) - end, - }, + whichKey.register({ + ["n"] = { + name = "NvimTree", + t = { + function() + require("nvim-tree.api").tree.toggle() + end, + "Toggle", + }, + f = { + function() + require("nvim-tree.api").tree.focus() + end, + "Focus", + }, + e = { + function() + require("nvim-tree.api").tree.expand_all() + end, + "Expand", + }, + c = { + function() + require("nvim-tree.api").tree.collapse_all() + end, + "Collapse", + }, + }, + ["t"] = { + name = "Telescope", + t = { + function() + require("telescope.builtin").treesitter() + end, + "Explore the Abstract Syntax Tree", + }, + f = { + function() + require("telescope.builtin").find_files() + end, + "Find files", + }, + w = { + function() + require("telescope.builtin").live_grep() + end, + "Find words", + }, + c = { + function() + require("telescope.builtin").colorscheme() + end, + "Find color schemes", + }, + g = { + function() + require("telescope.builtin").git_files() + end, + "Find git files", + }, + l = { + name = "LSP", + e = { + function() + require("telescope.builtin").diagnostics() + end, + "List diagnostics for all open buffers", + }, + r = { + function() + require("telescope.builtin").lsp_references() + end, + "List all references for the word under the cursor", + }, + i = { + function() + require("telescope.builtin").lsp_implementation() + end, + "Go to the implementation of the word under the cursor", + }, + d = { + function() + require("telescope.builtin").lsp_definition() + end, + "Go to the definition of the word under the cursor", + }, + t = { + function() + require("telescope.builtin").lsp_type_definition() + end, + "Go to the type definition of the word under the cursor", + }, + }, + }, + ["v"] = { + name = "Visit link", + v = { + function() + require("link-visitor").visit() + end, + "Visit", + }, + l = { + function() + require("link-visitor").link_under_cursor() + end, + "Under cursor", + }, + n = { + function() + require("link-visitor").link_near_cursor() + end, + "Near cursor", + }, + N = { + function() + require("link-visitor").link_nearest() + end, + "Near cursor", + }, + }, + }) + end, + }, })