diff --git a/.config/nvim/lua/plugins/auto-session.lua b/.config/nvim/lua/plugins/auto-session.lua index dca8b91..b755e3a 100644 --- a/.config/nvim/lua/plugins/auto-session.lua +++ b/.config/nvim/lua/plugins/auto-session.lua @@ -1,24 +1,25 @@ return { - "rmagatti/auto-session", - lazy = false, + 'rmagatti/auto-session', + -- lazy = false, + event = 'VeryLazy', - ---@module "auto-session" - ---@type AutoSession.Config - opts = { - auto_save = true, - auto_restore = false, -- don't auto restore the last session - session_lens = { - load_on_setup = true, - previewer = false, + ---@module "auto-session" + ---@type AutoSession.Config + opts = { + auto_save = true, + auto_restore = false, -- don't auto restore the last session + session_lens = { + load_on_setup = true, + previewer = false, - mappings = { - delete_session = { "i", "" }, - alternate_session = { "i", "" }, - copy_session = { "i", "" }, - }, + mappings = { + delete_session = { 'i', '' }, + alternate_session = { 'i', '' }, + copy_session = { 'i', '' }, }, - bypass_save_filetypes = { "alpha", "dashboard" }, -- don't save dashboard/greeter to a session - -- Folders listed here will not have sessions created within. - suppress_dirs = { "~/", "~/Downloads", "~/Documents", "~/Desktop", "/" }, - }, -} + }, + bypass_save_filetypes = { 'alpha', 'dashboard' }, -- don't save dashboard/greeter to a session + -- Folders listed here will not have sessions created within. + suppress_dirs = { '~/', '~/Downloads', '~/Documents', '~/Desktop', '/' }, + }, +} \ No newline at end of file diff --git a/.config/nvim/lua/plugins/bufferline.lua b/.config/nvim/lua/plugins/bufferline.lua index cc90baf..8409701 100644 --- a/.config/nvim/lua/plugins/bufferline.lua +++ b/.config/nvim/lua/plugins/bufferline.lua @@ -1,65 +1,58 @@ return { - "akinsho/bufferline.nvim", - dependencies = { "nvim-tree/nvim-web-devicons" }, - version = "*", - opts = { - options = { - mode = "buffer", - separator_style = "slant", - diagnostics = "nvim_lsp", - -- diagnostics_indicator = function(count, level, diagnostics_dict, context) - -- local s = " " - -- for e, n in pairs(diagnostics_dict) do - -- local sym = e == "error" and " " or (e == "warning" and " " or " ") - -- s = s .. n .. sym - -- end - -- return s - -- end, - always_show_bufferline = false, - show_tab_indicators = false, - color_icons = true, - show_buffer_icons = true, - persist_buffer_sort = true, - indicator = { - style = "underline", - }, - offsets = { - { - filetype = "NvimTree", - text = function() - return vim.fn.getcwd() - end, - highlight = "Directory", - separator = true, - }, - }, - custom_areas = { - right = function() - local result = {} - local seve = vim.diagnostic.severity - local error = #vim.diagnostic.get(0, { severity = seve.ERROR }) - local warning = #vim.diagnostic.get(0, { severity = seve.WARN }) - local info = #vim.diagnostic.get(0, { severity = seve.INFO }) - local hint = #vim.diagnostic.get(0, { severity = seve.HINT }) - - if error ~= 0 then - table.insert(result, { text = "  " .. error, link = "DiagnosticError" }) - end - - if warning ~= 0 then - table.insert(result, { text = "  " .. warning, link = "DiagnosticWarn" }) - end - - if hint ~= 0 then - table.insert(result, { text = "  " .. hint, link = "DiagnosticHint" }) - end - - if info ~= 0 then - table.insert(result, { text = "  " .. info, link = "DiagnosticInfo" }) - end - return result - end, - }, + 'akinsho/bufferline.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + version = '*', + event = 'VeryLazy', + opts = { + options = { + mode = 'buffer', + separator_style = 'slant', + diagnostics = 'nvim_lsp', + -- diagnostics_indicator = function(count, level, diagnostics_dict, context) + -- local s = " " + -- for e, n in pairs(diagnostics_dict) do + -- local sym = e == "error" and " " or (e == "warning" and " " or " ") + -- s = s .. n .. sym + -- end + -- return s + -- end, + always_show_bufferline = false, + show_tab_indicators = false, + color_icons = true, + show_buffer_icons = true, + persist_buffer_sort = true, + indicator = { + style = 'underline', }, - }, + offsets = { + { + filetype = 'NvimTree', + text = function() + return vim.fn.getcwd() + end, + highlight = 'Directory', + separator = true, + }, + }, + custom_areas = { + right = function() + local result = {} + local seve = vim.diagnostic.severity + local error = #vim.diagnostic.get(0, { severity = seve.ERROR }) + local warning = #vim.diagnostic.get(0, { severity = seve.WARN }) + local info = #vim.diagnostic.get(0, { severity = seve.INFO }) + local hint = #vim.diagnostic.get(0, { severity = seve.HINT }) + + if error ~= 0 then table.insert(result, { text = '  ' .. error, link = 'DiagnosticError' }) end + + if warning ~= 0 then table.insert(result, { text = '  ' .. warning, link = 'DiagnosticWarn' }) end + + if hint ~= 0 then table.insert(result, { text = '  ' .. hint, link = 'DiagnosticHint' }) end + + if info ~= 0 then table.insert(result, { text = '  ' .. info, link = 'DiagnosticInfo' }) end + return result + end, + }, + }, + }, } diff --git a/.config/nvim/lua/plugins/colorizer.lua b/.config/nvim/lua/plugins/colorizer.lua index 10401cc..e340e76 100644 --- a/.config/nvim/lua/plugins/colorizer.lua +++ b/.config/nvim/lua/plugins/colorizer.lua @@ -1,17 +1,24 @@ return { - "norcalli/nvim-colorizer.lua", - - config = function() - local colorizer = require "colorizer" - - colorizer.setup { - "css", - "javascript", - "python", - "json", - "lua", - "toml", - "yaml", - } - end, + 'norcalli/nvim-colorizer.lua', + -- event = { 'BufEnter', 'BufNewFile' }, + ft = { + 'markdown', + 'javascript', + 'css', + 'python', + 'json', + 'lua', + 'toml', + 'yaml', + }, + opts = { + 'css', + 'javascript', + 'markdown', + 'python', + 'json', + 'lua', + 'toml', + 'yaml', + }, } diff --git a/.config/nvim/lua/plugins/comment-box.lua b/.config/nvim/lua/plugins/comment-box.lua index add1212..0c55bcf 100644 --- a/.config/nvim/lua/plugins/comment-box.lua +++ b/.config/nvim/lua/plugins/comment-box.lua @@ -1,8 +1,8 @@ return { - "LudoPinelli/comment-box.nvim", - lazy = true, - keys = { - { "Cb", "CBllbox19", desc = "Insert a default comment box" }, - { "Cl", "CBccline6", desc = "Insert a default comment line" }, - }, + 'LudoPinelli/comment-box.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + keys = { + { 'Cb', 'CBllbox19', desc = 'Insert a default comment box' }, + { 'Cl', 'CBccline6', desc = 'Insert a default comment line' }, + }, } diff --git a/.config/nvim/lua/plugins/disabled.lua b/.config/nvim/lua/plugins/disabled.lua index 09d2c40..dfa9ed5 100644 --- a/.config/nvim/lua/plugins/disabled.lua +++ b/.config/nvim/lua/plugins/disabled.lua @@ -1,26 +1,26 @@ return { - { - "ThePrimeagen/harpoon", - enabled = false, - }, - { - "tadmccorkle/markdown.nvim", - enabled = false, - }, - { - "OXY2DEV/markview.nvim", - enabled = false, - }, - { - "jakewvincent/mkdnflow.nvim", - enabled = false, - }, - { - "willothy/moveline.nvim", - enabled = false, - }, - { - "MeanderingProgrammer/render-markdown.nvim", - enabled = false, - }, + { + 'ThePrimeagen/harpoon', + enabled = false, + }, + { + 'tadmccorkle/markdown.nvim', + enabled = false, + }, + { + 'OXY2DEV/markview.nvim', + enabled = false, + }, + { + 'jakewvincent/mkdnflow.nvim', + enabled = false, + }, + { + 'willothy/moveline.nvim', + enabled = false, + }, + { + 'MeanderingProgrammer/render-markdown.nvim', + enabled = false, + }, } \ No newline at end of file diff --git a/.config/nvim/lua/plugins/dressing.lua b/.config/nvim/lua/plugins/dressing.lua index d5f9379..4c56252 100644 --- a/.config/nvim/lua/plugins/dressing.lua +++ b/.config/nvim/lua/plugins/dressing.lua @@ -1,5 +1,36 @@ return { - "stevearc/dressing.nvim", - event = "VeryLazy", - opts = {}, -} + 'stevearc/dressing.nvim', + dependencies = { + 'nvim-telescope/telescope.nvim', + }, + event = 'VeryLazy', + opts = { + input = { + enabled = true, + -- default_prompt = 'Prompt', + prompt_align = 'left', + insert_only = false, + start_in_insert = true, + border = 'rounded', + relative = 'cursor', + prefer_width = 0.4, + mappings = { + n = { + [''] = 'Close', + ['q'] = 'Close', + [''] = 'Confirm', + }, + i = { + [''] = 'Close', + [''] = 'Confirm', + [''] = 'HistoryPrev', + [''] = 'HistoryNext', + }, + }, + override = function(conf) + return conf + end, + }, + select = {}, + }, +} \ No newline at end of file diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua index fce9396..b36d74f 100644 --- a/.config/nvim/lua/plugins/gitsigns.lua +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -1,69 +1,69 @@ return { - "lewis6991/gitsigns.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - { - "purarue/gitsigns-yadm.nvim", - opts = { - shell_timeout_ms = 2000, - }, + "lewis6991/gitsigns.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + { + "purarue/gitsigns-yadm.nvim", + opts = { + shell_timeout_ms = 2000, }, - }, - event = { "BufReadPre", "BufNewFile" }, - opts = { - _on_attach_pre = function(_, callback) - if vim.fn.executable "yadm" == 1 then - require("gitsigns-yadm").yadm_signs(callback) - else - callback() - end - end, - 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 = "~" }, - untracked = { text = "┆" }, - }, - signs_staged_enable = true, - signcolumn = true, - numhl = true, - linehl = false, - word_diff = true, - show_deleted = false, -- turning this off for now as it seems to be slowing down neovim on MBP - watch_gitdir = { - interval = 1000, - follow_files = true, - }, - attach_to_untracked = false, - current_line_blame = true, - current_line_blame_opts = { - use_focus = true, - virt_text = true, - virt_text_pos = "right_align", - delay = 200, - ignore_whitespace = false, - }, - current_line_blame_formatter = ", - ", - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, - preview_config = { - border = "single", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - }, - }, + }, + }, + event = { "BufReadPre", "BufNewFile" }, + opts = { + _on_attach_pre = function(_, callback) + if vim.fn.executable("yadm") == 1 then + require("gitsigns-yadm").yadm_signs(callback) + else + callback() + end + end, + 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 = "~" }, + untracked = { text = "┆" }, + }, + signs_staged_enable = true, + signcolumn = true, + numhl = true, + linehl = false, + word_diff = true, + show_deleted = false, -- turning this off for now as it seems to be slowing down neovim on MBP + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = false, + current_line_blame = true, + current_line_blame_opts = { + use_focus = true, + virt_text = true, + virt_text_pos = "right_align", + delay = 200, + ignore_whitespace = false, + }, + current_line_blame_formatter = ", - ", + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, + preview_config = { + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + }, } diff --git a/.config/nvim/lua/plugins/harpoon.lua b/.config/nvim/lua/plugins/harpoon.lua index a54c30e..4a1b1e8 100644 --- a/.config/nvim/lua/plugins/harpoon.lua +++ b/.config/nvim/lua/plugins/harpoon.lua @@ -1,59 +1,60 @@ return { - "ThePrimeagen/harpoon", - branch = "harpoon2", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-telescope/telescope.nvim", - }, + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope.nvim', + }, + event = 'VeryLazy', - config = function() - local harpoon = require("harpoon") - local map = vim.keymap + config = function() + local harpoon = require('harpoon') + local map = vim.keymap - harpoon:setup() + harpoon:setup() - local conf = require("telescope.config").values - local function toggle_telescope(harpoon_files) - local file_paths = {} - for _, item in ipairs(harpoon_files.items) do - table.insert(file_paths, item.value) - end - - require("telescope.pickers") - .new({}, { - prompt_title = "Harpoon", - finder = require("telescope.finders").new_table({ - results = file_paths, - }), - previewer = conf.file_previewer({}), - sorter = conf.generic_sorter({}), - }) - :find() + local conf = require('telescope.config').values + local function toggle_telescope(harpoon_files) + local file_paths = {} + for _, item in ipairs(harpoon_files.items) do + table.insert(file_paths, item.value) end - map.set("n", "a", function() - harpoon:list():add() - end, { desc = "Harpoon this" }) - map.set("n", "", function() - toggle_telescope(harpoon:list()) - end, { desc = "Harpoon UI" }) - map.set("n", "", function() - harpoon:list():select(1) - end, { desc = "Mark 1" }) - map.set("n", "", function() - harpoon:list():select(2) - end, { desc = "Mark 2" }) - map.set("n", "", function() - harpoon:list():select(3) - end, { desc = "Mark 3" }) - map.set("n", "", function() - harpoon:list():select(4) - end, { desc = "Mark 4" }) - map.set("n", "", function() - harpoon:list():prev() - end, { desc = "Cycle back" }) - map.set("n", "", function() - harpoon:list():next() - end, { desc = "Cycle forward" }) - end, -} \ No newline at end of file + require('telescope.pickers') + .new({}, { + prompt_title = 'Harpoon', + finder = require('telescope.finders').new_table({ + results = file_paths, + }), + previewer = conf.file_previewer({}), + sorter = conf.generic_sorter({}), + }) + :find() + end + + map.set('n', 'a', function() + harpoon:list():add() + end, { desc = 'Harpoon this' }) + map.set('n', '', function() + toggle_telescope(harpoon:list()) + end, { desc = 'Harpoon UI' }) + map.set('n', '', function() + harpoon:list():select(1) + end, { desc = 'Mark 1' }) + map.set('n', '', function() + harpoon:list():select(2) + end, { desc = 'Mark 2' }) + map.set('n', '', function() + harpoon:list():select(3) + end, { desc = 'Mark 3' }) + map.set('n', '', function() + harpoon:list():select(4) + end, { desc = 'Mark 4' }) + map.set('n', '', function() + harpoon:list():prev() + end, { desc = 'Cycle back' }) + map.set('n', '', function() + harpoon:list():next() + end, { desc = 'Cycle forward' }) + end, +} diff --git a/.config/nvim/lua/plugins/icon-picker.lua b/.config/nvim/lua/plugins/icon-picker.lua index 344d407..6f67a43 100644 --- a/.config/nvim/lua/plugins/icon-picker.lua +++ b/.config/nvim/lua/plugins/icon-picker.lua @@ -1,9 +1,10 @@ return { - "ziontee113/icon-picker.nvim", - dependencies = { - "stevearc/dressing.nvim", - }, - opts = { - disable_legacy_commands = true, - }, + 'ziontee113/icon-picker.nvim', + dependencies = { + 'stevearc/dressing.nvim', + }, + event = { 'BufReadPre', 'BufNewFile' }, + opts = { + disable_legacy_commands = true, + }, } \ No newline at end of file diff --git a/.config/nvim/lua/plugins/illuminate.lua b/.config/nvim/lua/plugins/illuminate.lua index 8ab29a0..2a9543d 100644 --- a/.config/nvim/lua/plugins/illuminate.lua +++ b/.config/nvim/lua/plugins/illuminate.lua @@ -1,25 +1,26 @@ return { - "RRethy/vim-illuminate", - event = { "BufReadPre", "BufNewFile" }, - opts = { - providers = { - "lsp", - "treesitter", - "regex", - }, - delay = 100, - filetypes_denylist = { - "help", - "man", - "markdown", - "md", - }, - under_cursor = true, - min_count_to_highlight = 1, - case_insensitive_regex = false, - }, + 'RRethy/vim-illuminate', + event = { 'BufReadPre', 'BufNewFile' }, + opts = { + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + delay = 100, + filetypes_denylist = { + 'NvimTree', + 'help', + 'man', + 'markdown', + 'md', + }, + under_cursor = true, + min_count_to_highlight = 1, + case_insensitive_regex = false, + }, - config = function(_, opts) - require("illuminate").configure(opts) - end, -} + config = function(_, opts) + require('illuminate').configure(opts) + end, +} \ No newline at end of file diff --git a/.config/nvim/lua/plugins/lsp/lspconfig.lua b/.config/nvim/lua/plugins/lsp/lspconfig.lua index ad76418..5032fe6 100644 --- a/.config/nvim/lua/plugins/lsp/lspconfig.lua +++ b/.config/nvim/lua/plugins/lsp/lspconfig.lua @@ -1,109 +1,131 @@ return { - "neovim/nvim-lspconfig", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "hrsh7th/cmp-nvim-lsp", - { "antosha417/nvim-lsp-file-operations", config = true }, - { "folke/neodev.nvim", opts = {} }, - }, + 'neovim/nvim-lspconfig', + event = { 'BufReadPost', 'BufNewFile' }, + dependencies = { + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + 'hrsh7th/cmp-nvim-lsp', + { 'antosha417/nvim-lsp-file-operations', config = true }, + { 'folke/neodev.nvim', config = true }, + }, - config = function() - local lspconfig = require "lspconfig" - local mason_lspconfig = require "mason-lspconfig" - local cmp_nvim_lsp = require "cmp_nvim_lsp" - local keymap = vim.keymap + config = function() + local lspconfig = require('lspconfig') + local mason_lspconfig = require('mason-lspconfig') + local cmp_nvim_lsp = require('cmp_nvim_lsp') + local keymap = vim.keymap - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("UserLspConfig", {}), - callback = function(ev) - local opts = { buffer = ev.buf, silent = true } + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + local opts = { buffer = ev.buf, silent = true } - opts.desc = "Show LSP references" - keymap.set("n", "gR", "Telescope lsp_references", opts) + opts.desc = 'Show LSP references' + keymap.set('n', 'gR', 'Telescope lsp_references', opts) - opts.desc = "Go to declaration" - keymap.set("n", "gD", vim.lsp.buf.declaration, opts) + opts.desc = 'Go to declaration' + keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) - opts.desc = "Show LSP definitions" - keymap.set("n", "gd", "Telescope lsp_definitions", opts) + opts.desc = 'Show LSP definitions' + keymap.set('n', 'gd', 'Telescope lsp_definitions', opts) - opts.desc = "Show LSP implementations" - keymap.set("n", "gi", "Telescope lsp_implementations", opts) + opts.desc = 'Show LSP implementations' + keymap.set('n', 'gi', 'Telescope lsp_implementations', opts) - opts.desc = "Show LSP type definitions" - keymap.set("n", "gt", "Telescope lsp_type_definitions", opts) + opts.desc = 'Show LSP type definitions' + keymap.set('n', 'gt', 'Telescope lsp_type_definitions', opts) - opts.desc = "See available code actions" - keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, opts) + opts.desc = 'See available code actions' + keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) - opts.desc = "Smart rename" - keymap.set("n", "rn", vim.lsp.buf.rename, opts) + opts.desc = 'Smart rename' + keymap.set('n', 'rn', vim.lsp.buf.rename, opts) - opts.desc = "Show buffer diagnostics" - keymap.set("n", "D", "Telescope diagnostics bufnf=0", opts) + opts.desc = 'Show buffer diagnostics' + keymap.set('n', 'D', 'Telescope diagnostics bufnf=0', opts) - opts.desc = "Show line diagnostics" - keymap.set("n", "d", vim.diagnostic.open_float, opts) + opts.desc = 'Show line diagnostics' + keymap.set('n', 'd', vim.diagnostic.open_float, opts) - opts.desc = "Go to previous diagnostic" - keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) + opts.desc = 'Go to previous diagnostic' + keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) - opts.desc = "Go to next diagnostic" - keymap.set("n", "]d", vim.diagnostic.goto_next, opts) + opts.desc = 'Go to next diagnostic' + keymap.set('n', ']d', vim.diagnostic.goto_next, opts) - opts.desc = "Show documentation for what is under cursor" - keymap.set("n", "K", vim.lsp.buf.hover, opts) + opts.desc = 'Show documentation for what is under cursor' + keymap.set('n', 'K', vim.lsp.buf.hover, opts) - opts.desc = "Restart LSP" - keymap.set("n", "rs", ":LspRestart", opts) - end, - }) + opts.desc = 'Restart LSP' + keymap.set('n', 'rs', ':LspRestart', opts) + end, + }) - local capabilities = cmp_nvim_lsp.default_capabilities() + local capabilities = cmp_nvim_lsp.default_capabilities() - local signs = { Error = " ", Warn = " ", Hint = "󰠠 ", Info = " " } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) - end + local signs = { Error = ' ', Warn = ' ', Hint = '󰠠 ', Info = ' ' } + for type, icon in pairs(signs) do + local hl = 'DiagnosticSign' .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = '' }) + end - mason_lspconfig.setup_handlers { - -- default handler for installed servers - function(server_name) - lspconfig[server_name].setup { - capabilities = capabilities, - } - end, - ["emmet_ls"] = function() - -- configure emmet language server - lspconfig["emmet_ls"].setup { - capabilities = capabilities, - filetypes = { "html", "typescriptreact", "javascriptreact", "css", "sass", "scss", "less", "svelte" }, - } - end, - ["bashls"] = function() - lspconfig["bashls"].setup { - capabilities = capabilities, - filetypes = { "sh", "zsh" }, - } - end, - ["lua_ls"] = function() - -- configure lua server (with special settings) - lspconfig["lua_ls"].setup { - capabilities = capabilities, - settings = { - Lua = { - -- make the language server recognize "vim" global - diagnostics = { - globals = { "vim" }, - }, - completion = { - callSnippet = "Replace", - }, - }, - }, - } - end, - } - end, -} + mason_lspconfig.setup_handlers({ + -- default handler for installed servers + function(server_name) + lspconfig[server_name].setup({ + capabilities = capabilities, + }) + end, + ['emmet_ls'] = function() + -- configure emmet language server + lspconfig['emmet_ls'].setup({ + capabilities = capabilities, + filetypes = { 'html', 'typescriptreact', 'javascriptreact', 'css', 'sass', 'scss', 'less', 'svelte' }, + }) + end, + ['bashls'] = function() + lspconfig['bashls'].setup({ + capabilities = capabilities, + filetypes = { 'sh', 'zsh' }, + }) + end, + ['lua_ls'] = function() + -- configure lua server (with special settings) + lspconfig['lua_ls'].setup({ + capabilities = capabilities, + settings = { + Lua = { + -- make the language server recognize "vim" global + diagnostics = { + globals = { 'vim' }, + }, + completion = { + callSnippet = 'Replace', + }, + }, + }, + }) + end, + }) + + vim.diagnostic.config({ + virtual_text = { + prefix = '●', + }, + signs = { + active = signs, + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focusable = false, + style = 'minimal', + border = 'rounded', + source = true, + show_header = true, + prefix = '', + }, + }) + end, +} \ No newline at end of file diff --git a/.config/nvim/lua/plugins/lsp/mason.lua b/.config/nvim/lua/plugins/lsp/mason.lua index 217626a..aca8c1e 100644 --- a/.config/nvim/lua/plugins/lsp/mason.lua +++ b/.config/nvim/lua/plugins/lsp/mason.lua @@ -1,68 +1,72 @@ return { - "williamboman/mason.nvim", - dependencies = { - "williamboman/mason-lspconfig.nvim", - "WhoIsSethDaniel/mason-tool-installer.nvim", - }, + 'williamboman/mason.nvim', + dependencies = { + 'williamboman/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', + }, + event = 'VeryLazy', + build = ':MasonUpdate', - config = function() - local mason = require "mason" - local mason_lspconfig = require "mason-lspconfig" - local mason_tool_installer = require "mason-tool-installer" + config = function() + local mason = require('mason') + local mason_lspconfig = require('mason-lspconfig') + local mason_tool_installer = require('mason-tool-installer') - mason.setup { - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗", - }, - }, - } + mason.setup({ + ui = { + -- style = 'minimal', + border = 'rounded', + icons = { + package_installed = '✓', + package_pending = '➜', + package_uninstalled = '✗', + }, + }, + }) - mason_lspconfig.setup { - ensure_installed = { - "ansiblels", - "bashls", - "css_variables", - "cssls", - "cssmodules_ls", - "docker_compose_language_service", - "dockerls", - "emmet_ls", - "eslint", - "html", - "jinja_lsp", - "jsonls", - "lua_ls", - "markdown_oxide", - "marksman", - "pylsp", - "vimls", - "yamlls", - }, - } + mason_lspconfig.setup({ + ensure_installed = { + 'ansiblels', + 'bashls', + 'css_variables', + 'cssls', + 'cssmodules_ls', + 'docker_compose_language_service', + 'dockerls', + 'emmet_ls', + 'eslint', + 'html', + 'jinja_lsp', + 'jsonls', + 'lua_ls', + 'markdown_oxide', + 'marksman', + 'pylsp', + 'vimls', + 'yamlls', + }, + }) - mason_tool_installer.setup { - ensure_installed = { - "ansible-lint", - "beautysh", - "black", - "eslint_d", - "gitlint", - "htmlhint", - "isort", - "jinja_lsp", - "jsonlint", - "markdownlint", - "prettier", - "pylint", - "shellcheck", - "shellharden", - "stylua", - "trivy", - "yamllint", - }, - } - end, + mason_tool_installer.setup({ + ensure_installed = { + 'ansible-lint', + 'beautysh', + 'black', + 'eslint_d', + 'gitlint', + 'htmlhint', + 'isort', + 'jinja_lsp', + 'jsonlint', + 'markdownlint', + 'prettier', + 'pylint', + 'shellcheck', + 'shellharden', + 'stylua', + 'trivy', + 'yamllint', + }, + }) + end, } diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index f7d95e0..8d7bd2d 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -4,16 +4,25 @@ return { "nvim-tree/nvim-web-devicons", "rmehri01/onenord.nvim", }, + event = "VeryLazy", config = function() local lualine = require("lualine") local lazy_status = require("lazy.status") local custom_components = { + -- ┌ + -- │ do not show encoding if UTF-8 + -- │ from https://github.com/wookayin/dotfiles/blob/master/nvim/lua/config/statusline.lua + -- └ encoding = function() local ret, _ = (vim.bo.fenc or vim.go.enc):gsub("^utf%-8$", "") return ret end, + -- ┌ + -- │ only show non-unix file format + -- │ from https://github.com/wookayin/dotfiles/blob/master/nvim/lua/config/statusline.lua + -- └ fileformat = function() local ret, _ = vim.bo.fileformat:gsub("^unix$", "") return ret diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua index defbc91..8cecee8 100644 --- a/.config/nvim/lua/plugins/nvim-tree.lua +++ b/.config/nvim/lua/plugins/nvim-tree.lua @@ -1,97 +1,98 @@ return { - "nvim-tree/nvim-tree.lua", - dependencies = "nvim-tree/nvim-web-devicons", - opts = { - respect_buf_cwd = false, - view = { - width = 35, - relativenumber = true, - signcolumn = "yes", + 'nvim-tree/nvim-tree.lua', + dependencies = 'nvim-tree/nvim-web-devicons', + event = 'VeryLazy', + opts = { + respect_buf_cwd = false, + view = { + width = 35, + relativenumber = true, + signcolumn = 'yes', + }, + renderer = { + indent_markers = { + enable = true, }, - renderer = { - indent_markers = { + icons = { + web_devicons = { + file = { enable = true, - }, - icons = { - web_devicons = { - file = { - enable = true, - color = true, - }, - folder = { - enable = true, - color = true, - }, - }, - git_placement = "after", - modified_placement = "after", - diagnostics_placement = "signcolumn", - padding = " ", - show = { - file = true, - folder = true, - folder_arrow = true, - git = true, - modified = true, - hidden = false, - diagnostics = true, - bookmarks = true, - }, - glyphs = { - default = "", - modified = "●", - folder = { - default = "", - open = "", - empty = "", - empty_open = "", - arrow_closed = "", -- arrow when folder is closed - arrow_open = "", -- arrow when folder is open - }, - git = { - unstaged = "✗", - staged = "✓", - unmerged = "", - renamed = "➜", - untracked = "★", - deleted = "", - ignored = "◌", - }, - }, - }, + color = true, + }, + folder = { + enable = true, + color = true, + }, + }, + git_placement = 'after', + modified_placement = 'after', + diagnostics_placement = 'signcolumn', + padding = ' ', + show = { + file = true, + folder = true, + folder_arrow = true, + git = true, + modified = true, + hidden = false, + diagnostics = true, + bookmarks = true, + }, + glyphs = { + default = '', + modified = '●', + folder = { + default = '', + open = '', + empty = '', + empty_open = '', + arrow_closed = '', -- arrow when folder is closed + arrow_open = '', -- arrow when folder is open + }, + git = { + unstaged = '✗', + staged = '✓', + unmerged = '', + renamed = '➜', + untracked = '★', + deleted = '', + ignored = '◌', + }, + }, }, - actions = { - open_file = { - window_picker = { - enable = false, - }, - }, + }, + actions = { + open_file = { + window_picker = { + enable = false, + }, }, - filters = { - enable = true, - git_ignored = true, - dotfiles = false, - custom = { ".DS_Store" }, - }, - git = { - enable = true, - show_on_dirs = true, - ignore = false, - }, - diagnostics = { - enable = true, - show_on_open_dirs = true, - }, - modified = { - enable = true, - show_on_dirs = true, - show_on_open_dirs = true, - }, - }, + }, + filters = { + enable = true, + git_ignored = true, + dotfiles = false, + custom = { '.DS_Store' }, + }, + git = { + enable = true, + show_on_dirs = true, + ignore = false, + }, + diagnostics = { + enable = true, + show_on_open_dirs = true, + }, + modified = { + enable = true, + show_on_dirs = true, + show_on_open_dirs = true, + }, + }, - config = function(_, opts) - vim.g.loaded_netrwPlugin = 1 + config = function(_, opts) + vim.g.loaded_netrwPlugin = 1 - require("nvim-tree").setup(opts) - end, -} + require('nvim-tree').setup(opts) + end, +} \ No newline at end of file diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index c549266..2fb4409 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -1,44 +1,45 @@ return { - "nvim-telescope/telescope.nvim", - branch = "0.1.x", + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', dependencies = { - "nvim-lua/plenary.nvim", - { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, - "nvim-tree/nvim-web-devicons", - "folke/todo-comments.nvim", + 'nvim-lua/plenary.nvim', + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + 'nvim-tree/nvim-web-devicons', + 'folke/todo-comments.nvim', }, + event = 'VeryLazy', config = function() - local telescope = require("telescope") - local actions = require("telescope.actions") - local transform_mod = require("telescope.actions.mt").transform_mod - local trouble = require("trouble") - local trouble_telescope = require("trouble.sources.telescope") + local telescope = require('telescope') + local actions = require('telescope.actions') + local transform_mod = require('telescope.actions.mt').transform_mod + local trouble = require('trouble') + local trouble_telescope = require('trouble.sources.telescope') local custom_actions = transform_mod({ open_trouble_qflist = function(prompt_bufnr) - trouble.toggle("quickfix") + trouble.toggle('quickfix') end, }) telescope.setup({ defaults = { - path_display = { "smart" }, + path_display = { 'smart' }, mappings = { n = { - ["x"] = actions.delete_buffer, - ["q"] = actions.close, + ['x'] = actions.delete_buffer, + ['q'] = actions.close, }, i = { - [""] = actions.move_selection_previous, - [""] = actions.move_selection_next, - [""] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist, - [""] = trouble_telescope.open, - [""] = actions.close, + [''] = actions.move_selection_previous, + [''] = actions.move_selection_next, + [''] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist, + [''] = trouble_telescope.open, + [''] = actions.close, }, }, }, }) - telescope.load_extension("fzf") + telescope.load_extension('fzf') end, -} \ No newline at end of file +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua index f5d7eb3..ddf2a2b 100644 --- a/.config/nvim/lua/plugins/trouble.lua +++ b/.config/nvim/lua/plugins/trouble.lua @@ -1,11 +1,11 @@ return { - "folke/trouble.nvim", - dependencies = { - "nvim-tree/nvim-web-devicons", - "folke/todo-comments.nvim", - }, - opts = { - focus = true, - }, - cmd = "Trouble", -} + 'folke/trouble.nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + 'folke/todo-comments.nvim', + }, + cmd = 'Trouble', + opts = { + focus = true, + }, +} \ No newline at end of file diff --git a/.config/nvim/lua/plugins/twilight.lua b/.config/nvim/lua/plugins/twilight.lua index 13bfab7..4159b76 100644 --- a/.config/nvim/lua/plugins/twilight.lua +++ b/.config/nvim/lua/plugins/twilight.lua @@ -1,14 +1,15 @@ return { - "folke/twilight.nvim", - opts = { - context = 10, - treesitter = true, - expand = { - "function", - "method", - "table", - "if_statement", - }, - exclude = {}, -- filetypes to excluise - }, -} + 'folke/twilight.nvim', + lazy = true, + opts = { + context = 10, + treesitter = true, + expand = { + 'function', + 'method', + 'table', + 'if_statement', + }, + exclude = {}, -- filetypes to excluise + }, +} \ No newline at end of file diff --git a/.config/nvim/lua/plugins/vim-be-good.lua b/.config/nvim/lua/plugins/vim-be-good.lua index 6ef7bd0..58fda06 100644 --- a/.config/nvim/lua/plugins/vim-be-good.lua +++ b/.config/nvim/lua/plugins/vim-be-good.lua @@ -1,3 +1,4 @@ return { - "ThePrimeagen/vim-be-good", + 'ThePrimeagen/vim-be-good', + cmd = 'VimBeGood', } diff --git a/.config/nvim/lua/plugins/vim-maximizer.lua b/.config/nvim/lua/plugins/vim-maximizer.lua index 11212cf..e1bde99 100644 --- a/.config/nvim/lua/plugins/vim-maximizer.lua +++ b/.config/nvim/lua/plugins/vim-maximizer.lua @@ -1,3 +1,4 @@ return { - "szw/vim-maximizer", + 'szw/vim-maximizer', + event = { 'BufReadPre', 'BufNewFile' }, } diff --git a/.config/nvim/lua/plugins/zen-mode.lua b/.config/nvim/lua/plugins/zen-mode.lua index 55e91c7..29514fe 100644 --- a/.config/nvim/lua/plugins/zen-mode.lua +++ b/.config/nvim/lua/plugins/zen-mode.lua @@ -1,21 +1,25 @@ return { - "folke/zen-mode.nvim", - opts = { - window = { signcolumn = false }, - plugins = { - options = { enabled = true }, - twilight = { enabled = true }, - gitsigns = { enabled = true }, - tmux = { enabled = true }, - todo = { enabled = true }, - alacritty = { - enabled = true, - font = "16", - }, - kitty = { - enabled = true, - font = "+4", - }, + 'folke/zen-mode.nvim', + dependencies = { + 'folke/twilight.nvim', + }, + cmd = 'ZenMode', + opts = { + window = { signcolumn = false }, + plugins = { + options = { enabled = true }, + twilight = { enabled = true }, + gitsigns = { enabled = true }, + tmux = { enabled = true }, + todo = { enabled = true }, + alacritty = { + enabled = true, + font = '16', }, - }, -} \ No newline at end of file + kitty = { + enabled = true, + font = '+4', + }, + }, + }, +}