aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/plugins')
-rw-r--r--.config/nvim/lua/plugins/alpha.lua7
-rw-r--r--.config/nvim/lua/plugins/better-escape.lua13
-rw-r--r--.config/nvim/lua/plugins/blink.lua43
-rw-r--r--.config/nvim/lua/plugins/cokeline.lua220
-rw-r--r--.config/nvim/lua/plugins/color-converter.lua11
-rw-r--r--.config/nvim/lua/plugins/d2.lua9
-rw-r--r--.config/nvim/lua/plugins/git-blame.lua7
-rw-r--r--.config/nvim/lua/plugins/graphviz.lua5
-rw-r--r--.config/nvim/lua/plugins/hardtime.lua5
-rw-r--r--.config/nvim/lua/plugins/indentmini.lua7
-rw-r--r--.config/nvim/lua/plugins/leap.lua14
-rw-r--r--.config/nvim/lua/plugins/lsp.lua1
-rw-r--r--.config/nvim/lua/plugins/lualine.lua223
-rw-r--r--.config/nvim/lua/plugins/mini/colors.lua1
-rw-r--r--.config/nvim/lua/plugins/mini/comment.lua1
-rw-r--r--.config/nvim/lua/plugins/mini/completions.lua1
-rw-r--r--.config/nvim/lua/plugins/mini/surround.lua15
-rw-r--r--.config/nvim/lua/plugins/noice.lua90
-rw-r--r--.config/nvim/lua/plugins/nui.lua3
-rw-r--r--.config/nvim/lua/plugins/nvim-cmp.lua64
-rw-r--r--.config/nvim/lua/plugins/nvim-colorizer.lua12
-rw-r--r--.config/nvim/lua/plugins/nvim-tree.lua131
-rw-r--r--.config/nvim/lua/plugins/nvim-treesitter.lua122
-rw-r--r--.config/nvim/lua/plugins/snacks.lua9
-rw-r--r--.config/nvim/lua/plugins/statuscol.lua20
-rw-r--r--.config/nvim/lua/plugins/telescope.lua65
-rw-r--r--.config/nvim/lua/plugins/trouble.lua109
27 files changed, 1208 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/alpha.lua b/.config/nvim/lua/plugins/alpha.lua
new file mode 100644
index 0000000..79180eb
--- /dev/null
+++ b/.config/nvim/lua/plugins/alpha.lua
@@ -0,0 +1,7 @@
+return {
+ "goolord/alpha-nvim",
+ dependencies = { "nvim-tree/nvim-web-devicons" },
+ config = function()
+ require("alpha").setup(require "dash")
+ end,
+}
diff --git a/.config/nvim/lua/plugins/better-escape.lua b/.config/nvim/lua/plugins/better-escape.lua
new file mode 100644
index 0000000..493408a
--- /dev/null
+++ b/.config/nvim/lua/plugins/better-escape.lua
@@ -0,0 +1,13 @@
+return {
+ "max397574/better-escape.nvim",
+ opts = {
+ default_mappings = false,
+ mappings = {
+ i = {
+ j = {
+ j = "<Esc>",
+ },
+ },
+ },
+ },
+}
diff --git a/.config/nvim/lua/plugins/blink.lua b/.config/nvim/lua/plugins/blink.lua
new file mode 100644
index 0000000..a978add
--- /dev/null
+++ b/.config/nvim/lua/plugins/blink.lua
@@ -0,0 +1,43 @@
+return {
+ "saghen/blink.cmp",
+ opts = {
+ keymap = {
+ preset = "enter",
+ ["<CR>"] = false,
+ ["<Tab>"] = { "accept", "fallback" },
+ ["<M-k>"] = { "select_prev" },
+ ["<M-j>"] = { "select_next" },
+ ["<M-S-k>"] = { "scroll_documentation_up" },
+ ["<M-S-j>"] = { "scroll_documentation_down" },
+ },
+ sources = {
+ default = { "lsp", "path" },
+ },
+ completion = {
+ documentation = {
+ auto_show = true,
+ auto_show_delay_ms = 100,
+ window = {
+ border = "rounded",
+ scrollbar = false,
+ },
+ },
+ -- ghost_text = {
+ -- enabled = true,
+ -- },
+ menu = {
+ border = "rounded",
+ scrollbar = false,
+ draw = {
+ columns = { { "label", "label_description", gap = 1 }, { "kind_icon", "kind", gap = 1 } },
+ },
+ },
+ },
+ cmdline = {
+ enabled = false,
+ },
+ },
+ opts_extend = { "sources.default" },
+ build = "cargo build --release",
+ -- enabled = false
+}
diff --git a/.config/nvim/lua/plugins/cokeline.lua b/.config/nvim/lua/plugins/cokeline.lua
new file mode 100644
index 0000000..2b70c53
--- /dev/null
+++ b/.config/nvim/lua/plugins/cokeline.lua
@@ -0,0 +1,220 @@
+local state = require "state"
+
+return {
+ "willothy/nvim-cokeline",
+ lazy = false,
+ config = function()
+ local hl = require "cokeline.hlgroups"
+ local is_picking_focus = require("cokeline.mappings").is_picking_focus
+ local is_picking_close = require("cokeline.mappings").is_picking_close
+
+ local function has_diagnostics(buffer)
+ return buffer.diagnostics.errors > 0
+ or buffer.diagnostics.warnings > 0
+ or buffer.diagnostics.infos > 0
+ or buffer.diagnostics.hints > 0
+ end
+
+ require("cokeline").setup {
+ show_if_buffers_are_at_least = 0,
+ components = {
+ {
+ text = function(buffer)
+ return buffer.is_first and (require("cokeline.sidebar").get_width "left" == 0 and "" or "│")
+ or "▎"
+ end,
+ fg = function()
+ return hl.get_hl_attr("WinSeparator", "fg")
+ end,
+ bg = function()
+ return hl.get_hl_attr("Normal", "bg")
+ end,
+ },
+ {
+ text = function(buffer)
+ return (is_picking_focus() or is_picking_close()) and " " .. buffer.pick_letter or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("PrismiteYellow", "fg")
+ end,
+ },
+ {
+ text = function(buffer)
+ return " " .. buffer.devicon.icon
+ end,
+ fg = function(buffer)
+ return buffer.devicon.color
+ end,
+ },
+ {
+ text = function(buffer)
+ return buffer.unique_prefix
+ end,
+ fg = function()
+ return hl.get_hl_attr("Comment", "fg")
+ end,
+ italic = true,
+ },
+ {
+ text = function(buffer)
+ return buffer.filename
+ end,
+ },
+ {
+ text = function(buffer)
+ return buffer.is_modified and " " or ""
+ end,
+ },
+ {
+ text = function(buffer)
+ return has_diagnostics(buffer) and " [" or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("WinSeparator", "fg")
+ end,
+ },
+ {
+ text = function(buffer)
+ local errors = buffer.diagnostics.errors
+ return errors > 0 and errors or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("DiagnosticError", "fg")
+ end,
+ },
+ {
+ text = function(buffer)
+ local bd = buffer.diagnostics
+ return (bd.errors > 0 and (bd.warnings > 0 or bd.infos > 0 or bd.hints > 0)) and "|" or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("WinSeparator", "fg")
+ end,
+ },
+ {
+ text = function(buffer)
+ local warnings = buffer.diagnostics.warnings
+ return warnings > 0 and warnings or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("DiagnosticWarn", "fg")
+ end,
+ },
+ {
+ text = function(buffer)
+ local bd = buffer.diagnostics
+ return (bd.warnings > 0 and (bd.infos > 0 or bd.hints > 0)) and "|" or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("WinSeparator", "fg")
+ end,
+ },
+ {
+ text = function(buffer)
+ local infos = buffer.diagnostics.infos
+ return infos > 0 and infos or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("DiagnosticInfo", "fg")
+ end,
+ },
+ {
+ text = function(buffer)
+ local bd = buffer.diagnostics
+ return (bd.infos > 0 and bd.hints > 0) and "|" or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("WinSeparator", "fg")
+ end,
+ },
+ {
+ text = function(buffer)
+ local hints = buffer.diagnostics.hints
+ return hints > 0 and hints or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("DiagnosticHint", "fg")
+ end,
+ },
+ {
+ text = function(buffer)
+ return has_diagnostics(buffer) and "]" or ""
+ end,
+ fg = function()
+ return hl.get_hl_attr("WinSeparator", "fg")
+ end,
+ },
+ {
+ text = " ",
+ },
+ },
+ buffers = {
+ delete_on_right_click = false,
+ },
+ mappings = {
+ disable_mouse = true,
+ },
+ sidebar = {
+ components = {
+ {
+ text = function()
+ local width = require("cokeline.sidebar").get_width "left"
+ if #state.nvim_tree_root > width then
+ return state.nvim_tree_root:sub(1, width - 2) .. "…"
+ else
+ return state.nvim_tree_root
+ end
+ end,
+ bg = function()
+ return hl.get_hl_attr("TabLineSel", "bg")
+ end,
+ },
+ {
+ text = function()
+ return string.rep(
+ " ",
+ math.max(0, require("cokeline.sidebar").get_width "left" - #state.nvim_tree_root)
+ )
+ end,
+ bg = function()
+ return hl.get_hl_attr("TabLineSel", "bg")
+ end,
+ },
+ },
+ },
+ }
+ end,
+ dependencies = { "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim" },
+ keys = {
+ {
+ "<leader>bp",
+ function()
+ require("cokeline.mappings").pick "focus"
+ end,
+ desc = "Pick a buffer to focus",
+ },
+ {
+ "<leader>bd",
+ function()
+ require("cokeline.mappings").pick "close"
+ end,
+ desc = "Pick a buffer to close",
+ },
+ {
+ "<Leader>p",
+ function()
+ require("cokeline.mappings").by_step("switch", -1)
+ end,
+ desc = "Move current buffer left",
+ silent = true,
+ },
+ {
+ "<Leader>n",
+ function()
+ require("cokeline.mappings").by_step("switch", 1)
+ end,
+ desc = "Move current buffer right",
+ silent = true,
+ },
+ },
+}
diff --git a/.config/nvim/lua/plugins/color-converter.lua b/.config/nvim/lua/plugins/color-converter.lua
new file mode 100644
index 0000000..dac0cb9
--- /dev/null
+++ b/.config/nvim/lua/plugins/color-converter.lua
@@ -0,0 +1,11 @@
+return {
+ "color_converter",
+ dev = true,
+ dependencies = {
+ { "echasnovski/mini.colors", version = "*" },
+ "MunifTanjim/nui.nvim",
+ },
+ -- lazy = false,
+ cmd = "ColorConverter",
+ config = true,
+}
diff --git a/.config/nvim/lua/plugins/d2.lua b/.config/nvim/lua/plugins/d2.lua
new file mode 100644
index 0000000..179a432
--- /dev/null
+++ b/.config/nvim/lua/plugins/d2.lua
@@ -0,0 +1,9 @@
+return {
+ "terrastruct/d2-vim",
+ ft = { "d2" },
+ config = function()
+ vim.keymap.del("v", "<Leader>d2")
+ vim.keymap.del("v", "<Leader>rd2")
+ vim.keymap.del("n", "<Leader>yd2")
+ end
+}
diff --git a/.config/nvim/lua/plugins/git-blame.lua b/.config/nvim/lua/plugins/git-blame.lua
new file mode 100644
index 0000000..22f9aed
--- /dev/null
+++ b/.config/nvim/lua/plugins/git-blame.lua
@@ -0,0 +1,7 @@
+return {
+ "f-person/git-blame.nvim",
+ event = "VeryLazy",
+ opts = {
+ date_format = "%r",
+ },
+}
diff --git a/.config/nvim/lua/plugins/graphviz.lua b/.config/nvim/lua/plugins/graphviz.lua
new file mode 100644
index 0000000..f0402bc
--- /dev/null
+++ b/.config/nvim/lua/plugins/graphviz.lua
@@ -0,0 +1,5 @@
+return {
+ "izocha/graphviz.nvim",
+ ft = { "dot" },
+ opts = {}
+}
diff --git a/.config/nvim/lua/plugins/hardtime.lua b/.config/nvim/lua/plugins/hardtime.lua
new file mode 100644
index 0000000..f47549e
--- /dev/null
+++ b/.config/nvim/lua/plugins/hardtime.lua
@@ -0,0 +1,5 @@
+return {
+ "m4xshen/hardtime.nvim",
+ config = true,
+ enabled = false,
+}
diff --git a/.config/nvim/lua/plugins/indentmini.lua b/.config/nvim/lua/plugins/indentmini.lua
new file mode 100644
index 0000000..793f5ea
--- /dev/null
+++ b/.config/nvim/lua/plugins/indentmini.lua
@@ -0,0 +1,7 @@
+return {
+ "nvimdev/indentmini.nvim",
+ config = true,
+ opts = {
+ char = "▏",
+ },
+}
diff --git a/.config/nvim/lua/plugins/leap.lua b/.config/nvim/lua/plugins/leap.lua
new file mode 100644
index 0000000..891d99f
--- /dev/null
+++ b/.config/nvim/lua/plugins/leap.lua
@@ -0,0 +1,14 @@
+return {
+ "https://codeberg.org/andyg/leap.nvim",
+ config = function()
+ local leap = require "leap"
+ -- leap.add_default_mappings()
+ vim.keymap.set({'n', 'x', 'o'}, 's', '<Plug>(leap-forward)')
+ vim.keymap.set({'n', 'x', 'o'}, 'S', '<Plug>(leap-backward)')
+ -- vim.keymap.set('n', 'gs', '<Plug>(leap-from-window)')
+ leap.opts.highlight_unlabeled_phase_one_targets = true
+ end,
+ dependencies = {
+ "tpope/vim-repeat",
+ },
+}
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
index a438f3a..05d55c5 100644
--- a/.config/nvim/lua/plugins/lsp.lua
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -37,6 +37,7 @@ return {
},
rust_analyzer = { settings = { completion = { fullFunctionSignatures = true } } },
ts_ls = {},
+ denols = {}
},
setup = {},
inlay_hints = {
diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua
new file mode 100644
index 0000000..085593c
--- /dev/null
+++ b/.config/nvim/lua/plugins/lualine.lua
@@ -0,0 +1,223 @@
+local delegate = require "utils.delegate"
+
+local leap_active = false
+vim.api.nvim_create_autocmd("User", {
+ pattern = "LeapEnter",
+ callback = function()
+ leap_active = true
+ end,
+})
+
+vim.api.nvim_create_autocmd("User", {
+ pattern = "LeapLeave",
+ callback = function()
+ leap_active = false
+ end,
+})
+
+return {
+ "nvim-lualine/lualine.nvim",
+ event = "VeryLazy",
+ init = function()
+ local diagnostics = require "lualine.components.diagnostics"
+
+ diagnostics.init = delegate(function(env, self, options)
+ -- Run super()
+ env.M.super.init(self, options)
+ -- Apply default options
+ env.modules.default_config.apply_default_colors(self.options)
+ self.options = vim.tbl_deep_extend("keep", self.options or {}, env.modules.default_config.options)
+ -- Apply default symbols
+ self.symbols = vim.tbl_extend(
+ "keep",
+ self.options.symbols or {},
+ self.options.icons_enabled ~= false and env.modules.default_config.symbols.icons
+ or env.modules.default_config.symbols.no_icons
+ )
+ -- Initialize highlight groups
+ if self.options.colored then
+ self.highlight_groups = {
+ error = self:create_hl(self.options.diagnostics_color.error, "error"),
+ warn = self:create_hl(self.options.diagnostics_color.warn, "warn"),
+ info = self:create_hl(self.options.diagnostics_color.info, "info"),
+ hint = self:create_hl(self.options.diagnostics_color.hint, "hint"),
+ }
+ self.spacing_hl = self:create_hl("WinSeparator", "spacing")
+ end
+
+ -- Initialize variable to store last update so we can use it in insert
+ -- mode for no update_in_insert
+ self.last_diagnostics_count = {}
+
+ -- Error out no source
+ if #self.options.sources < 1 then
+ env.modules.utils_notices.add_notice "### diagnostics.sources\n\nno sources for diagnostics configured.\nPlease specify which diagnostics source you want lualine to use with `sources` option.\n"
+ end
+ end, diagnostics.init)
+
+ diagnostics.update_status = delegate(function(env, self)
+ local bufnr = vim.api.nvim_get_current_buf()
+ local diagnostics_count
+ local result = {}
+ if self.options.update_in_insert or vim.api.nvim_get_mode().mode:sub(1, 1) ~= "i" then
+ local error_count, warning_count, info_count, hint_count = 0, 0, 0, 0
+ local diagnostic_data = env.modules.sources.get_diagnostics(self.options.sources)
+ -- sum all the counts
+ for _, data in pairs(diagnostic_data) do
+ error_count = error_count + data.error
+ warning_count = warning_count + data.warn
+ info_count = info_count + data.info
+ hint_count = hint_count + data.hint
+ end
+ diagnostics_count = {
+ error = error_count,
+ warn = warning_count,
+ info = info_count,
+ hint = hint_count,
+ }
+ -- Save count for insert mode
+ self.last_diagnostics_count[bufnr] = diagnostics_count
+ else -- Use cached count in insert mode with update_in_insert disabled
+ diagnostics_count = self.last_diagnostics_count[bufnr] or { error = 0, warn = 0, info = 0, hint = 0 }
+ end
+
+ local always_visible = false
+ if type(self.options.always_visible) == "boolean" then
+ always_visible = self.options.always_visible
+ elseif type(self.options.always_visible) == "function" then
+ always_visible = self.options.always_visible()
+ end
+
+ -- format the counts with symbols and highlights
+ if self.options.colored then
+ local colors, bgs = {}, {}
+ for name, hl in pairs(self.highlight_groups) do
+ colors[name] = self:format_hl(hl)
+ bgs[name] = env.modules.utils.extract_highlight_colors(colors[name]:match "%%#(.-)#", "bg")
+ end
+ local previous_section, padding
+ for _, section in ipairs(self.options.sections) do
+ if diagnostics_count[section] ~= nil and (always_visible or diagnostics_count[section] > 0) then
+ padding = previous_section and (bgs[previous_section] ~= bgs[section]) and " " or ""
+ previous_section = section
+ table.insert(
+ result,
+ colors[section] .. padding .. self.symbols[section] .. diagnostics_count[section]
+ )
+ end
+ end
+ else
+ for _, section in ipairs(self.options.sections) do
+ if diagnostics_count[section] ~= nil and (always_visible or diagnostics_count[section] > 0) then
+ table.insert(result, self.symbols[section] .. diagnostics_count[section])
+ end
+ end
+ end
+ return table.concat(result, self:format_hl(self.spacing_hl) .. "|")
+ end, diagnostics.update_status)
+ end,
+ opts = {
+ options = {
+ section_separators = { left = "", right = "" },
+ component_separators = { left = "", right = "" },
+ fmt = function(str)
+ return vim.trim(str)
+ end,
+ globalstatus = true,
+ disabled_filetypes = { "NvimTree" },
+ },
+ sections = {
+ lualine_a = {
+ "mode",
+ {
+ function()
+ return "[L]"
+ end,
+ cond = function()
+ return leap_active
+ end,
+ },
+ {
+ function()
+ local reg = vim.fn.reg_recording()
+ if reg == "" then
+ return ""
+ end -- not recording
+ return "[@" .. reg .. "]"
+ end,
+ },
+ },
+ lualine_b = { "filename" },
+ lualine_c = {
+ "branch",
+ {
+ function()
+ return "["
+ end,
+ cond = function()
+ local count = vim.diagnostic.count(0)
+ return type(
+ count[vim.diagnostic.severity.ERROR]
+ or count[vim.diagnostic.severity.WARN]
+ or count[vim.diagnostic.severity.INFO]
+ or count[vim.diagnostic.severity.HINT]
+ ) ~= "nil"
+ end,
+ padding = { left = 1, right = 0 },
+ color = "WinSeparator",
+ },
+ {
+ "diagnostics",
+ symbols = {
+ error = "",
+ warn = "",
+ info = "",
+ hint = "",
+ },
+ padding = 0,
+ },
+ {
+ function()
+ return "]"
+ end,
+ cond = function()
+ local count = vim.diagnostic.count(0)
+ return type(
+ count[vim.diagnostic.severity.ERROR]
+ or count[vim.diagnostic.severity.WARN]
+ or count[vim.diagnostic.severity.INFO]
+ or count[vim.diagnostic.severity.HINT]
+ ) ~= "nil"
+ end,
+ padding = { left = 0, right = 1 },
+ color = "WinSeparator",
+ },
+ },
+ lualine_x = {
+ {
+ function()
+ local noice_loaded, noice = pcall(require, "noice")
+ if noice_loaded then
+ return noice.api.status.command.get()
+ else
+ return ""
+ end
+ end,
+ cond = function()
+ local noice_loaded, noice = pcall(require, "noice")
+ if noice_loaded then
+ return noice.api.status.command.has()
+ else
+ return false
+ end
+ end,
+ },
+ },
+ lualine_y = { "filetype" },
+ lualine_z = { "searchcount", "progress", "location" },
+ },
+ },
+ dependencies = {
+ "nvim-tree/nvim-web-devicons",
+ },
+}
diff --git a/.config/nvim/lua/plugins/mini/colors.lua b/.config/nvim/lua/plugins/mini/colors.lua
new file mode 100644
index 0000000..ac6400a
--- /dev/null
+++ b/.config/nvim/lua/plugins/mini/colors.lua
@@ -0,0 +1 @@
+return { "echasnovski/mini.colors", version = "*" }
diff --git a/.config/nvim/lua/plugins/mini/comment.lua b/.config/nvim/lua/plugins/mini/comment.lua
new file mode 100644
index 0000000..d0c7f98
--- /dev/null
+++ b/.config/nvim/lua/plugins/mini/comment.lua
@@ -0,0 +1 @@
+return { "echasnovski/mini.comment", config = true }
diff --git a/.config/nvim/lua/plugins/mini/completions.lua b/.config/nvim/lua/plugins/mini/completions.lua
new file mode 100644
index 0000000..a564707
--- /dev/null
+++ b/.config/nvim/lua/plugins/mini/completions.lua
@@ -0,0 +1 @@
+return {}
diff --git a/.config/nvim/lua/plugins/mini/surround.lua b/.config/nvim/lua/plugins/mini/surround.lua
new file mode 100644
index 0000000..7a05e44
--- /dev/null
+++ b/.config/nvim/lua/plugins/mini/surround.lua
@@ -0,0 +1,15 @@
+return {
+ "echasnovski/mini.surround",
+ version = false,
+ opts = {
+ mappings = {
+ add = "\\a", -- Add surrounding in Normal and Visual modes
+ delete = "\\d", -- Delete surrounding
+ find = "\\f", -- Find surrounding (to the right)
+ find_left = "\\F", -- Find surrounding (to the left)
+ highlight = "\\h", -- Highlight surrounding
+ replace = "\\r", -- Replace surrounding
+ update_n_lines = "\\n", -- Update `n_lines`
+ },
+ },
+}
diff --git a/.config/nvim/lua/plugins/noice.lua b/.config/nvim/lua/plugins/noice.lua
new file mode 100644
index 0000000..3c909a9
--- /dev/null
+++ b/.config/nvim/lua/plugins/noice.lua
@@ -0,0 +1,90 @@
+return {
+ "folke/noice.nvim",
+ event = "VeryLazy",
+ opts = {
+ cmdline = {
+ format = {
+ cmdline = { icon = ":" },
+ },
+ },
+ lsp = {
+ override = {
+ ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
+ ["vim.lsp.util.stylize_markdown"] = true,
+ ["cmp.entry.get_documentation"] = true,
+ },
+ },
+ presets = {
+ command_palette = true,
+ long_message_to_split = true,
+ inc_rename = true,
+ lsp_doc_border = true,
+ },
+ messages = {
+ view_search = false,
+ },
+ views = {
+ confirm_warn = {
+ backend = "popup",
+ relative = "editor",
+ focusable = false,
+ align = "center",
+ enter = false,
+ zindex = 210,
+ format = { "{confirm}" },
+ position = {
+ row = 3,
+ col = "50%",
+ },
+ size = "auto",
+ border = {
+ style = "rounded",
+ padding = { 0, 1 },
+ text = {
+ top = " Confirm ",
+ },
+ },
+ win_options = {
+ winhighlight = {
+ Normal = "NoiceConfirm",
+ FloatBorder = "PrismiteOrange",
+ },
+ winbar = "",
+ foldenable = false,
+ },
+ },
+ },
+ routes = {
+ {
+ filter = {
+ event = "msg_show",
+ kind = "confirm",
+ },
+ view = "confirm_warn",
+ },
+ {
+ filter = {
+ event = "msg_show",
+ any = {
+ { find = "Already at newest change" },
+ { find = "Already at oldest change" },
+ { find = "E486: Pattern not found: .+" }, -- failed search
+ { find = "%d+ .+ line.?; before #%d+" }, -- undo
+ { find = "%d+ change; after #%d+" }, -- redo
+ { find = "%[nvim-treesitter" }, -- treesitter messages
+ { find = "No treesitter parser found for filetype: " }, -- Treesitter parser not installed
+ { find = "%d+ lines yanked" }, -- y
+ { find = "%d+ more lines" }, -- p
+ { find = "%d+ fewer lines" }, -- d
+ },
+ -- kind = "",
+ },
+ view = "mini",
+ },
+ },
+ },
+ dependencies = {
+ "MunifTanjim/nui.nvim",
+ "rcarriga/nvim-notify",
+ },
+}
diff --git a/.config/nvim/lua/plugins/nui.lua b/.config/nvim/lua/plugins/nui.lua
new file mode 100644
index 0000000..f85bdd3
--- /dev/null
+++ b/.config/nvim/lua/plugins/nui.lua
@@ -0,0 +1,3 @@
+return {
+ "MunifTanjim/nui.nvim",
+}
diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua
new file mode 100644
index 0000000..d95d0bc
--- /dev/null
+++ b/.config/nvim/lua/plugins/nvim-cmp.lua
@@ -0,0 +1,64 @@
+return {
+ "hrsh7th/nvim-cmp",
+ opts = function()
+ vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
+ local cmp = require "cmp"
+ local defaults = require "cmp.config.default"()
+ return {
+ enabled = function()
+ local context = require "cmp.config.context"
+ if vim.api.nvim_get_mode().mode == "c" then
+ return true
+ else
+ return not context.in_treesitter_capture "comment" and not context.in_syntax_group "Comment"
+ end
+ end,
+
+ completion = {
+ completeopt = "menu,menuone,noinsert",
+ },
+ 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 {
+ ["<C-j>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
+ ["<C-k>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
+ ["<C-b>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-f>"] = cmp.mapping.scroll_docs(4),
+ ["<S-CR>"] = cmp.mapping.abort(),
+ ["<CR>"] = cmp.mapping.confirm { select = false },
+ },
+ sources = cmp.config.sources {
+ { name = "nvim_lsp" },
+ { name = "path" },
+ },
+ formatting = {
+ format = function(_, item)
+ local icons = require("icons").kinds
+ if icons[item.kind] then
+ item.kind = icons[item.kind] .. item.kind
+ end
+ return item
+ end,
+ },
+ experimental = {
+ ghost_text = {
+ hl_group = "CmpGhostText",
+ },
+ },
+ sorting = defaults.sorting,
+ }
+ end,
+ dependencies = {
+ { "L3MON4D3/LuaSnip", build = "make install_jsregexp" },
+ "hrsh7th/cmp-path",
+ "saadparwaiz1/cmp_luasnip",
+ },
+ enabled = false,
+}
diff --git a/.config/nvim/lua/plugins/nvim-colorizer.lua b/.config/nvim/lua/plugins/nvim-colorizer.lua
new file mode 100644
index 0000000..e026ae5
--- /dev/null
+++ b/.config/nvim/lua/plugins/nvim-colorizer.lua
@@ -0,0 +1,12 @@
+return {
+ "catgoose/nvim-colorizer.lua",
+ event = "BufReadPre",
+ opts = {
+ user_default_options = {
+ names = false,
+ RRGGBBAA = true,
+ css_fn = true,
+ xterm = true,
+ },
+ },
+}
diff --git a/.config/nvim/lua/plugins/nvim-tree.lua b/.config/nvim/lua/plugins/nvim-tree.lua
new file mode 100644
index 0000000..8afa105
--- /dev/null
+++ b/.config/nvim/lua/plugins/nvim-tree.lua
@@ -0,0 +1,131 @@
+local state = require "state"
+
+local function natural_cmp(_left, _right)
+ local left = _left.name:lower()
+ local right = _right.name:lower()
+
+ if left == right then
+ return false
+ end
+
+ local is_l_dir = _left.type ~= "directory"
+ local is_r_dir = _right.type ~= "directory"
+ if ((is_l_dir or is_r_dir) and not (is_l_dir and is_r_dir)) then
+ return is_r_dir
+ end
+
+ for i = 1, math.max(string.len(left), string.len(right)), 1 do
+ local l = string.sub(left, i, -1)
+ local r = string.sub(right, i, -1)
+
+ if type(tonumber(string.sub(l, 1, 1))) == "number" and type(tonumber(string.sub(r, 1, 1))) == "number" then
+ local l_number = tonumber(string.match(l, "^[0-9]+"))
+ local r_number = tonumber(string.match(r, "^[0-9]+"))
+
+ if l_number ~= r_number then
+ return l_number < r_number
+ end
+ elseif string.sub(l, 1, 1) ~= string.sub(r, 1, 1) then
+ return l < r
+ end
+ end
+end
+
+return {
+ "nvim-tree/nvim-tree.lua",
+ opts = {
+ sort_by = function (nodes)
+ table.sort(nodes, natural_cmp)
+ end,
+ view = {
+ width = 30,
+ },
+ renderer = {
+ root_folder_label = function()
+ return ".."
+ end,
+ indent_markers = {
+ enable = true,
+ },
+ icons = {
+ show = {
+ folder_arrow = false,
+ },
+ glyphs = {
+ git = {
+ unstaged = "-",
+ staged = "+",
+ unmerged = "",
+ renamed = "󰏪",
+ untracked = "",
+ deleted = "󰆴",
+ ignored = "",
+ },
+ },
+ },
+ },
+ filters = {
+ git_ignored = false,
+ },
+ },
+ config = function(_, opts)
+ local api = require "nvim-tree.api"
+ local Event = api.events.Event
+
+ api.events.subscribe(Event.Ready, function()
+ state.nvim_tree_root = api.tree.get_nodes().absolute_path
+ end)
+
+ api.events.subscribe(Event.TreeRendered, function()
+ state.nvim_tree_root = api.tree.get_nodes().absolute_path
+ end)
+
+ require("nvim-tree").setup(vim.tbl_extend("force", opts, {
+ -- on_attach = function ()
+ -- local function opts(desc)
+ -- return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
+ -- end
+ --
+ -- local function edit_or_open()
+ -- local node = api.tree.get_node_under_cursor()
+ --
+ -- if node.nodes ~= nil then
+ -- -- expand or collapse folder
+ -- api.node.open.edit()
+ -- else
+ -- -- open file
+ -- api.node.open.edit()
+ -- -- Close the tree if file was opened
+ -- api.tree.close()
+ -- end
+ -- end
+ --
+ -- -- open as vsplit on current node
+ -- local function vsplit_preview()
+ -- local node = api.tree.get_node_under_cursor()
+ --
+ -- if node.nodes ~= nil then
+ -- -- expand or collapse folder
+ -- api.node.open.edit()
+ -- else
+ -- -- open file as vsplit
+ -- api.node.open.vertical()
+ -- end
+ --
+ -- -- Finally refocus on tree if it was lost
+ -- api.tree.focus()
+ -- end
+ --
+ -- vim.keymap.set("n", "l", edit_or_open, opts("Edit Or Open"))
+ -- vim.keymap.set("n", "h", api.tree.close, opts("Close"))
+ -- end
+ --
+ }))
+ end,
+ dependencies = {
+ "nvim-tree/nvim-web-devicons",
+ },
+ keys = {
+ { "<Leader>e", "<cmd>NvimTreeToggle<CR>", desc = "Toggle nvim-tree" },
+ },
+}
diff --git a/.config/nvim/lua/plugins/nvim-treesitter.lua b/.config/nvim/lua/plugins/nvim-treesitter.lua
new file mode 100644
index 0000000..2f8e3cb
--- /dev/null
+++ b/.config/nvim/lua/plugins/nvim-treesitter.lua
@@ -0,0 +1,122 @@
+return {
+ "nvim-treesitter/nvim-treesitter",
+ branch = "main",
+ build = ":TSUpdate",
+ init = function()
+ vim.o.foldmethod = "expr"
+ vim.o.foldexpr = "v:lua.vim.treesitter.foldexpr()"
+
+ end,
+ config = function(_, opts)
+ vim.api.nvim_create_autocmd('User', {
+ pattern = 'TSUpdate',
+ callback = function()
+ vim.tbl_extend("force", require('nvim-treesitter.parsers'), opts.custom_parsers or {})
+ end
+ })
+
+ local ts = require('nvim-treesitter')
+
+ local already_installed = ts.get_installed()
+ local parsers_to_install = vim.iter(opts.parsers or {})
+ :filter(function(parser) return not vim.tbl_contains(already_installed, parser) end)
+ :totable()
+
+ ts.install(parsers_to_install)
+
+ -- Auto-install and start parsers for any buffer
+ vim.api.nvim_create_autocmd({ "BufRead", "FileType" }, {
+ desc = "Enable Treesitter",
+ callback = function(event)
+ local bufnr = event.buf
+ local filetype = vim.api.nvim_get_option_value("filetype", { buf = bufnr })
+
+ -- Skip if no filetype
+ if filetype == "" then
+ return
+ end
+
+ -- Get parser name based on filetype
+ local parser_name = vim.treesitter.language.get_lang(filetype)
+ if not parser_name then
+ vim.notify(vim.inspect("No treesitter parser found for filetype: " .. filetype), vim.log.levels.WARN)
+ return
+ end
+
+ -- Try to get existing parser
+ local parser_configs = require("nvim-treesitter.parsers")
+ if not parser_configs[parser_name] then
+ return -- Parser not available, skip silently
+ end
+
+ local parser_exists = pcall(vim.treesitter.get_parser, bufnr, parser_name)
+
+ local function init_treesitter()
+ -- vim.notify(vim.inspect("Starting treesitter parser " .. parser_name .. " for filetype: " .. filetype), vim.log.levels.WARN)
+ vim.treesitter.start(bufnr, parser_name)
+ -- Use regex based syntax-highlighting as fallback as some plugins might need it
+ -- vim.bo[bufnr].syntax = "ON"
+ -- vim.wo.foldtext = "v:lua.vim.treesitter.foldtext()"
+ -- Use treesitter for indentation
+ vim.bo[bufnr].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
+ end
+
+ if not parser_exists then
+ -- check if parser is already installed
+ if vim.tbl_contains(already_installed, parser_name) then
+ vim.notify("Parser for " .. parser_name .. " already installed.", vim.log.levels.INFO)
+ init_treesitter()
+ -- else
+ -- -- If not installed, install parser synchronously
+ -- vim.notify("Installing parser for " .. parser_name, vim.log.levels.INFO)
+ -- treesitter.install({ parser_name }):await(init_treesitter)
+ end
+ else
+ init_treesitter()
+ end
+
+ end,
+ })
+ end,
+ opts = {
+ parsers = {
+ "lua",
+ "c",
+ "vim",
+ "vimdoc",
+ "query",
+ "rust",
+ "fish",
+ "json",
+ "javascript",
+ "latex",
+ "markdown",
+ "markdown_inline",
+ "zig",
+ "typescript",
+ "toml",
+ "svelte",
+ "comment",
+ "html",
+ "typst",
+ "ron",
+ "smali",
+ "java",
+ "kotlin",
+ "styled",
+ "nix",
+ "gitignore",
+ "meson"
+ -- "d2"
+ },
+ custom_parsers = {
+ d2 = {
+ install_info = {
+ url = 'https://github.com/ravsii/tree-sitter-d2',
+ queries = 'queries',
+ },
+ }
+ }
+ },
+ lazy = false
+}
diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua
new file mode 100644
index 0000000..7cd44c8
--- /dev/null
+++ b/.config/nvim/lua/plugins/snacks.lua
@@ -0,0 +1,9 @@
+return {
+ "folke/snacks.nvim",
+ priority = 1000,
+ lazy = false,
+ ---@type snacks.Config
+ opts = {
+ input = { enabled = true },
+ },
+}
diff --git a/.config/nvim/lua/plugins/statuscol.lua b/.config/nvim/lua/plugins/statuscol.lua
new file mode 100644
index 0000000..70a0947
--- /dev/null
+++ b/.config/nvim/lua/plugins/statuscol.lua
@@ -0,0 +1,20 @@
+return {
+ "luukvbaal/statuscol.nvim",
+ opts = function()
+ local builtin = require "statuscol.builtin"
+ return {
+ setopt = true,
+ -- override the default list of segments with:
+ -- number-less fold indicator, then signs, then line number & separator
+ segments = {
+ { text = { builtin.foldfunc }, click = "v:lua.ScFa" },
+ { text = { "%s" }, click = "v:lua.ScSa" },
+ {
+ text = { builtin.lnumfunc, " " },
+ condition = { true, builtin.not_empty },
+ click = "v:lua.ScLa",
+ },
+ },
+ }
+ end,
+}
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua
new file mode 100644
index 0000000..7633996
--- /dev/null
+++ b/.config/nvim/lua/plugins/telescope.lua
@@ -0,0 +1,65 @@
+local state = require "state"
+
+return {
+ "nvim-telescope/telescope.nvim",
+ opts = function(_, opts)
+ local actions = require "telescope.actions"
+ local actions_mt = require "telescope.actions.mt"
+
+ local open_quickfix = actions_mt.transform("open_quickfix", actions_mt.create(), nil, {
+ action = function()
+ require("trouble").open "qflist"
+ end,
+ })
+
+ return vim.tbl_deep_extend("force", opts, {
+ defaults = {
+ mappings = {
+ n = {
+ ["<C-q>"] = actions.send_to_qflist + open_quickfix,
+ ["<C-h>"] = "preview_scrolling_left",
+ ["<C-k>"] = "preview_scrolling_up",
+ ["<C-j>"] = "preview_scrolling_down",
+ ["<C-l>"] = "preview_scrolling_right",
+ },
+ i = {
+ ["<C-q>"] = actions.send_to_qflist + open_quickfix,
+ ["<C-h>"] = "preview_scrolling_left",
+ ["<C-k>"] = "preview_scrolling_up",
+ ["<C-j>"] = "preview_scrolling_down",
+ ["<C-l>"] = "preview_scrolling_right",
+ },
+ },
+ },
+ })
+ end,
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ },
+ keys = function()
+ local builtin = require "telescope.builtin"
+ return {
+ { "<Leader>ff", builtin.find_files, desc = "Telescope: find files" },
+ {
+ "<Leader>fF",
+ function()
+ builtin.find_files(state.nvim_tree_root and {
+ cwd = state.nvim_tree_root,
+ })
+ end,
+ desc = "Telescope: find files in nvim-tree root",
+ },
+ { "<Leader>fg", builtin.live_grep, desc = "Telescope: live grep" },
+ {
+ "<Leader>fG",
+ function()
+ builtin.live_grep(state.nvim_tree_root and {
+ cwd = state.nvim_tree_root,
+ })
+ end,
+ desc = "Telescope: live grep in nvim-tree root",
+ },
+ }
+ end,
+ cmd = { "Telescope" },
+}
diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua
new file mode 100644
index 0000000..cc40587
--- /dev/null
+++ b/.config/nvim/lua/plugins/trouble.lua
@@ -0,0 +1,109 @@
+local icons = require "icons"
+
+return {
+ "folke/trouble.nvim",
+ opts = function()
+ local Util = require "trouble.util"
+ return {
+ modes = {
+ symbols = {
+ win = {
+ position = "right",
+ size = 0.4,
+ },
+ format = "{symbol_kind} {symbol_pos:Comment} {symbol.name} {text:Comment}",
+ preview = {
+ type = "float",
+ relative = "editor",
+ border = "rounded",
+ title = "Preview",
+ title_pos = "center",
+ position = { 1, 0 },
+ size = { width = 0.3, height = 0.3 },
+ zindex = 200,
+ },
+ },
+ qflist = {
+ win = {
+ position = "right",
+ size = 0.4,
+ },
+ format = "{severity_icon|item.type:DiagnosticSignWarn} {text:ts} {pos:Comment}",
+ preview = {
+ type = "float",
+ relative = "editor",
+ border = "rounded",
+ title = "Preview",
+ title_pos = "center",
+ position = { 1, 0 },
+ size = { width = 0.3, height = 0.3 },
+ zindex = 200,
+ },
+ },
+ diagnostics = {
+ win = {
+ position = "down",
+ size = 0.4,
+ },
+ preview = {
+ type = "split",
+ relative = "win",
+ position = "right",
+ size = 0.5,
+ },
+ },
+ },
+ icons = {
+ kinds = icons.kinds,
+ },
+ formatters = {
+ symbol_kind = function(ctx)
+ return { text = "[" .. ctx.item.kind .. "]", hl = "Type" }
+ end,
+ symbol_pos = function(ctx)
+ return "@ " .. ctx.item.pos[1] .. ":" .. (ctx.item.pos[2] + 1)
+ end,
+ severity_icon = function(ctx)
+ local severity = ctx.item.severity or vim.diagnostic.severity.ERROR
+ if not vim.diagnostic.severity[severity] then
+ return
+ end
+ if type(severity) == "string" then
+ severity = vim.diagnostic.severity[severity:upper()] or vim.diagnostic.severity.ERROR
+ end
+ local name = Util.camel(vim.diagnostic.severity[severity]:lower())
+ local sign = vim.fn.sign_getdefined("DiagnosticSign" .. name)[1]
+ local config = vim.diagnostic.config() or {}
+ if config.signs == nil or type(config.signs) == "boolean" then
+ return {
+ text = sign and "[" .. sign.text .. "]" or name:sub(1, 1),
+ hl = "DiagnosticSign" .. name,
+ }
+ end
+ local signs = config.signs or {}
+ if type(signs) == "function" then
+ signs = signs(0, 0) --[[@as vim.diagnostic.Opts.Signs]]
+ end
+ return {
+ text = type(signs) == "table" and signs.text and "[" .. signs.text[severity] .. "]"
+ or sign and sign.text
+ or name:sub(1, 1),
+ hl = "DiagnosticSign" .. name,
+ }
+ end,
+ },
+ signs = true,
+ }
+ end,
+ dependencies = { "nvim-tree/nvim-web-devicons" },
+ keys = {
+ {
+ "<Leader>pe",
+ "<cmd>Trouble diagnostics toggle win.position=bottom<CR>",
+ desc = "Toggle diagnstostics panel",
+ },
+ { "<Leader>ps", "<cmd>Trouble symbols toggle<CR>", desc = "Toggle symbols panel" },
+ { "<Leader>pq", "<cmd>Trouble qflist toggle<CR>", desc = "Toggle quickfix panel" },
+ },
+ cmd = { "Trouble" },
+}