From 4aa0c54fc4eba43c5cae12da5e5df4ae9b49f724 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Thu, 5 Jun 2025 11:33:49 +0200 Subject: [PATCH] Format config --- nvim/lua/lazy-conf.lua | 21 +- nvim/lua/options.lua | 4 +- nvim/lua/plugins/lsp/cmp.lua | 156 ++--- nvim/lua/plugins/lsp/lsp-lines.lua | 18 +- nvim/lua/plugins/lsp/luasnip.lua | 11 +- nvim/lua/plugins/lsp/none-ls.lua | 101 ++-- nvim/lua/plugins/lsp/treesitter.lua | 48 +- nvim/lua/plugins/lsp/vimtex.lua | 20 +- nvim/lua/plugins/nav/bufremove.lua | 11 +- nvim/lua/plugins/nav/lastplace.lua | 4 +- nvim/lua/plugins/nav/navbuddy.lua | 4 +- nvim/lua/plugins/nav/neotree.lua | 656 ++++++++++----------- nvim/lua/plugins/nav/telescope.lua | 74 +-- nvim/lua/plugins/nav/toggleterm.lua | 30 +- nvim/lua/plugins/nav/whichkey.lua | 4 +- nvim/lua/plugins/style/colorizer.lua | 14 +- nvim/lua/plugins/style/colors.lua | 90 +-- nvim/lua/plugins/style/comment-box.lua | 12 +- nvim/lua/plugins/style/comment.lua | 8 +- nvim/lua/plugins/style/dressing.lua | 4 +- nvim/lua/plugins/style/lualine.lua | 36 +- nvim/lua/plugins/style/noice.lua | 68 +-- nvim/lua/plugins/style/startup.lua | 44 +- nvim/lua/plugins/testing/dap.lua | 16 +- nvim/lua/plugins/util/actions-preview.lua | 32 +- nvim/lua/plugins/util/autopairs.lua | 122 ++-- nvim/lua/plugins/util/autotag.lua | 10 +- nvim/lua/plugins/util/colour-picker.lua | 25 +- nvim/lua/plugins/util/fidget.lua | 7 +- nvim/lua/plugins/util/indent-blankline.lua | 8 +- nvim/lua/plugins/util/markdown-preview.lua | 16 +- nvim/lua/plugins/util/multicursors.lua | 16 +- nvim/lua/plugins/util/neogen.lua | 10 +- nvim/lua/plugins/util/surround.lua | 2 +- nvim/lua/utils.lua | 21 +- 35 files changed, 867 insertions(+), 856 deletions(-) diff --git a/nvim/lua/lazy-conf.lua b/nvim/lua/lazy-conf.lua index 36168c6..180baad 100755 --- a/nvim/lua/lazy-conf.lua +++ b/nvim/lua/lazy-conf.lua @@ -1,26 +1,25 @@ 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({ spec = { { import = "plugins.nav" }, { import = "plugins.lsp" }, { import = "plugins.style" }, { import = "plugins.util" }, - { import = "plugins.testing" } + { import = "plugins.testing" }, }, change_detection = { notify = false, -- dont notify when plugins are changed - } + }, }) diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua index 50319f2..4175a2d 100755 --- a/nvim/lua/options.lua +++ b/nvim/lua/options.lua @@ -16,8 +16,8 @@ vim.opt.breakindent = true vim.opt.linebreak = true -- folding -vim.wo.foldmethod = 'expr' -vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' +vim.wo.foldmethod = "expr" +vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" -- line numbers vim.wo.number = true diff --git a/nvim/lua/plugins/lsp/cmp.lua b/nvim/lua/plugins/lsp/cmp.lua index b29ff81..c61a462 100755 --- a/nvim/lua/plugins/lsp/cmp.lua +++ b/nvim/lua/plugins/lsp/cmp.lua @@ -1,25 +1,25 @@ return { - -- competion - "hrsh7th/nvim-cmp", - event = "InsertEnter", - dependencies = { - { "hrsh7th/cmp-buffer" }, -- source for text in buffer - { "hrsh7th/cmp-path" }, -- source for file system paths - { "L3MON4D3/LuaSnip" }, -- snippet engine - { "saadparwaiz1/cmp_luasnip" }, -- for autocompletion - { "rafamadriz/friendly-snippets" }, -- useful snippets - { "onsails/lspkind.nvim" }, -- icons for cmp + -- competion + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + { "hrsh7th/cmp-buffer" }, -- source for text in buffer + { "hrsh7th/cmp-path" }, -- source for file system paths + { "L3MON4D3/LuaSnip" }, -- snippet engine + { "saadparwaiz1/cmp_luasnip" }, -- for autocompletion + { "rafamadriz/friendly-snippets" }, -- useful snippets + { "onsails/lspkind.nvim" }, -- icons for cmp { "hrsh7th/cmp-nvim-lsp-signature-help" }, -- signature help - }, + }, - config = function() - local cmp = require("cmp") - local lspkind = require("lspkind") - local luasnip = require("luasnip") + config = function() + local cmp = require("cmp") + local lspkind = require("lspkind") + local luasnip = require("luasnip") - -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) - require("luasnip.loaders.from_vscode").lazy_load() - require("luasnip.loaders.from_vscode").load({paths = { "~/.config/nvim/snippets" }}) + -- loads vscode style snippets from installed plugins (e.g. friendly-snippets) + require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_vscode").load({ paths = { "~/.config/nvim/snippets" } }) luasnip.setup({ region_check_events = { "CursorMoved" }, delete_check_events = { "TextChanged" }, @@ -27,32 +27,32 @@ return { -- luasnip.filetype_extend("htmldjango", { "html" }) - cmp.setup({ - completion = { - completeopt = "menu,menuone,preview,noselect", - }, + cmp.setup({ + completion = { + completeopt = "menu,menuone,preview,noselect", + }, - window = { - documentation = cmp.config.window.bordered(), - completion = cmp.config.window.bordered({ - winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", - }), - }, + window = { + documentation = cmp.config.window.bordered(), + completion = cmp.config.window.bordered({ + winhighlight = "Normal:CmpPmenu,CursorLine:PmenuSel,Search:None", + }), + }, - snippet = { -- configure how nvim-cmp interacts with snippet engine - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, + snippet = { -- configure how nvim-cmp interacts with snippet engine + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_next_item({ behavior = cmp.ConfirmBehavior.Select }), -- next suggestion - [""] = cmp.mapping.select_prev_item({ behavior = cmp.ConfirmBehavior.Select }), -- prev suggestion - [""] = cmp.mapping.scroll_docs(4, { behavior = cmp.ConfirmBehavior.Select }), -- docs forward - [""] = cmp.mapping.scroll_docs(-4, { behavior = cmp.ConfirmBehavior.Select }), -- docs back - [""] = cmp.mapping.complete(), -- show completion suggestions - [""] = cmp.mapping.abort(), -- close completion window - [""] = cmp.mapping.confirm({ select = false }), -- autocomplete if selected + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_next_item({ behavior = cmp.ConfirmBehavior.Select }), -- next suggestion + [""] = cmp.mapping.select_prev_item({ behavior = cmp.ConfirmBehavior.Select }), -- prev suggestion + [""] = cmp.mapping.scroll_docs(4, { behavior = cmp.ConfirmBehavior.Select }), -- docs forward + [""] = cmp.mapping.scroll_docs(-4, { behavior = cmp.ConfirmBehavior.Select }), -- docs back + [""] = cmp.mapping.complete(), -- show completion suggestions + [""] = cmp.mapping.abort(), -- close completion window + [""] = cmp.mapping.confirm({ select = false }), -- autocomplete if selected -- Mapping for Tab key [""] = cmp.mapping(function(fallback) if cmp.visible() then @@ -86,46 +86,46 @@ return { -- Otherwise, fallback (insert a tab character) fallback() end - end, { "i", "s" }) - }), + end, { "i", "s" }), + }), - -- sources for autocompletion - sources = cmp.config.sources({ - { name = "nvim_lsp" }, -- lsp - { name = "luasnip" }, -- snippets - { name = "buffer" }, -- text within current buffer - { name = "path" }, -- file system paths - { name = 'nvim_lsp_signature_help' }, -- signature help - }), + -- sources for autocompletion + sources = cmp.config.sources({ + { name = "nvim_lsp" }, -- lsp + { name = "luasnip" }, -- snippets + { name = "buffer" }, -- text within current buffer + { name = "path" }, -- file system paths + { name = "nvim_lsp_signature_help" }, -- signature help + }), - formatting = { - fields = { "kind", "abbr", "menu" }, - format = lspkind.cmp_format({ - mode = "symbol", -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - -- can also be a function to dynamically calculate max width such as - -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, - ellipsis_char = "…", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) - show_labelDetails = true, -- show labelDetails in menu. Disabled by default + formatting = { + fields = { "kind", "abbr", "menu" }, + format = lspkind.cmp_format({ + mode = "symbol", -- show only symbol annotations + maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) + -- can also be a function to dynamically calculate max width such as + -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, + ellipsis_char = "…", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) + show_labelDetails = true, -- show labelDetails in menu. Disabled by default - -- The function below will be called before any actual modifications from lspkind - -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) - before = function(entry, vim_item) - return vim_item - end, - }), - }, - }) + -- The function below will be called before any actual modifications from lspkind + -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) + before = function(entry, vim_item) + return vim_item + end, + }), + }, + }) - local opts = { silent = true } - opts.desc = "next snippet placeholder" - vim.keymap.set({ "i", "s" }, "", function() - luasnip.jump(1) - end, opts) + local opts = { silent = true } + opts.desc = "next snippet placeholder" + vim.keymap.set({ "i", "s" }, "", function() + luasnip.jump(1) + end, opts) - opts.desc = "previous snippet placeholder" - vim.keymap.set({ "i", "s" }, "", function() - luasnip.jump(-1) - end, opts) - end, + opts.desc = "previous snippet placeholder" + vim.keymap.set({ "i", "s" }, "", function() + luasnip.jump(-1) + end, opts) + end, } diff --git a/nvim/lua/plugins/lsp/lsp-lines.lua b/nvim/lua/plugins/lsp/lsp-lines.lua index 3f2f33c..6b0114b 100755 --- a/nvim/lua/plugins/lsp/lsp-lines.lua +++ b/nvim/lua/plugins/lsp/lsp-lines.lua @@ -1,16 +1,16 @@ return { - ---------- for lsp diagnostic lines ---------- - "https://git.sr.ht/~whynothugo/lsp_lines.nvim", - event = "LspAttach", - config = function() - require("lsp_lines").setup() - vim.diagnostic.config({ virtual_lines = false }) + ---------- for lsp diagnostic lines ---------- + "https://git.sr.ht/~whynothugo/lsp_lines.nvim", + event = "LspAttach", + config = function() + require("lsp_lines").setup() + vim.diagnostic.config({ virtual_lines = false }) local lsplines = false - vim.keymap.set("n", "L", function () + vim.keymap.set("n", "L", function() lsplines = not lsplines vim.diagnostic.config({ virtual_text = not lsplines }) vim.diagnostic.config({ virtual_lines = lsplines }) - end, { desc = "Toggle lsp_lines" }) - end, + end, { desc = "Toggle lsp_lines" }) + end, } diff --git a/nvim/lua/plugins/lsp/luasnip.lua b/nvim/lua/plugins/lsp/luasnip.lua index 92ddc01..3f5bee3 100755 --- a/nvim/lua/plugins/lsp/luasnip.lua +++ b/nvim/lua/plugins/lsp/luasnip.lua @@ -1,12 +1,3 @@ return { - 'L3MON4D3/LuaSnip', - -- config = function() - -- local luasnip = require('luasnip') - -- -- luasnip.setup({ - -- -- region_check_events = "CursorMoved", - -- -- delete_check_events = "TextChanged", - -- -- }) - -- - -- require("luasnip.loaders.from_vscode").load({paths = "~/.config/nvim/my_snippets"}) - -- end + "L3MON4D3/LuaSnip", } diff --git a/nvim/lua/plugins/lsp/none-ls.lua b/nvim/lua/plugins/lsp/none-ls.lua index 49649f6..eb8e94f 100755 --- a/nvim/lua/plugins/lsp/none-ls.lua +++ b/nvim/lua/plugins/lsp/none-ls.lua @@ -1,56 +1,59 @@ +-- ┌ ┐ +-- │ Formatting, diagnostics │ +-- └ ┘ return { - "nvimtools/none-ls.nvim", + "nvimtools/none-ls.nvim", dependencies = { - 'nvimtools/none-ls-extras.nvim' + "nvimtools/none-ls-extras.nvim", }, - config = function() - local null_ls = require("null-ls") + config = function() + local null_ls = require("null-ls") - null_ls.setup({ - sources = { - null_ls.builtins.formatting.stylua, - null_ls.builtins.formatting.prettier.with({ - filetypes = { - "css", - "scss", - "less", - "html", - "json", - "yaml", - "markdown", - "graphql", - }, - extra_args = { - "--print-width", - "120", - "--tab-width", - "4", - "--bracket-spacing", - "true", - "--arrow-parens", - "avoid", - "--jsx-single-quote", - "true", - "--trailing-comma", - "es5", - "--no-semi", - "false", - "--single-quote", - "true", - "--bracket-same-line", - "true", - "--vue-indent-script-and-style", - "true", - }, - }), - null_ls.builtins.formatting.shfmt, + null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.prettier.with({ + filetypes = { + "css", + "scss", + "less", + "html", + "json", + "yaml", + "markdown", + "graphql", + }, + extra_args = { + "--print-width", + "120", + "--tab-width", + "4", + "--bracket-spacing", + "true", + "--arrow-parens", + "avoid", + "--jsx-single-quote", + "true", + "--trailing-comma", + "es5", + "--no-semi", + "false", + "--single-quote", + "true", + "--bracket-same-line", + "true", + "--vue-indent-script-and-style", + "true", + }, + }), + null_ls.builtins.formatting.shfmt, null_ls.builtins.formatting.asmfmt, null_ls.builtins.code_actions.proselint, - require( 'none-ls.diagnostics.eslint_d' ), - require( 'none-ls.code_actions.eslint_d' ), - require( 'none-ls.formatting.eslint_d' ), - null_ls.builtins.formatting.black, - }, - }) - end, + require("none-ls.diagnostics.eslint_d"), + require("none-ls.code_actions.eslint_d"), + require("none-ls.formatting.eslint_d"), + null_ls.builtins.formatting.black, + }, + }) + end, } diff --git a/nvim/lua/plugins/lsp/treesitter.lua b/nvim/lua/plugins/lsp/treesitter.lua index 60874cf..deff9a8 100755 --- a/nvim/lua/plugins/lsp/treesitter.lua +++ b/nvim/lua/plugins/lsp/treesitter.lua @@ -1,30 +1,30 @@ return { - -- syntax highlighting - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { + -- syntax highlighting + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup({ + ensure_installed = { "asm", - "bash", - "c", - "cpp", + "bash", + "c", + "cpp", "css", "html", - "hyprlang", + "hyprlang", "java", "javadoc", - "javascript", + "javascript", "jsdoc", - "json", + "json", "jsonc", -- "latex", - "lua", + "lua", "markdown", "meson", "nginx", "php", - "python", + "python", "rasi", "requirements", "robots", @@ -35,20 +35,20 @@ return { "svelte", "swift", "toml", - "typescript", + "typescript", "tsx", "verilog", "vue", "xml", "yaml", - "zathurarc" - }, - sync_install = false, + "zathurarc", + }, + sync_install = false, - highlight = { - enable = true, - disable = { "tex" } - }, - }) - end, + highlight = { + enable = true, + disable = { "tex" }, + }, + }) + end, } diff --git a/nvim/lua/plugins/lsp/vimtex.lua b/nvim/lua/plugins/lsp/vimtex.lua index cb59ac3..8b336f0 100755 --- a/nvim/lua/plugins/lsp/vimtex.lua +++ b/nvim/lua/plugins/lsp/vimtex.lua @@ -1,15 +1,15 @@ return { "lervag/vimtex", config = function() - -- vimtex settings - -- vim.g.vimtex_view_method = 'startup' -- PDF viewer (example: zathura, or use 'skim' for macOS) - vim.g.vimtex_compiler_method = 'latexmk' -- Use latexmk for compilation - vim.g.vimtex_fold_enabled = 1 -- Enable folding for LaTeX sections - vim.g.vimtex_quickfix_mode = 0 -- Disable quickfix mode for compilation errors - -- Key Mappings for LaTeX workflow - vim.api.nvim_set_keymap('n', 'lc', ':VimtexCompile', {}) -- Compile LaTeX file - vim.api.nvim_set_keymap('n', 'lv', ':VimtexView', {}) -- View compiled PDF - vim.api.nvim_set_keymap('n', 'lq', ':VimtexStop', {}) -- Stop compilation + -- vimtex settings + -- vim.g.vimtex_view_method = 'zathura' -- PDF viewer (example: zathura, or use 'skim' for macOS) + vim.g.vimtex_compiler_method = "latexmk" -- Use latexmk for compilation + vim.g.vimtex_fold_enabled = 1 -- Enable folding for LaTeX sections + vim.g.vimtex_quickfix_mode = 0 -- Disable quickfix mode for compilation errors - end + -- ── Key Mappings for LaTeX workflow ────────────────────────────── + vim.api.nvim_set_keymap("n", "lc", ":VimtexCompile", {}) -- Compile LaTeX file + vim.api.nvim_set_keymap("n", "lv", ":VimtexView", {}) -- View compiled PDF + vim.api.nvim_set_keymap("n", "lq", ":VimtexStop", {}) -- Stop compilation + end, } diff --git a/nvim/lua/plugins/nav/bufremove.lua b/nvim/lua/plugins/nav/bufremove.lua index 067a7db..e3765c7 100755 --- a/nvim/lua/plugins/nav/bufremove.lua +++ b/nvim/lua/plugins/nav/bufremove.lua @@ -1,7 +1,12 @@ return { "echasnovski/mini.bufremove", - config = function () - _G.MiniBufremove = require( 'mini.bufremove' ); - vim.keymap.set( 'n', '', ':lua MiniBufremove.delete()', { silent = true, noremap = true, desc = 'Remove buffer' } ); + config = function() + _G.MiniBufremove = require("mini.bufremove") + vim.keymap.set( + "n", + "", + ":lua MiniBufremove.delete()", + { silent = true, noremap = true, desc = "Remove buffer" } + ) end, } diff --git a/nvim/lua/plugins/nav/lastplace.lua b/nvim/lua/plugins/nav/lastplace.lua index 2cacfe2..e4cff04 100755 --- a/nvim/lua/plugins/nav/lastplace.lua +++ b/nvim/lua/plugins/nav/lastplace.lua @@ -1,7 +1,7 @@ return { -- open file at previous position - 'ethanholz/nvim-lastplace', + "ethanholz/nvim-lastplace", config = function() - require('nvim-lastplace').setup{} + require("nvim-lastplace").setup({}) end, } diff --git a/nvim/lua/plugins/nav/navbuddy.lua b/nvim/lua/plugins/nav/navbuddy.lua index 74f3818..230b4a5 100755 --- a/nvim/lua/plugins/nav/navbuddy.lua +++ b/nvim/lua/plugins/nav/navbuddy.lua @@ -82,7 +82,7 @@ return { ["h"] = actions.parent(), -- Move to left panel ["l"] = actions.children(), -- Move to right panel - ["0"] = actions.root(), -- Move to first panel + ["0"] = actions.root(), -- Move to first panel [""] = actions.visual_name(), -- Visual selection of name [""] = actions.visual_scope(), -- Visual selection of scope @@ -141,6 +141,6 @@ return { custom_hl_group = nil, -- "Visual" or any other hl group to use instead of inverted colors }) - vim.keymap.set("n", "n", ":Navbuddy", { silent = true, desc = "open navbuddy menu" }) + vim.keymap.set("n", "n", ":Navbuddy", { silent = true, desc = "open navbuddy menu" }) end, } diff --git a/nvim/lua/plugins/nav/neotree.lua b/nvim/lua/plugins/nav/neotree.lua index 5245762..648dafc 100755 --- a/nvim/lua/plugins/nav/neotree.lua +++ b/nvim/lua/plugins/nav/neotree.lua @@ -1,336 +1,336 @@ return { - "nvim-neo-tree/neo-tree.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended - "MunifTanjim/nui.nvim", - -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information - }, - lazy = false, -- neo-tree will lazily load itself - config = function() - -- Automatically open up - require("neo-tree").setup({ - close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab - popup_border_style = "rounded", - enable_git_status = true, - enable_diagnostics = true, - use_default_mappings = false, - open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes - open_files_using_relative_paths = false, - sort_case_insensitive = false, -- used when sorting files and directories in the tree - -- sort_function = nil, -- use a custom function for sorting files and directories in the tree - sort_function = function(a, b) -- natural sort - if a.type == b.type then - local ap = a.path:lower() - local bp = b.path:lower() + "nvim-neo-tree/neo-tree.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended + "MunifTanjim/nui.nvim", + -- {"3rd/image.nvim", opts = {}}, -- Optional image support in preview window: See `# Preview Mode` for more information + }, + lazy = false, -- neo-tree will lazily load itself + config = function() + -- Automatically open up + require("neo-tree").setup({ + close_if_last_window = true, -- Close Neo-tree if it is the last window left in the tab + popup_border_style = "rounded", + enable_git_status = true, + enable_diagnostics = true, + use_default_mappings = false, + open_files_do_not_replace_types = { "terminal", "trouble", "qf" }, -- when opening files, do not use windows containing these filetypes or buftypes + open_files_using_relative_paths = false, + sort_case_insensitive = false, -- used when sorting files and directories in the tree + -- sort_function = nil, -- use a custom function for sorting files and directories in the tree + sort_function = function(a, b) -- natural sort + if a.type == b.type then + local ap = a.path:lower() + local bp = b.path:lower() - if ap == bp then - return false - end + if ap == bp then + return false + end - for i = 1, math.max(string.len(ap), string.len(bp)), 1 do - local l = string.sub(ap, i, -1) - local r = string.sub(bp, i, -1) + for i = 1, math.max(string.len(ap), string.len(bp)), 1 do + local l = string.sub(ap, i, -1) + local r = string.sub(bp, 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 + 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 - else - return a.type < b.type - end - end, - default_component_configs = { - container = { - enable_character_fade = true, - }, - indent = { - indent_size = 2, - padding = 1, -- extra padding on left hand side - -- indent guides - with_markers = true, - indent_marker = "│", - last_indent_marker = "└", - highlight = "NeoTreeIndentMarker", - -- expander config, needed for nesting files - with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders - expander_collapsed = "", - expander_expanded = "", - expander_highlight = "NeoTreeExpander", - }, - icon = { - folder_closed = "", - folder_open = "", - folder_empty = "󰜌", - provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available - if node.type == "file" or node.type == "terminal" then - local success, web_devicons = pcall(require, "nvim-web-devicons") - local name = node.type == "terminal" and "terminal" or node.name - if success then - local devicon, hl = web_devicons.get_icon(name) - icon.text = devicon or icon.text - icon.highlight = hl or icon.highlight - end - end - end, - -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there - -- then these will never be used. - default = "*", - highlight = "NeoTreeFileIcon", - }, - modified = { - symbol = "[+]", - highlight = "NeoTreeModified", - }, - name = { - trailing_slash = true, - use_git_status_colors = true, - highlight = "NeoTreeFileName", - }, - git_status = { - symbols = { - -- Change type - added = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name - modified = "", -- or "", but this is redundant info if you use git_status_colors on the name - deleted = "✖", -- this can only be used in the git_status source - renamed = "󰁕", -- this can only be used in the git_status source - -- Status type - untracked = "", - ignored = "", - unstaged = "󰄱", - staged = "", - conflict = "", - }, - }, - -- If you don't want to use these columns, you can set `enabled = false` for each of them individually - file_size = { - enabled = true, - width = 12, -- width of the column - required_width = 64, -- min width of window required to show this column - }, - type = { - enabled = true, - width = 10, -- width of the column - required_width = 122, -- min width of window required to show this column - }, - last_modified = { - enabled = true, - width = 20, -- width of the column - required_width = 88, -- min width of window required to show this column - }, - created = { - enabled = true, - width = 20, -- width of the column - required_width = 110, -- min width of window required to show this column - }, - symlink_target = { - enabled = false, - }, - }, - -- A list of functions, each representing a global custom command - -- that will be available in all sources (if not overridden in `opts[source_name].commands`) - -- see `:h neo-tree-custom-commands-global` - commands = {}, - window = { - position = "left", - width = 40, - mapping_options = { - noremap = true, - nowait = true, - }, - mappings = { - ["<2-LeftMouse>"] = "open", - [""] = "open", - ["o"] = "open", - [""] = "cancel", -- close preview or floating neo-tree window - ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, - -- Read `# Preview Mode` for more information - ["l"] = "focus_preview", - ["S"] = "open_split", - ["v"] = "open_vsplit", - ["t"] = "open_tabnew", - ["w"] = "open_with_window_picker", - ["C"] = "close_node", - -- ['C'] = 'close_all_subnodes', - ["z"] = "close_all_nodes", - --["Z"] = "expand_all_nodes", - ["q"] = "close_window", - ["R"] = "refresh", - ["?"] = "show_help", - ["<"] = "prev_source", - [">"] = "next_source", - ["i"] = "show_file_details", - }, - }, - nesting_rules = {}, - filesystem = { - scan_mode = 'deep', - filtered_items = { - visible = false, -- when true, they will just be displayed differently than normal items - hide_dotfiles = true, - hide_gitignored = true, - hide_hidden = true, -- only works on Windows for hidden files/directories - hide_by_name = { - --"node_modules" - }, - hide_by_pattern = { -- uses glob style patterns - --"*.meta", - --"*/src/*/tsconfig.json", - }, - always_show = { -- remains visible even if other settings would normally hide it - --".gitignored", - }, - always_show_by_pattern = { -- uses glob style patterns - --".env*", - }, - never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show - --".DS_Store", - --"thumbs.db" - }, - never_show_by_pattern = { -- uses glob style patterns - --".null-ls_*", - }, - }, - follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time - -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` - }, - group_empty_dirs = true, -- when true, empty folders will be grouped together - hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree - -- in whatever position is specified in window.position - -- "open_current", -- netrw disabled, opening a directory opens within the - -- window like netrw would, regardless of window.position - -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs - use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes - -- instead of relying on nvim autocmd events. - window = { - mappings = { - ["a"] = { - "add", - -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details - -- some commands may take optional config options, see `:h neo-tree-mappings` for details - config = { - show_path = "none", -- "none", "relative", "absolute" - }, - }, - ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. - ["d"] = "delete", - ["r"] = "rename", - ["b"] = "rename_basename", - ["y"] = "copy_to_clipboard", - ["x"] = "cut_to_clipboard", - ["p"] = "paste_from_clipboard", - ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": - ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". - [""] = "navigate_up", - ["."] = "set_root", - ["H"] = "toggle_hidden", - ["/"] = "fuzzy_finder", - ["D"] = "fuzzy_finder_directory", - ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm - -- ["D"] = "fuzzy_sorter_directory", - ["f"] = "filter_on_submit", - [""] = "clear_filter", - ["[g"] = "prev_git_modified", - ["]g"] = "next_git_modified", - ["s"] = { - "show_help", - nowait = false, - config = { title = "Order by", prefix_key = "s" }, - }, - ["sc"] = { "order_by_created", nowait = false }, - ["sd"] = { "order_by_diagnostics", nowait = false }, - ["sg"] = { "order_by_git_status", nowait = false }, - ["sm"] = { "order_by_modified", nowait = false }, - ["sn"] = { "order_by_name", nowait = false }, - ["ss"] = { "order_by_size", nowait = false }, - ["st"] = { "order_by_type", nowait = false }, - -- [''] = function(state) ... end, - }, - fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode - [""] = "move_cursor_down", - [""] = "move_cursor_down", - [""] = "move_cursor_up", - [""] = "move_cursor_up", - [""] = "close", - -- [''] = function(state, scroll_padding) ... end, - }, - }, + 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 + else + return a.type < b.type + end + end, + default_component_configs = { + container = { + enable_character_fade = true, + }, + indent = { + indent_size = 2, + padding = 1, -- extra padding on left hand side + -- indent guides + with_markers = true, + indent_marker = "│", + last_indent_marker = "└", + highlight = "NeoTreeIndentMarker", + -- expander config, needed for nesting files + with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders + expander_collapsed = "", + expander_expanded = "", + expander_highlight = "NeoTreeExpander", + }, + icon = { + folder_closed = "", + folder_open = "", + folder_empty = "󰜌", + provider = function(icon, node, state) -- default icon provider utilizes nvim-web-devicons if available + if node.type == "file" or node.type == "terminal" then + local success, web_devicons = pcall(require, "nvim-web-devicons") + local name = node.type == "terminal" and "terminal" or node.name + if success then + local devicon, hl = web_devicons.get_icon(name) + icon.text = devicon or icon.text + icon.highlight = hl or icon.highlight + end + end + end, + -- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there + -- then these will never be used. + default = "*", + highlight = "NeoTreeFileIcon", + }, + modified = { + symbol = "[+]", + highlight = "NeoTreeModified", + }, + name = { + trailing_slash = true, + use_git_status_colors = true, + highlight = "NeoTreeFileName", + }, + git_status = { + symbols = { + -- Change type + added = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name + modified = "", -- or "", but this is redundant info if you use git_status_colors on the name + deleted = "✖", -- this can only be used in the git_status source + renamed = "󰁕", -- this can only be used in the git_status source + -- Status type + untracked = "", + ignored = "", + unstaged = "󰄱", + staged = "", + conflict = "", + }, + }, + -- If you don't want to use these columns, you can set `enabled = false` for each of them individually + file_size = { + enabled = true, + width = 12, -- width of the column + required_width = 64, -- min width of window required to show this column + }, + type = { + enabled = true, + width = 10, -- width of the column + required_width = 122, -- min width of window required to show this column + }, + last_modified = { + enabled = true, + width = 20, -- width of the column + required_width = 88, -- min width of window required to show this column + }, + created = { + enabled = true, + width = 20, -- width of the column + required_width = 110, -- min width of window required to show this column + }, + symlink_target = { + enabled = false, + }, + }, + -- A list of functions, each representing a global custom command + -- that will be available in all sources (if not overridden in `opts[source_name].commands`) + -- see `:h neo-tree-custom-commands-global` + commands = {}, + window = { + position = "left", + width = 40, + mapping_options = { + noremap = true, + nowait = true, + }, + mappings = { + ["<2-LeftMouse>"] = "open", + [""] = "open", + ["o"] = "open", + [""] = "cancel", -- close preview or floating neo-tree window + ["P"] = { "toggle_preview", config = { use_float = true, use_image_nvim = true } }, + -- Read `# Preview Mode` for more information + ["l"] = "focus_preview", + ["S"] = "open_split", + ["v"] = "open_vsplit", + ["t"] = "open_tabnew", + ["w"] = "open_with_window_picker", + ["C"] = "close_node", + -- ['C'] = 'close_all_subnodes', + ["z"] = "close_all_nodes", + --["Z"] = "expand_all_nodes", + ["q"] = "close_window", + ["R"] = "refresh", + ["?"] = "show_help", + ["<"] = "prev_source", + [">"] = "next_source", + ["i"] = "show_file_details", + }, + }, + nesting_rules = {}, + filesystem = { + scan_mode = "deep", + filtered_items = { + visible = false, -- when true, they will just be displayed differently than normal items + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + --"node_modules" + }, + hide_by_pattern = { -- uses glob style patterns + --"*.meta", + --"*/src/*/tsconfig.json", + }, + always_show = { -- remains visible even if other settings would normally hide it + --".gitignored", + }, + always_show_by_pattern = { -- uses glob style patterns + --".env*", + }, + never_show = { -- remains hidden even if visible is toggled to true, this overrides always_show + --".DS_Store", + --"thumbs.db" + }, + never_show_by_pattern = { -- uses glob style patterns + --".null-ls_*", + }, + }, + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = true, -- when true, empty folders will be grouped together + hijack_netrw_behavior = "open_default", -- netrw disabled, opening a directory opens neo-tree + -- in whatever position is specified in window.position + -- "open_current", -- netrw disabled, opening a directory opens within the + -- window like netrw would, regardless of window.position + -- "disabled", -- netrw left alone, neo-tree does not handle opening dirs + use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes + -- instead of relying on nvim autocmd events. + window = { + mappings = { + ["a"] = { + "add", + -- this command supports BASH style brace expansion ("x{a,b,c}" -> xa,xb,xc). see `:h neo-tree-file-actions` for details + -- some commands may take optional config options, see `:h neo-tree-mappings` for details + config = { + show_path = "none", -- "none", "relative", "absolute" + }, + }, + ["A"] = "add_directory", -- also accepts the optional config.show_path option like "add". this also supports BASH style brace expansion. + ["d"] = "delete", + ["r"] = "rename", + ["b"] = "rename_basename", + ["y"] = "copy_to_clipboard", + ["x"] = "cut_to_clipboard", + ["p"] = "paste_from_clipboard", + ["c"] = "copy", -- takes text input for destination, also accepts the optional config.show_path option like "add": + ["m"] = "move", -- takes text input for destination, also accepts the optional config.show_path option like "add". + [""] = "navigate_up", + ["."] = "set_root", + ["H"] = "toggle_hidden", + ["/"] = "fuzzy_finder", + ["D"] = "fuzzy_finder_directory", + ["#"] = "fuzzy_sorter", -- fuzzy sorting using the fzy algorithm + -- ["D"] = "fuzzy_sorter_directory", + ["f"] = "filter_on_submit", + [""] = "clear_filter", + ["[g"] = "prev_git_modified", + ["]g"] = "next_git_modified", + ["s"] = { + "show_help", + nowait = false, + config = { title = "Order by", prefix_key = "s" }, + }, + ["sc"] = { "order_by_created", nowait = false }, + ["sd"] = { "order_by_diagnostics", nowait = false }, + ["sg"] = { "order_by_git_status", nowait = false }, + ["sm"] = { "order_by_modified", nowait = false }, + ["sn"] = { "order_by_name", nowait = false }, + ["ss"] = { "order_by_size", nowait = false }, + ["st"] = { "order_by_type", nowait = false }, + -- [''] = function(state) ... end, + }, + fuzzy_finder_mappings = { -- define keymaps for filter popup window in fuzzy_finder_mode + [""] = "move_cursor_down", + [""] = "move_cursor_down", + [""] = "move_cursor_up", + [""] = "move_cursor_up", + [""] = "close", + -- [''] = function(state, scroll_padding) ... end, + }, + }, - commands = {}, -- Add a custom command or override a global one using the same function name - }, - buffers = { - follow_current_file = { - enabled = true, -- This will find and focus the file in the active buffer every time - -- -- the current file is changed while the tree is open. - leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` - }, - group_empty_dirs = true, -- when true, empty folders will be grouped together - show_unloaded = true, - window = { - mappings = { - ["d"] = "buffer_delete", - ["bd"] = "buffer_delete", - [""] = "navigate_up", - ["."] = "set_root", - ["s"] = { - "show_help", - nowait = false, - config = { title = "Order by", prefix_key = "s" }, - }, - ["sc"] = { "order_by_created", nowait = false }, - ["sd"] = { "order_by_diagnostics", nowait = false }, - ["sm"] = { "order_by_modified", nowait = false }, - ["sn"] = { "order_by_name", nowait = false }, - ["ss"] = { "order_by_size", nowait = false }, - ["st"] = { "order_by_type", nowait = false }, - }, - }, - }, - git_status = { - window = { - position = "float", - mappings = { - ["A"] = "git_add_all", - ["u"] = "git_unstage_file", - ["a"] = "git_add_file", - ["r"] = "git_revert_file", - ["c"] = "git_commit", - ["p"] = "git_push", - ["g"] = "git_commit_and_push", - ["s"] = { - "show_help", - nowait = false, - config = { title = "Order by", prefix_key = "s" }, - }, - ["sc"] = { "order_by_created", nowait = false }, - ["sd"] = { "order_by_diagnostics", nowait = false }, - ["sm"] = { "order_by_modified", nowait = false }, - ["sn"] = { "order_by_name", nowait = false }, - ["ss"] = { "order_by_size", nowait = false }, - ["st"] = { "order_by_type", nowait = false }, - }, - }, - }, - }) + commands = {}, -- Add a custom command or override a global one using the same function name + }, + buffers = { + follow_current_file = { + enabled = true, -- This will find and focus the file in the active buffer every time + -- -- the current file is changed while the tree is open. + leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal` + }, + group_empty_dirs = true, -- when true, empty folders will be grouped together + show_unloaded = true, + window = { + mappings = { + ["d"] = "buffer_delete", + ["bd"] = "buffer_delete", + [""] = "navigate_up", + ["."] = "set_root", + ["s"] = { + "show_help", + nowait = false, + config = { title = "Order by", prefix_key = "s" }, + }, + ["sc"] = { "order_by_created", nowait = false }, + ["sd"] = { "order_by_diagnostics", nowait = false }, + ["sm"] = { "order_by_modified", nowait = false }, + ["sn"] = { "order_by_name", nowait = false }, + ["ss"] = { "order_by_size", nowait = false }, + ["st"] = { "order_by_type", nowait = false }, + }, + }, + }, + git_status = { + window = { + position = "float", + mappings = { + ["A"] = "git_add_all", + ["u"] = "git_unstage_file", + ["a"] = "git_add_file", + ["r"] = "git_revert_file", + ["c"] = "git_commit", + ["p"] = "git_push", + ["g"] = "git_commit_and_push", + ["s"] = { + "show_help", + nowait = false, + config = { title = "Order by", prefix_key = "s" }, + }, + ["sc"] = { "order_by_created", nowait = false }, + ["sd"] = { "order_by_diagnostics", nowait = false }, + ["sm"] = { "order_by_modified", nowait = false }, + ["sn"] = { "order_by_name", nowait = false }, + ["ss"] = { "order_by_size", nowait = false }, + ["st"] = { "order_by_type", nowait = false }, + }, + }, + }, + }) - vim.keymap.set("n", "e", "Neotree", { silent = true, desc = "Open Neotree" }) - vim.keymap.set( - "n", - "g", - "Neotree source=git_status position=float", - { silent = true, desc = "Open git view" } - ) - end, + vim.keymap.set("n", "e", "Neotree", { silent = true, desc = "Open Neotree" }) + vim.keymap.set( + "n", + "g", + "Neotree source=git_status position=float", + { silent = true, desc = "Open git view" } + ) + end, } diff --git a/nvim/lua/plugins/nav/telescope.lua b/nvim/lua/plugins/nav/telescope.lua index 49a4e82..bd6b0fd 100755 --- a/nvim/lua/plugins/nav/telescope.lua +++ b/nvim/lua/plugins/nav/telescope.lua @@ -1,68 +1,68 @@ return { - -- fuzzy finder - "nvim-telescope/telescope.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - }, - config = function() - local builtin = require("telescope.builtin") - local actions = require("telescope.actions") - local opts = { silent = true } + -- fuzzy finder + "nvim-telescope/telescope.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + local builtin = require("telescope.builtin") + local actions = require("telescope.actions") + local opts = { silent = true } - require("telescope").setup({ - defaults = { - mappings = { - i = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.send_selected_to_qflist + actions.open_qflist, -- TODO investigate - }, - }, - }, - }) + require("telescope").setup({ + defaults = { + mappings = { + i = { + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + [""] = actions.send_selected_to_qflist + actions.open_qflist, -- TODO investigate + }, + }, + }, + }) - opts.desc = "telescope find files" - vim.keymap.set("n", "ff", builtin.find_files, opts) + opts.desc = "telescope find files" + vim.keymap.set("n", "ff", builtin.find_files, opts) - opts.desc = "telescope live grep" - vim.keymap.set("n", "fg", builtin.live_grep, opts) + opts.desc = "telescope live grep" + vim.keymap.set("n", "fg", builtin.live_grep, opts) - opts.desc = "telescope buffers" - vim.keymap.set("n", "fb", builtin.buffers, opts) + opts.desc = "telescope buffers" + vim.keymap.set("n", "fb", builtin.buffers, opts) - opts.desc = "Show nvim functions" - vim.keymap.set("n", "fh", builtin.help_tags, opts) + opts.desc = "Show nvim functions" + vim.keymap.set("n", "fh", builtin.help_tags, opts) -- Recent Commands opts.desc = "Show recent commands" - vim.keymap.set('n', 'frc', ':Telescope command_history', opts) + vim.keymap.set("n", "frc", ":Telescope command_history", opts) -- Recent Searches opts.desc = "Show recent searches" - vim.keymap.set('n', 'frs', ':Telescope search_history', opts) + vim.keymap.set("n", "frs", ":Telescope search_history", opts) -- Old Files opts.desc = "Show recent files" - vim.keymap.set('n', 'frf', ':Telescope oldfiles', opts) + vim.keymap.set("n", "frf", ":Telescope oldfiles", opts) -- Quickfix Items opts.desc = "Show quickfix items" - vim.keymap.set('n', 'fq', ':Telescope quickfix', opts) + vim.keymap.set("n", "fq", ":Telescope quickfix", opts) -- Spell Suggestions opts.desc = "Show spell suggestions" - vim.keymap.set('n', 'fs', ':Telescope spell_suggest', opts) + vim.keymap.set("n", "fs", ":Telescope spell_suggest", opts) -- Diagnostics opts.desc = "Show diagnostics" - vim.keymap.set('n', 'fd', ':Telescope diagnostics', opts) + vim.keymap.set("n", "fd", ":Telescope diagnostics", opts) -- Notifications opts.desc = "Show notifications" - vim.keymap.set('n', 'fn', ':Telescope notify', opts) + vim.keymap.set("n", "fn", ":Telescope notify", opts) -- Implementations opts.desc = "Show implementations" - vim.keymap.set('n', 'fi', ':Telescope lsp_implementations', opts) - end, + vim.keymap.set("n", "fi", ":Telescope lsp_implementations", opts) + end, } diff --git a/nvim/lua/plugins/nav/toggleterm.lua b/nvim/lua/plugins/nav/toggleterm.lua index e5d6478..f8773ac 100755 --- a/nvim/lua/plugins/nav/toggleterm.lua +++ b/nvim/lua/plugins/nav/toggleterm.lua @@ -1,17 +1,17 @@ return { - -- literally the name, quick term toggle - "akinsho/toggleterm.nvim", - version = "*", - config = function() - require("toggleterm").setup({ - insert_mappings = false, - terminal_mappings = false, - open_mapping = "t", - direction = "float", - float_opts = { - border = "curved", - }, - }) - vim.keymap.set("t", "", [[ToggleTerm]], {}) -- close terminal wih esc - end, + -- literally the name, quick term toggle + "akinsho/toggleterm.nvim", + version = "*", + config = function() + require("toggleterm").setup({ + insert_mappings = false, + terminal_mappings = false, + open_mapping = "t", + direction = "float", + float_opts = { + border = "curved", + }, + }) + vim.keymap.set("t", "", [[ToggleTerm]], {}) -- close terminal wih esc + end, } diff --git a/nvim/lua/plugins/nav/whichkey.lua b/nvim/lua/plugins/nav/whichkey.lua index 0b2f878..3aa1ccd 100755 --- a/nvim/lua/plugins/nav/whichkey.lua +++ b/nvim/lua/plugins/nav/whichkey.lua @@ -6,7 +6,5 @@ return { vim.o.timeout = true vim.o.timeoutlen = 500 end, - opts = { - - } + opts = {}, } diff --git a/nvim/lua/plugins/style/colorizer.lua b/nvim/lua/plugins/style/colorizer.lua index 41fa8a9..dfebe71 100755 --- a/nvim/lua/plugins/style/colorizer.lua +++ b/nvim/lua/plugins/style/colorizer.lua @@ -1,9 +1,9 @@ return { -- colorizes colors in code - 'NvChad/nvim-colorizer.lua' , + "NvChad/nvim-colorizer.lua", --cmd = 'ColorizerToggle', - config = function () - require("colorizer").setup { + config = function() + require("colorizer").setup({ filetypes = { "*" }, user_default_options = { RGB = true, -- #RGB hex codes - #FCE @@ -19,16 +19,16 @@ return { mode = "background", -- Set the display mode. -- Available methods are false / true / "normal" / "lsp" / "both" -- True is same as normal - tailwind = false, -- Enable tailwind colors + tailwind = false, -- Enable tailwind colors -- parsers can contain values used in |user_default_options| - sass = { enable = false, parsers = { "css" }, }, -- Enable sass colors + sass = { enable = false, parsers = { "css" } }, -- Enable sass colors virtualtext = "■", -- update color values even if buffer is not focused -- example use: cmp_menu, cmp_docs - always_update = false + always_update = false, }, -- all the sub-options of filetypes apply to buftypes buftypes = {}, - } + }) end, } diff --git a/nvim/lua/plugins/style/colors.lua b/nvim/lua/plugins/style/colors.lua index a419c0d..ca6c38f 100755 --- a/nvim/lua/plugins/style/colors.lua +++ b/nvim/lua/plugins/style/colors.lua @@ -13,44 +13,44 @@ return { functions = "italic", keywords = "italic", types = "italic", - } + }, }, palettes = { all = { - black = Shade.new("#404944", 0.15, -0.15), - gray = Shade.new("#505050", 0.15, -0.15), - white = Shade.new("#dee4df", 0.15, -0.15), - red = Shade.new("#ff6060", 0.15, -0.15), + black = Shade.new("#404944", 0.15, -0.15), + gray = Shade.new("#505050", 0.15, -0.15), + white = Shade.new("#dee4df", 0.15, -0.15), + red = Shade.new("#ff6060", 0.15, -0.15), darkred = Shade.new("#903030", 0.15, -0.15), strongred = Shade.new("#bb0000", 0.15, -0.15), - orange = Shade.new("#ce8c14", 0.15, -0.15), - green = Shade.new("#a3d397", 0.10, -0.15), + orange = Shade.new("#ce8c14", 0.15, -0.15), + green = Shade.new("#a3d397", 0.10, -0.15), darkgreen = Shade.new("#005602", 0.10, -0.15), darkyellow = Shade.new("#dfd100", 0.10, -0.15), - yellow = Shade.new("#e3c46d", 0.15, -0.15), + yellow = Shade.new("#e3c46d", 0.15, -0.15), darkblue = Shade.new("#1010cc", 0.15, -0.15), - blue = Shade.new("#7070dd", 0.15, -0.15), + blue = Shade.new("#7070dd", 0.15, -0.15), magenta = Shade.new("#C02490", 0.30, -0.15), - pink = Shade.new("#ff82c2", 0.15, -0.15), - purple = Shade.new("#761464", 0.15, -0.15), - cyan = Shade.new("#7ac9ff", 0.15, -0.15), + pink = Shade.new("#ff82c2", 0.15, -0.15), + purple = Shade.new("#761464", 0.15, -0.15), + cyan = Shade.new("#7ac9ff", 0.15, -0.15), lightblue = Shade.new("#5c77ff", 0.15, -0.15), softblue = Shade.new("#10ddff", 0.15, -0.15), brown = Shade.new("#553200", 0.15, -0.15), - bg0 = "#0f1512", -- Dark bg (status line and float) - bg1 = "#0f1512", -- Default bg - bg2 = "#1b211e", -- Lighter bg (colorcolm folds) - bg3 = "#252b28", -- Lighter bg (cursor line) - bg4 = "#303633", -- Conceal, border fg + bg0 = "#0f1512", -- Dark bg (status line and float) + bg1 = "#0f1512", -- Default bg + bg2 = "#1b211e", -- Lighter bg (colorcolm folds) + bg3 = "#252b28", -- Lighter bg (cursor line) + bg4 = "#303633", -- Conceal, border fg - fg0 = "#dee4df", -- Lighter fg - fg1 = "#dee4df", -- Default fg - fg2 = "#dee4df", -- Darker fg (status line) - fg3 = "#89938d", -- Darker fg (line numbers, fold colums) + fg0 = "#dee4df", -- Lighter fg + fg1 = "#dee4df", -- Default fg + fg2 = "#dee4df", -- Darker fg (status line) + fg3 = "#89938d", -- Darker fg (line numbers, fold colums) - sel0 = "#404944", -- Popup bg, visual selection - sel1 = "#00513b", -- Popup sel bg, search bg + sel0 = "#404944", -- Popup bg, visual selection + sel1 = "#00513b", -- Popup sel bg, search bg comment = "#89938d", }, @@ -77,7 +77,7 @@ return { statement = "magenta", string = "cyan", type = "red", - variable = "orange" + variable = "orange", }, diag = { error = "darkred", @@ -91,44 +91,44 @@ return { warn = "#a16b00", info = "cyan", hint = "bg3", - ok = "green"; + ok = "green", }, diff = { add = "darkgreen", delete = "darkred", changed = "lightblue", - text = "fg0" + text = "fg0", }, git = { add = "darkgreen", removed = "darkred", changed = "lightblue", conflict = "orange", - ignored = "gray" - } - } + ignored = "gray", + }, + }, }, groups = { all = { - Cursor = { fg = "palette.white", bg = "palette.lightblue" }, -- character under the cursor - WinSeparator = { fg = "palette.bg2" }, -- the column separating vertically split windows - EndOfBuffer = { link = "WinSeparator" }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. - CursorLine = { bg = "palette.bg1" }, - CursorLineNr = { fg = "palette.cyan", style = "bold" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. - Search = { fg = "palette.lightblue", bg = "#00513b" }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. - IncSearch = { fg = "palette.lightblue", bg = "#1a6b51" }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" - ModeMsg = { fg = "palette.fg3", style = "bold" }, -- 'showmode' message (e.g., "-- INSERT --") + Cursor = { fg = "palette.white", bg = "palette.lightblue" }, -- character under the cursor + WinSeparator = { fg = "palette.bg2" }, -- the column separating vertically split windows + EndOfBuffer = { link = "WinSeparator" }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|. + CursorLine = { bg = "palette.bg1" }, + CursorLineNr = { fg = "palette.cyan", style = "bold" }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. + Search = { fg = "palette.lightblue", bg = "#00513b" }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out. + IncSearch = { fg = "palette.lightblue", bg = "#1a6b51" }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c" + ModeMsg = { fg = "palette.fg3", style = "bold" }, -- 'showmode' message (e.g., "-- INSERT --") - NvimTreeRootFolder = { fg = "palette.lightblue", style = "bold" }, - NvimTreeFolderName = { fg = "palette.lightblue" }, - NvimTreeFolderIcon = { fg = "palette.lightblue" }, - NvimTreeOpenedFolderName = { fg = "palette.lightblue" }, + NvimTreeRootFolder = { fg = "palette.lightblue", style = "bold" }, + NvimTreeFolderName = { fg = "palette.lightblue" }, + NvimTreeFolderIcon = { fg = "palette.lightblue" }, + NvimTreeOpenedFolderName = { fg = "palette.lightblue" }, NvimTreeSymlinkFolderName = { fg = "palette.magenta" }, - NvimTreeExecFile = { fg = "palette.red" }, - NvimTreeImageFile = { fg = "palette.white" }, - NvimTreeSpecialFile = { fg = "palette.yellow" }, - NvimTreeSymlink = { fg = "palette.magenta" }, + NvimTreeExecFile = { fg = "palette.red" }, + NvimTreeImageFile = { fg = "palette.white" }, + NvimTreeSpecialFile = { fg = "palette.yellow" }, + NvimTreeSymlink = { fg = "palette.magenta" }, }, }, }) diff --git a/nvim/lua/plugins/style/comment-box.lua b/nvim/lua/plugins/style/comment-box.lua index f4e2be7..6a18867 100755 --- a/nvim/lua/plugins/style/comment-box.lua +++ b/nvim/lua/plugins/style/comment-box.lua @@ -45,17 +45,17 @@ return { local opts = { silent = true } opts.desc = "comment text box" - vim.keymap.set({"n", "v"}, "cb", ":CBccbox", opts) + vim.keymap.set({ "n", "v" }, "cb", ":CBccbox", opts) opts.desc = "comment text line" - vim.keymap.set({"n", "v"}, "cl", ":CBllline", opts) + vim.keymap.set({ "n", "v" }, "cl", ":CBllline", opts) opts.desc = "comment line" - vim.keymap.set({"n", "v"}, "ce", ":CBline", opts) + vim.keymap.set({ "n", "v" }, "ce", ":CBline", opts) opts.desc = "comment highlight" - vim.keymap.set({"n", "v"}, "ch", ":CBlcbox18", opts) + vim.keymap.set({ "n", "v" }, "ch", ":CBlcbox18", opts) opts.desc = "delete comment box" - vim.keymap.set({"n", "v"}, "cd", ":CBd", opts) + vim.keymap.set({ "n", "v" }, "cd", ":CBd", opts) opts.desc = "yank comment box contents" - vim.keymap.set({"n", "v"}, "cy", ":CBy", opts) + vim.keymap.set({ "n", "v" }, "cy", ":CBy", opts) end, } diff --git a/nvim/lua/plugins/style/comment.lua b/nvim/lua/plugins/style/comment.lua index 86e9525..1289f51 100755 --- a/nvim/lua/plugins/style/comment.lua +++ b/nvim/lua/plugins/style/comment.lua @@ -1,10 +1,10 @@ return { -- add comment keybinds - 'numToStr/Comment.nvim', + "numToStr/Comment.nvim", opts = {}, lazy = false, config = function() - require('Comment').setup() - require('Comment.ft').set('hyprlang', '#%s') - end + require("Comment").setup() + require("Comment.ft").set("hyprlang", "#%s") + end, } diff --git a/nvim/lua/plugins/style/dressing.lua b/nvim/lua/plugins/style/dressing.lua index ff47990..689baae 100755 --- a/nvim/lua/plugins/style/dressing.lua +++ b/nvim/lua/plugins/style/dressing.lua @@ -1,5 +1,5 @@ return { -- prettier prompts - 'stevearc/dressing.nvim', - event = 'VeryLazy', + "stevearc/dressing.nvim", + event = "VeryLazy", } diff --git a/nvim/lua/plugins/style/lualine.lua b/nvim/lua/plugins/style/lualine.lua index df3f94b..daa1033 100755 --- a/nvim/lua/plugins/style/lualine.lua +++ b/nvim/lua/plugins/style/lualine.lua @@ -1,7 +1,7 @@ return { -- status line - 'nvim-lualine/lualine.nvim', - dependencies = { 'nvim-tree/nvim-web-devicons' }, + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, config = function() local function getWords() local wc = vim.api.nvim_eval("wordcount()") @@ -11,45 +11,45 @@ return { return wc["words"] end end - require('lualine').setup { + require("lualine").setup({ options = { icons_enabled = true, theme = "auto", - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, + component_separators = { left = "", right = "" }, + section_separators = { left = "", right = "" }, disabled_filetypes = { statusline = {}, winbar = {}, }, - ignore_focus = { 'neo-tree' }, + ignore_focus = { "neo-tree" }, always_divide_middle = true, globalstatus = false, refresh = { statusline = 1000, tabline = 1000, winbar = 1000, - } + }, }, sections = { - lualine_a = { { 'mode', separator = { left = '', right = '' }, } }, - lualine_b = {'branch', 'diff', 'diagnostics'}, - lualine_c = {'filename'}, - lualine_x = { getWords, 'encoding', 'fileformat', 'filetype'}, - lualine_y = { { 'progress', left_padding=0 } }, - lualine_z = { { 'location', separator = { left = '', right = '' }, padding=0} } + lualine_a = { { "mode", separator = { left = "", right = "" } } }, + lualine_b = { "branch", "diff", "diagnostics" }, + lualine_c = { "filename" }, + lualine_x = { getWords, "encoding", "fileformat", "filetype" }, + lualine_y = { { "progress", left_padding = 0 } }, + lualine_z = { { "location", separator = { left = "", right = "" }, padding = 0 } }, }, inactive_sections = { lualine_a = {}, lualine_b = {}, - lualine_c = {'filename'}, - lualine_x = {'location'}, + lualine_c = { "filename" }, + lualine_x = { "location" }, lualine_y = {}, - lualine_z = {} + lualine_z = {}, }, tabline = {}, winbar = {}, inactive_winbar = {}, - extensions = {} - } + extensions = {}, + }) end, } diff --git a/nvim/lua/plugins/style/noice.lua b/nvim/lua/plugins/style/noice.lua index 791e426..221954d 100755 --- a/nvim/lua/plugins/style/noice.lua +++ b/nvim/lua/plugins/style/noice.lua @@ -1,38 +1,38 @@ return { - "folke/noice.nvim", - event = "VeryLazy", - opts = { - -- add any options here - }, - dependencies = { - -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries - "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", - }, - config = function() - require( 'notify' ).setup( { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + "rcarriga/nvim-notify", + }, + config = function() + require("notify").setup({ max_width = 80, minimum_width = 30, - render = 'wrapped-default', -- default, minimal, simple, compact, wrapped-compact or wrapped-default - stages = 'slide', -- fade_in_slide_out, fade, slide, static - } ); - require("noice").setup({ - lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp - }, - }, - -- you can enable a preset for easier configuration - presets = { - bottom_search = false, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim - lsp_doc_border = false, -- add a border to hover docs and signature help - }, - }) - end, + render = "wrapped-default", -- default, minimal, simple, compact, wrapped-compact or wrapped-default + stages = "slide", -- fade_in_slide_out, fade, slide, static + }) + require("noice").setup({ + lsp = { + -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp + }, + }, + -- you can enable a preset for easier configuration + presets = { + bottom_search = false, -- use a classic bottom cmdline for search + command_palette = true, -- position the cmdline and popupmenu together + long_message_to_split = true, -- long messages will be sent to a split + inc_rename = false, -- enables an input dialog for inc-rename.nvim + lsp_doc_border = false, -- add a border to hover docs and signature help + }, + }) + end, } diff --git a/nvim/lua/plugins/style/startup.lua b/nvim/lua/plugins/style/startup.lua index ebb7a51..f765f5c 100755 --- a/nvim/lua/plugins/style/startup.lua +++ b/nvim/lua/plugins/style/startup.lua @@ -11,39 +11,39 @@ return { type = "text", align = "center", content = { - [[]], - [[]], - [[]], - [[ ]], - [[ ██████ █████ █████ █████ ███ ]], - [[ ░░██████ ░░███ ░░███ ░░███ ░░░ ]], - [[ ░███░███ ░███ ██████ ██████ ░███ ░███ ████ █████████████ ]], - [[ ░███░░███░███ ███░░███ ███░░███ ░███ ░███ ░░███ ░░███░░███░░███ ]], - [[ ░███ ░░██████ ░███████ ░███ ░███ ░░███ ███ ░███ ░███ ░███ ░███ ]], - [[ ░███ ░░█████ ░███░░░ ░███ ░███ ░░░█████░ ░███ ░███ ░███ ░███ ]], - [[ █████ ░░█████░░██████ ░░██████ ░░███ █████ █████░███ █████ ]], - [[ ░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░ ░░░░░ ░░░░░ ░░░ ░░░░░ ]], - [[ ]], -}, + [[]], + [[]], + [[]], + [[ ]], + [[ ██████ █████ █████ █████ ███ ]], + [[ ░░██████ ░░███ ░░███ ░░███ ░░░ ]], + [[ ░███░███ ░███ ██████ ██████ ░███ ░███ ████ █████████████ ]], + [[ ░███░░███░███ ███░░███ ███░░███ ░███ ░███ ░░███ ░░███░░███░░███ ]], + [[ ░███ ░░██████ ░███████ ░███ ░███ ░░███ ███ ░███ ░███ ░███ ░███ ]], + [[ ░███ ░░█████ ░███░░░ ░███ ░███ ░░░█████░ ░███ ░███ ░███ ░███ ]], + [[ █████ ░░█████░░██████ ░░██████ ░░███ █████ █████░███ █████ ]], + [[ ░░░░░ ░░░░░ ░░░░░░ ░░░░░░ ░░░ ░░░░░ ░░░░░ ░░░ ░░░░░ ]], + [[ ]], + }, highlight = "String", - default_color = "#010155" + default_color = "#010155", }, quotes = { type = "text", align = "center", - content = function () + content = function() local handle = io.popen("pwd") if handle then local cwd = handle:read("*l") handle:close() - return {"Currently in " .. cwd} + return { "Currently in " .. cwd } else - return {"Error running command"} + return { "Error running command" } end end, highlight = "String", - default_color = "#FFFFFF" + default_color = "#FFFFFF", }, old = { @@ -58,12 +58,12 @@ return { }, options = { - mapping_keys = false; + mapping_keys = false, }, colors = { background = "#000000", - folded_section = "#100000" + folded_section = "#100000", }, mappings = { @@ -71,7 +71,7 @@ return { open_file = "", }, - parts = {"title", "quotes", "old"} + parts = { "title", "quotes", "old" }, }) end, } diff --git a/nvim/lua/plugins/testing/dap.lua b/nvim/lua/plugins/testing/dap.lua index e00b0ed..b8e2d71 100755 --- a/nvim/lua/plugins/testing/dap.lua +++ b/nvim/lua/plugins/testing/dap.lua @@ -47,10 +47,16 @@ return { dapui.close() end - vim.fn.sign_define("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""}) - vim.fn.sign_define("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""}) - vim.fn.sign_define("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""}) - vim.fn.sign_define('DapStopped', { text='', texthl='DapStopped', linehl='DapStopped', numhl= 'DapStopped' }) + vim.fn.sign_define("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = "" }) + vim.fn.sign_define( + "DapBreakpointCondition", + { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = "" } + ) + vim.fn.sign_define("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = "" }) + vim.fn.sign_define( + "DapStopped", + { text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" } + ) dap.configurations.python = { { @@ -91,7 +97,7 @@ return { else cb({ type = "executable", - command = vim.fn.stdpath("data") .. '/mason/packages/debugpy/venv/bin/python', + command = vim.fn.stdpath("data") .. "/mason/packages/debugpy/venv/bin/python", args = { "-m", "debugpy.adapter" }, options = { source_filetype = "python", diff --git a/nvim/lua/plugins/util/actions-preview.lua b/nvim/lua/plugins/util/actions-preview.lua index d298cf6..0a043e9 100755 --- a/nvim/lua/plugins/util/actions-preview.lua +++ b/nvim/lua/plugins/util/actions-preview.lua @@ -1,19 +1,19 @@ return { - "aznhe21/actions-preview.nvim", - config = function() - -- Configure actions-preview.nvim - require("actions-preview").setup({ - -- Floating window configuration (optional) - max_width = 80, -- Max width of the preview window - max_height = 12, -- Max height of the preview window - min_width = 20, -- Minimum width for the preview window - min_height = 4, -- Minimum height for the preview window + "aznhe21/actions-preview.nvim", + config = function() + -- Configure actions-preview.nvim + require("actions-preview").setup({ + -- Floating window configuration (optional) + max_width = 80, -- Max width of the preview window + max_height = 12, -- Max height of the preview window + min_width = 20, -- Minimum width for the preview window + min_height = 4, -- Minimum height for the preview window - -- Keymaps (optional) - keymaps = { - -- Trigger code action preview with a keybinding (example using a) - { "n", "ca", vim.lsp.buf.code_action }, - }, - }) - end, + -- Keymaps (optional) + keymaps = { + -- Trigger code action preview with a keybinding (example using a) + { "n", "ca", vim.lsp.buf.code_action }, + }, + }) + end, } diff --git a/nvim/lua/plugins/util/autopairs.lua b/nvim/lua/plugins/util/autopairs.lua index 194ca3b..6b8f5cc 100755 --- a/nvim/lua/plugins/util/autopairs.lua +++ b/nvim/lua/plugins/util/autopairs.lua @@ -1,65 +1,65 @@ return { - -- autoclose brackets and quotes - "windwp/nvim-autopairs", - event = "InsertEnter", - config = function() - require("nvim-autopairs").setup({ - fast_wrap = { - map = "", - chars = { "{", "[", "(", '"', "'", "`" }, - }, - }) + -- autoclose brackets and quotes + "windwp/nvim-autopairs", + event = "InsertEnter", + config = function() + require("nvim-autopairs").setup({ + fast_wrap = { + map = "", + chars = { "{", "[", "(", '"', "'", "`" }, + }, + }) - -- add spaces between parentheses - local npairs = require("nvim-autopairs") - local Rule = require("nvim-autopairs.rule") - local cond = require("nvim-autopairs.conds") + -- add spaces between parentheses + local npairs = require("nvim-autopairs") + local Rule = require("nvim-autopairs.rule") + local cond = require("nvim-autopairs.conds") - local brackets = { { "(", ")" }, { "[", "]" }, { "{", "}" } } - npairs.add_rules({ - -- Rule for a pair with left-side ' ' and right side ' ' - Rule(" ", " ") - -- Pair will only occur if the conditional function returns true - :with_pair(function(opts) - -- We are checking if we are inserting a space in (), [], or {} - local pair = opts.line:sub(opts.col - 1, opts.col) - return vim.tbl_contains({ - brackets[1][1] .. brackets[1][2], - brackets[2][1] .. brackets[2][2], - brackets[3][1] .. brackets[3][2], - }, pair) - end) - :with_move(cond.none()) - :with_cr(cond.none()) - -- We only want to delete the pair of spaces when the cursor is as such: ( | ) - :with_del( - function(opts) - local col = vim.api.nvim_win_get_cursor(0)[2] - local context = opts.line:sub(col - 1, col + 2) - return vim.tbl_contains({ - brackets[1][1] .. " " .. brackets[1][2], - brackets[2][1] .. " " .. brackets[2][2], - brackets[3][1] .. " " .. brackets[3][2], - }, context) - end - ), - }) - -- For each pair of brackets we will add another rule - for _, bracket in pairs(brackets) do - npairs.add_rules({ - -- Each of these rules is for a pair with left-side '( ' and right-side ' )' for each bracket type - Rule(bracket[1] .. " ", " " .. bracket[2]) - :with_pair(cond.none()) - :with_move(function(opts) - return opts.char == bracket[2] - end) - :with_del(cond.none()) - :use_key(bracket[2]) - -- Removes the trailing whitespace that can occur without this - :replace_map_cr(function(_) - return "2xiO" - end), - }) - end - end, + local brackets = { { "(", ")" }, { "[", "]" }, { "{", "}" } } + npairs.add_rules({ + -- Rule for a pair with left-side ' ' and right side ' ' + Rule(" ", " ") + -- Pair will only occur if the conditional function returns true + :with_pair(function(opts) + -- We are checking if we are inserting a space in (), [], or {} + local pair = opts.line:sub(opts.col - 1, opts.col) + return vim.tbl_contains({ + brackets[1][1] .. brackets[1][2], + brackets[2][1] .. brackets[2][2], + brackets[3][1] .. brackets[3][2], + }, pair) + end) + :with_move(cond.none()) + :with_cr(cond.none()) + -- We only want to delete the pair of spaces when the cursor is as such: ( | ) + :with_del( + function(opts) + local col = vim.api.nvim_win_get_cursor(0)[2] + local context = opts.line:sub(col - 1, col + 2) + return vim.tbl_contains({ + brackets[1][1] .. " " .. brackets[1][2], + brackets[2][1] .. " " .. brackets[2][2], + brackets[3][1] .. " " .. brackets[3][2], + }, context) + end + ), + }) + -- For each pair of brackets we will add another rule + for _, bracket in pairs(brackets) do + npairs.add_rules({ + -- Each of these rules is for a pair with left-side '( ' and right-side ' )' for each bracket type + Rule(bracket[1] .. " ", " " .. bracket[2]) + :with_pair(cond.none()) + :with_move(function(opts) + return opts.char == bracket[2] + end) + :with_del(cond.none()) + :use_key(bracket[2]) + -- Removes the trailing whitespace that can occur without this + :replace_map_cr(function(_) + return "2xiO" + end), + }) + end + end, } diff --git a/nvim/lua/plugins/util/autotag.lua b/nvim/lua/plugins/util/autotag.lua index 7a11c82..27f0c1b 100755 --- a/nvim/lua/plugins/util/autotag.lua +++ b/nvim/lua/plugins/util/autotag.lua @@ -1,13 +1,13 @@ return { "windwp/nvim-ts-autotag", - config = function () - require('nvim-ts-autotag').setup({ + config = function() + require("nvim-ts-autotag").setup({ opts = { -- Defaults enable_close = true, -- Auto close tags enable_rename = true, -- Auto rename pairs of tags - enable_close_on_slash = true -- Auto close on trailing cp', 'CccPick', { noremap = true, silent = true, desc = "Toggle colour picker" } ) - end + keymap.set( + "n", + "cp", + "CccPick", + { noremap = true, silent = true, desc = "Toggle colour picker" } + ) + end, } diff --git a/nvim/lua/plugins/util/fidget.lua b/nvim/lua/plugins/util/fidget.lua index 687be41..e75c012 100755 --- a/nvim/lua/plugins/util/fidget.lua +++ b/nvim/lua/plugins/util/fidget.lua @@ -6,9 +6,8 @@ return { notification = { window = { winblend = 0, - } - } + }, + }, }) - end - + end, } diff --git a/nvim/lua/plugins/util/indent-blankline.lua b/nvim/lua/plugins/util/indent-blankline.lua index 294d311..f463671 100755 --- a/nvim/lua/plugins/util/indent-blankline.lua +++ b/nvim/lua/plugins/util/indent-blankline.lua @@ -1,9 +1,9 @@ return { -- indent lines - 'lukas-reineke/indent-blankline.nvim', + "lukas-reineke/indent-blankline.nvim", opts = {}, - main = 'ibl', + main = "ibl", config = function() - require('ibl').setup() - end + require("ibl").setup() + end, } diff --git a/nvim/lua/plugins/util/markdown-preview.lua b/nvim/lua/plugins/util/markdown-preview.lua index f59ab53..de9f855 100755 --- a/nvim/lua/plugins/util/markdown-preview.lua +++ b/nvim/lua/plugins/util/markdown-preview.lua @@ -4,14 +4,16 @@ return { cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, ft = { "markdown" }, build = function(plugin) - if vim.fn.executable "npx" then - vim.cmd("!cd " .. plugin.dir .. " && cd app && npx --yes yarn install") - else - vim.cmd [[Lazy load markdown-preview.nvim]] - vim.fn["mkdp#util#install"]() - end + if vim.fn.executable("npx") then + vim.cmd("!cd " .. plugin.dir .. " && cd app && npx --yes yarn install") + else + vim.cmd([[Lazy load markdown-preview.nvim]]) + vim.fn["mkdp#util#install"]() + end end, init = function() - if vim.fn.executable "npx" then vim.g.mkdp_filetypes = { "markdown" } end + if vim.fn.executable("npx") then + vim.g.mkdp_filetypes = { "markdown" } + end end, } diff --git a/nvim/lua/plugins/util/multicursors.lua b/nvim/lua/plugins/util/multicursors.lua index 3e7cadc..efc6f26 100755 --- a/nvim/lua/plugins/util/multicursors.lua +++ b/nvim/lua/plugins/util/multicursors.lua @@ -2,16 +2,16 @@ return { "smoka7/multicursors.nvim", event = "VeryLazy", dependencies = { - 'nvimtools/hydra.nvim', + "nvimtools/hydra.nvim", }, opts = {}, - cmd = { 'MCstart', 'MCvisual', 'MCclear', 'MCpattern', 'MCvisualPattern', 'MCunderCursor' }, + cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" }, keys = { - { - mode = { 'v', 'n' }, - 'c', - 'MCstart', - desc = 'Create a selection for selected text or word under the cursor', - }, + { + mode = { "v", "n" }, + "c", + "MCstart", + desc = "Create a selection for selected text or word under the cursor", }, + }, } diff --git a/nvim/lua/plugins/util/neogen.lua b/nvim/lua/plugins/util/neogen.lua index 6124166..1737bf9 100755 --- a/nvim/lua/plugins/util/neogen.lua +++ b/nvim/lua/plugins/util/neogen.lua @@ -1,10 +1,10 @@ return { "danymat/neogen", - config = function () + config = function() local opts = { noremap = true, silent = true, desc = "Generate docs" } vim.api.nvim_set_keymap("n", "gd", ":lua require('neogen').generate()", opts) - require( 'neogen' ).setup( { - snippet_engine = "luasnip" - } ); - end + require("neogen").setup({ + snippet_engine = "luasnip", + }) + end, } diff --git a/nvim/lua/plugins/util/surround.lua b/nvim/lua/plugins/util/surround.lua index d4078fd..9cc7d6a 100755 --- a/nvim/lua/plugins/util/surround.lua +++ b/nvim/lua/plugins/util/surround.lua @@ -4,5 +4,5 @@ return { event = "VeryLazy", config = function() require("nvim-surround").setup() - end + end, } diff --git a/nvim/lua/utils.lua b/nvim/lua/utils.lua index 16a32fd..1437706 100755 --- a/nvim/lua/utils.lua +++ b/nvim/lua/utils.lua @@ -4,7 +4,7 @@ local M = {} M.opts = function(desc) if desc then - return { silent = true, desc = desc} + return { silent = true, desc = desc } else return { silent = true } end @@ -24,30 +24,33 @@ M.sudo_exec = function(cmd, print_output) print(out) return false end - if print_output then print("\r\n", out) end + if print_output then + print("\r\n", out) + end return true end M.sudo_write = function(tmpfile, filepath) - if not tmpfile then tmpfile = vim.fn.tempname() end - if not filepath then filepath = vim.fn.expand("%") end + if not tmpfile then + tmpfile = vim.fn.tempname() + end + if not filepath then + filepath = vim.fn.expand("%") + end if not filepath or #filepath == 0 then print("E32: No file name") return end -- `bs=1048576` is equivalent to `bs=1M` for GNU dd or `bs=1m` for BSD dd -- Both `bs=1M` and `bs=1m` are non-POSIX - local cmd = string.format("dd if=%s of=%s bs=1048576", - vim.fn.shellescape(tmpfile), - vim.fn.shellescape(filepath)) + local cmd = string.format("dd if=%s of=%s bs=1048576", vim.fn.shellescape(tmpfile), vim.fn.shellescape(filepath)) -- no need to check error as this fails the entire function vim.api.nvim_exec(string.format("write! %s", tmpfile), true) if M.sudo_exec(cmd) then -- refreshes the buffer and prints the "written" message vim.cmd.checktime() -- exit command mode - vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes( - "", true, false, true), "n", true) + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), "n", true) end vim.fn.delete(tmpfile) end