From d4cd8c5a74d3e92fa5d474163db5d21cadf3f50d Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Sat, 28 Jan 2023 19:06:51 +0100 Subject: [PATCH] retabbing, conjure, minor refactors --- .config/nvim/init.lua | 19 +- .config/nvim/lua/config/autocmdlist.lua | 120 ----- .config/nvim/lua/config/autocmds.lua | 124 +++++ .config/nvim/lua/config/filetypelist.lua | 28 -- .config/nvim/lua/config/filetypes.lua | 33 ++ .config/nvim/lua/config/iconlist.lua | 157 ------ .config/nvim/lua/config/icons.lua | 173 +++++++ .config/nvim/lua/config/keymaplist.lua | 428 ++++++++-------- .config/nvim/lua/config/options.lua | 4 +- .config/nvim/lua/funcs.lua | 314 ++++++------ .config/nvim/lua/plugins/config/alpha.lua | 64 +-- .config/nvim/lua/plugins/config/autopairs.lua | 42 +- .../nvim/lua/plugins/config/bufferline.lua | 242 ++++----- .config/nvim/lua/plugins/config/cmp.lua | 152 +++--- .config/nvim/lua/plugins/config/comment.lua | 10 +- .config/nvim/lua/plugins/config/dap.lua | 12 +- .config/nvim/lua/plugins/config/dapui.lua | 40 +- .config/nvim/lua/plugins/config/gitsigns.lua | 60 +-- .../nvim/lua/plugins/config/illuminate.lua | 56 +-- .config/nvim/lua/plugins/config/impatient.lua | 2 +- .../lua/plugins/config/indent-blankline.lua | 28 +- .config/nvim/lua/plugins/config/lf.lua | 12 +- .config/nvim/lua/plugins/config/lspconfig.lua | 130 ++--- .config/nvim/lua/plugins/config/lualine.lua | 280 +++++------ .config/nvim/lua/plugins/config/luasnip.lua | 20 +- .config/nvim/lua/plugins/config/mason.lua | 22 +- .config/nvim/lua/plugins/config/null-ls.lua | 14 +- .../lua/plugins/config/nvim-colorizer.lua | 16 +- .config/nvim/lua/plugins/config/project.lua | 12 +- .config/nvim/lua/plugins/config/telescope.lua | 110 ++-- .../nvim/lua/plugins/config/todo-comments.lua | 10 +- .../nvim/lua/plugins/config/toggleterm.lua | 40 +- .../nvim/lua/plugins/config/tokyonight.lua | 10 +- .../nvim/lua/plugins/config/treesitter.lua | 20 +- .config/nvim/lua/plugins/config/whichkey.lua | 90 ++-- .config/nvim/lua/plugins/init.lua | 472 +++++++++--------- .config/nvim/lua/plugins/test.fnl | 0 37 files changed, 1693 insertions(+), 1673 deletions(-) delete mode 100644 .config/nvim/lua/config/autocmdlist.lua create mode 100644 .config/nvim/lua/config/autocmds.lua delete mode 100644 .config/nvim/lua/config/filetypelist.lua create mode 100644 .config/nvim/lua/config/filetypes.lua delete mode 100644 .config/nvim/lua/config/iconlist.lua create mode 100644 .config/nvim/lua/config/icons.lua create mode 100644 .config/nvim/lua/plugins/test.fnl diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index e97ef9a1..2b3ca725 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,22 +1,11 @@ vim.defer_fn(function() - pcall(require, "impatient") + pcall(require, "impatient") end, 0) require('config.options') require('funcs').bootstrap() require('plugins') -require('config.autocmdlist') -require('config.filetypelist') +require('config.autocmds').setup() +require('config.filetypes').setup() +require('config.icons').setup() require('funcs').map('general') - -local icons = require('config.iconlist').diagnostics -local signs = { - DiagnosticSignError = icons.BoldError, - DiagnosticSignWarn = icons.BoldWarning, - DiagnosticSignHint = icons.BoldHint, - DiagnosticSignInfo = icons.BoldInformation -} -for type, icon in pairs(signs) do - local hl = type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) -end diff --git a/.config/nvim/lua/config/autocmdlist.lua b/.config/nvim/lua/config/autocmdlist.lua deleted file mode 100644 index ccf99bd3..00000000 --- a/.config/nvim/lua/config/autocmdlist.lua +++ /dev/null @@ -1,120 +0,0 @@ -local cmds = { - { -- Handles the automatic line numeration changes - { "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, - { - pattern = "*", - command = "if &nu && mode() != \"i\" | set rnu | endif" - } - }, - { -- Handles the automatic line numeration changes - { "BufLeave", "FocusLost", "InsertEnter", "WinLeave" }, - { - pattern = "*", - command = "if &nu | set nornu | endif" - } - }, - { - "BufWritePost", - { - pattern = { "bm-files", "bm-dirs" }, - command = "!shortcuts" - } - }, - { - { "BufRead", "BufNewFile" }, - { - pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, - command = "set filetype=xdefaults" - } - }, - { - "BufWritePost", - { - pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, - command = "!xrdb %" - } - }, - { - "BufWritePost", - { - pattern = "~/.local/src/dwmblocks/config.h", - command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }" - } - }, - { - "BufWritePost", - { - pattern = "*.java", - callback = function() - vim.lsp.codelens.refresh() - end - } - }, - { - { "BufDelete", "VimLeave" }, - { - pattern = "*.tex", - command = "!texclear \"%:p\"" - } - }, - { -- Use 'q' to quit from common plugins - 'FileType', - { - pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" }, - callback = function() - vim.cmd [[ - nnoremap q :close - set nobuflisted - ]] - end - } - }, - { - 'Filetype', - { - pattern = { "gitcommit", "markdown" }, - callback = function() - vim.opt_local.wrap = true - vim.opt_local.spell = true - end, - } - }, - { -- Automatically apply changes to plugins.lua - 'BufWritePost', - { - group = 'packer_user_config', - pattern = { "plugins.lua", "pluginlist.lua" }, - command = "source | PackerCompile" - } - }, - { -- Fix auto comment - 'BufWinEnter', - { - callback = function() - vim.cmd("set formatoptions-=cro") - end - } - }, - { -- Highlight yanked text - 'TextYankPost', - { - callback = function() - vim.highlight.on_yank({ higroup = "Visual", timeout = 200 }) - end - } - } -} - -vim.api.nvim_create_augroup('packer_user_config', { clear = true }) - -for _, entry in ipairs(cmds) do - local event = entry[1] - local opts = entry[2] - if type(opts.group) == "string" and opts.group ~= "" then - local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = opts.group }) - if not exists then - vim.api.nvim_create_augroup(opts.group, {}) - end - end - vim.api.nvim_create_autocmd(event, opts) -end diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua new file mode 100644 index 00000000..3a0b3b64 --- /dev/null +++ b/.config/nvim/lua/config/autocmds.lua @@ -0,0 +1,124 @@ +local M = {} +M.list = { + { -- Handles the automatic line numeration changes + { "BufEnter", "FocusGained", "InsertLeave", "WinEnter" }, + { + pattern = "*", + command = "if &nu && mode() != \"i\" | set rnu | endif" + } + }, + { -- Handles the automatic line numeration changes + { "BufLeave", "FocusLost", "InsertEnter", "WinLeave" }, + { + pattern = "*", + command = "if &nu | set nornu | endif" + } + }, + { + "BufWritePost", + { + pattern = { "bm-files", "bm-dirs" }, + command = "!shortcuts" + } + }, + { + { "BufRead", "BufNewFile" }, + { + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + command = "set filetype=xdefaults" + } + }, + { + "BufWritePost", + { + pattern = { "Xresources", "Xdefaults", "xresources", "xdefaults" }, + command = "!xrdb %" + } + }, + { + "BufWritePost", + { + pattern = "~/.local/src/dwmblocks/config.h", + command = "!cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }" + } + }, + { + "BufWritePost", + { + pattern = "*.java", + callback = function() + vim.lsp.codelens.refresh() + end + } + }, + { + { "BufDelete", "VimLeave" }, + { + pattern = "*.tex", + command = "!texclear \"%:p\"" + } + }, + { -- Use 'q' to quit from common plugins + 'FileType', + { + pattern = { "qf", "help", "man", "lspinfo", "spectre_panel", "lir" }, + callback = function() + vim.cmd [[ + nnoremap q :close + set nobuflisted + ]] + end + } + }, + { + 'Filetype', + { + pattern = { "gitcommit", "markdown" }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.spell = true + end, + } + }, + { -- Automatically apply changes to plugins.lua + 'BufWritePost', + { + group = 'packer_user_config', + pattern = { "plugins.lua", "pluginlist.lua" }, + command = "source | PackerCompile" + } + }, + { -- Fix auto comment + 'BufWinEnter', + { + callback = function() + vim.cmd("set formatoptions-=cro") + end + } + }, + { -- Highlight yanked text + 'TextYankPost', + { + callback = function() + vim.highlight.on_yank({ higroup = "Visual", timeout = 200 }) + end + } + } +} + +M.setup = function() + vim.api.nvim_create_augroup('packer_user_config', { clear = true }) + for _, entry in ipairs(M.list) do + local event = entry[1] + local opts = entry[2] + if type(opts.group) == "string" and opts.group ~= "" then + local exists, _ = pcall(vim.api.nvim_get_autocmds, { group = opts.group }) + if not exists then + vim.api.nvim_create_augroup(opts.group, {}) + end + end + vim.api.nvim_create_autocmd(event, opts) + end +end + +return M diff --git a/.config/nvim/lua/config/filetypelist.lua b/.config/nvim/lua/config/filetypelist.lua deleted file mode 100644 index 906bc93b..00000000 --- a/.config/nvim/lua/config/filetypelist.lua +++ /dev/null @@ -1,28 +0,0 @@ -local filetypes = { - { - extension = { - yml = function(path, bufnr) - if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' }, - { type = 'directory', upward = true }) and - vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then - return 'yaml.ansible' - else - return 'yaml' - end - end, - yaml = function(path, bufnr) - if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' }, - { type = 'directory', upward = true }) and - vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then - return 'yaml.ansible' - else - return 'yaml' - end - end - } - } -} - -for _, entry in pairs(filetypes) do - vim.filetype.add(entry) -end diff --git a/.config/nvim/lua/config/filetypes.lua b/.config/nvim/lua/config/filetypes.lua new file mode 100644 index 00000000..dce5453f --- /dev/null +++ b/.config/nvim/lua/config/filetypes.lua @@ -0,0 +1,33 @@ +local M = {} +M.list = { + { + extension = { + yml = function(path, bufnr) + if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' }, + { type = 'directory', upward = true }) and + vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then + return 'yaml.ansible' + else + return 'yaml' + end + end, + yaml = function(path, bufnr) + if vim.fs.find({ 'tasks', 'roles', 'handlers', 'group_vars', 'host_vars' }, + { type = 'directory', upward = true }) and + vim.fs.find({ 'ansible.cfg', '.ansible-lint' }, { upward = true }) then + return 'yaml.ansible' + else + return 'yaml' + end + end + } + } +} + +M.setup = function() + for _, entry in pairs(M.list) do + vim.filetype.add(entry) + end +end + +return M diff --git a/.config/nvim/lua/config/iconlist.lua b/.config/nvim/lua/config/iconlist.lua deleted file mode 100644 index 03298a23..00000000 --- a/.config/nvim/lua/config/iconlist.lua +++ /dev/null @@ -1,157 +0,0 @@ -return { - kind = { - Array = "", - Boolean = "蘒", - Class = "", - Color = "", - Constant = "", - Constructor = "", - Enum = "", - EnumMember = "", - Event = "", - Field = "", - File = "", - Folder = "", - Function = "", - Interface = "", - Key = "", - Keyword = "", - Method = "", - Module = "", - Namespace = "", - Null = "ﳠ", - Number = "", - Object = "", - Operator = "", - Package = "", - Property = "", - Reference = "", - Snippet = "", - String = "", - Struct = "", - Text = "", - TypeParameter = "", - Unit = "", - Value = "", - Variable = "", - }, - git = { - LineAdded = "", - LineModified = "", - LineRemoved = "", - FileDeleted = "", - FileIgnored = "", - FileRenamed = "", - FileStaged = "S", - FileUnmerged = "", - FileUnstaged = "", - FileUntracked = "U", - Diff = "", - Repo = "", - Octoface = "", - Branch = "", - }, - ui = { - ArrowCircleDown = "", - ArrowCircleLeft = "", - ArrowCircleRight = "", - ArrowCircleUp = "", - BoldArrowDown = "", - BoldArrowLeft = "", - BoldArrowRight = "", - BoldArrowUp = "", - BoldClose = "", - BoldDividerLeft = "", - BoldDividerRight = "", - BoldLineLeft = "▎", - BookMark = "", - BoxChecked = "", - Bug = "", - Stacks = " ", - Scopes = "", - Watches = "", - DebugConsole = " ", - Calendar = "", - Check = "", - ChevronRight = ">", - ChevronShortDown = "", - ChevronShortLeft = "", - ChevronShortRight = "", - ChevronShortUp = "", - Circle = "", - Close = "", - CloudDownload = "", - Code = "", - Comment = "", - Dashboard = "", - DividerLeft = "", - DividerRight = "", - DoubleChevronRight = "", - DoubleChevronLeft = "", - Ellipsis = "…", - EmptyFolder = "", - EmptyFolderOpen = "", - File = "", - FileSymlink = "", - Files = "", - FindFile = "", - FindText = "", - Fire = "", - Folder = "", - FolderOpen = "", - FolderSymlink = "", - Forward = "", - Gear = "", - History = "", - Lightbulb = "", - LineLeft = "▏", - LineMiddle = "│", - List = "", - Lock = "", - MinusCircle = "", - NewFile = "", - Note = "", - Package = "", - Pencil = "", - Plus = "", - Project = "", - Search = "", - SignIn = "", - SignOut = "", - Tab = "", - Table = "", - Target = "", - Telescope = "", - Text = "", - Tree = "", - Triangle = "契", - TriangleShortArrowDown = "", - TriangleShortArrowLeft = "", - TriangleShortArrowRight = "", - TriangleShortArrowUp = "", - }, - diagnostics = { - BoldError = "", - Error = "", - BoldWarning = "", - Warning = "", - BoldInformation = "", - Information = "", - BoldQuestion = "", - Question = "", - BoldHint = "", - Hint = "", - Debug = "", - Trace = "✎", - }, - progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" }, - misc = { - Robot = "ﮧ", - Squirrel = "", - Tag = "", - Watch = "", - Smiley = "ﲃ", - Package = "", - CircuitBoard = "", - }, -} diff --git a/.config/nvim/lua/config/icons.lua b/.config/nvim/lua/config/icons.lua new file mode 100644 index 00000000..1da91042 --- /dev/null +++ b/.config/nvim/lua/config/icons.lua @@ -0,0 +1,173 @@ +local M = {} +M.list = { + kind = { + Array = "", + Boolean = "蘒", + Class = "", + Color = "", + Constant = "", + Constructor = "", + Enum = "", + EnumMember = "", + Event = "", + Field = "", + File = "", + Folder = "", + Function = "", + Interface = "", + Key = "", + Keyword = "", + Method = "", + Module = "", + Namespace = "", + Null = "ﳠ", + Number = "", + Object = "", + Operator = "", + Package = "", + Property = "", + Reference = "", + Snippet = "", + String = "", + Struct = "", + Text = "", + TypeParameter = "", + Unit = "", + Value = "", + Variable = "", + }, + git = { + LineAdded = "", + LineModified = "", + LineRemoved = "", + FileDeleted = "", + FileIgnored = "", + FileRenamed = "", + FileStaged = "S", + FileUnmerged = "", + FileUnstaged = "", + FileUntracked = "U", + Diff = "", + Repo = "", + Octoface = "", + Branch = "", + }, + ui = { + ArrowCircleDown = "", + ArrowCircleLeft = "", + ArrowCircleRight = "", + ArrowCircleUp = "", + BoldArrowDown = "", + BoldArrowLeft = "", + BoldArrowRight = "", + BoldArrowUp = "", + BoldClose = "", + BoldDividerLeft = "", + BoldDividerRight = "", + BoldLineLeft = "▎", + BookMark = "", + BoxChecked = "", + Bug = "", + Stacks = " ", + Scopes = "", + Watches = "", + DebugConsole = " ", + Calendar = "", + Check = "", + ChevronRight = ">", + ChevronShortDown = "", + ChevronShortLeft = "", + ChevronShortRight = "", + ChevronShortUp = "", + Circle = "", + Close = "", + CloudDownload = "", + Code = "", + Comment = "", + Dashboard = "", + DividerLeft = "", + DividerRight = "", + DoubleChevronRight = "", + DoubleChevronLeft = "", + Ellipsis = "…", + EmptyFolder = "", + EmptyFolderOpen = "", + File = "", + FileSymlink = "", + Files = "", + FindFile = "", + FindText = "", + Fire = "", + Folder = "", + FolderOpen = "", + FolderSymlink = "", + Forward = "", + Gear = "", + History = "", + Lightbulb = "", + LineLeft = "▏", + LineMiddle = "│", + List = "", + Lock = "", + MinusCircle = "", + NewFile = "", + Note = "", + Package = "", + Pencil = "", + Plus = "", + Project = "", + Search = "", + SignIn = "", + SignOut = "", + Tab = "", + Table = "", + Target = "", + Telescope = "", + Text = "", + Tree = "", + Triangle = "契", + TriangleShortArrowDown = "", + TriangleShortArrowLeft = "", + TriangleShortArrowRight = "", + TriangleShortArrowUp = "", + }, + diagnostics = { + BoldError = "", + Error = "", + BoldWarning = "", + Warning = "", + BoldInformation = "", + Information = "", + BoldQuestion = "", + Question = "", + BoldHint = "", + Hint = "", + Debug = "", + Trace = "✎", + }, + progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" }, + misc = { + Robot = "ﮧ", + Squirrel = "", + Tag = "", + Watch = "", + Smiley = "ﲃ", + Package = "", + CircuitBoard = "", + }, +} +M.setup = function() + local icons = M.list.diagnostics + local signs = { + DiagnosticSignError = icons.BoldError, + DiagnosticSignWarn = icons.BoldWarning, + DiagnosticSignHint = icons.BoldHint, + DiagnosticSignInfo = icons.BoldInformation + } + for type, icon in pairs(signs) do + local hl = type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end +end + +return M diff --git a/.config/nvim/lua/config/keymaplist.lua b/.config/nvim/lua/config/keymaplist.lua index 4a83e8f4..f597ef0a 100644 --- a/.config/nvim/lua/config/keymaplist.lua +++ b/.config/nvim/lua/config/keymaplist.lua @@ -1,228 +1,228 @@ local M = {} M.maps = { - general = { - n = { -- normal mode - -- Better window navigation - { "", "h" }, - { "", "j" }, - { "", "k" }, - { "", "l" }, - -- Resize with arrows - { "", ":resize -2" }, - { "", ":resize +2" }, - { "", ":vertical resize -2" }, - { "", ":vertical resize +2" }, - -- Navigate buffers - { "", ":bnext" }, - { "", ":bprevious" }, - -- lsp - { "gD", "lua vim.lsp.buf.declaration()" }, - { "gd", "lua vim.lsp.buf.definition()" }, - { "K", "lua vim.lsp.buf.hover()" }, - { "gI", "lua vim.lsp.buf.implementation()" }, - { "gr", "lua vim.lsp.buf.references()" }, - { "gl", "lua vim.diagnostic.open_float()" }, + general = { + n = { -- normal mode + -- Better window navigation + { "", "h" }, + { "", "j" }, + { "", "k" }, + { "", "l" }, + -- Resize with arrows + { "", ":resize -2" }, + { "", ":resize +2" }, + { "", ":vertical resize -2" }, + { "", ":vertical resize +2" }, + -- Navigate buffers + { "", ":bnext" }, + { "", ":bprevious" }, + -- lsp + { "gD", "lua vim.lsp.buf.declaration()" }, + { "gd", "lua vim.lsp.buf.definition()" }, + { "K", "lua vim.lsp.buf.hover()" }, + { "gI", "lua vim.lsp.buf.implementation()" }, + { "gr", "lua vim.lsp.buf.references()" }, + { "gl", "lua vim.diagnostic.open_float()" }, + }, + i = { -- insert mode + -- Delete last word with ctrl + del + { "", "" }, + }, + v = { -- visual mode + -- Better paste + { "p", '"_dP' }, + -- Stay in indent mode + { "<", "", ">gv" }, + } }, - i = { -- insert mode - -- Delete last word with ctrl + del - { "", "" }, + illuminate = { + n = { + { "", "lua require('illuminate').next_reference{wrap=true}" }, + { "", "lua require('illuminate').next_reference{reverse=true,wrap=true}" }, + } }, - v = { -- visual mode - -- Better paste - { "p", '"_dP' }, - -- Stay in indent mode - { "<", "", ">gv" }, - } - }, - illuminate = { - n = { - { "", "lua require('illuminate').next_reference{wrap=true}" }, - { "", "lua require('illuminate').next_reference{reverse=true,wrap=true}" }, - } - }, } M.whichkey = { - general = { - n = { - ["w"] = { "w!", "Save" }, - ["q"] = { function() require("funcs").buf_kill() end, "Close" }, - ["f"] = { function() require("lf").start("~") end, "File Picker" }, - ["h"] = { "nohlsearch", "Clear Highlights" }, - u = { - name = "Utility", - c = { "w!!compiler \"%:p\"", "Compile" }, - }, - l = { - name = "LSP", - a = { function() vim.lsp.buf.code_action() end, "Code Action" }, - f = { function() require("funcs").format { async = true } end, "Format" }, - j = { function() vim.diagnostic.goto_next() end, "Next Diagnostic" }, - k = { function() vim.diagnostic.goto_prev() end, "Prev Diagnostic" }, - l = { function() vim.lsp.codelens.run() end, "CodeLens Action" }, - q = { function() vim.diagnostic.setloclist() end, "Quickfix" }, - r = { function() vim.lsp.buf.rename() end, "Rename" }, - } + general = { + n = { + ["w"] = { "w!", "Save" }, + ["q"] = { function() require("funcs").buf_kill() end, "Close" }, + ["f"] = { function() require("lf").start("~") end, "File Picker" }, + ["h"] = { "nohlsearch", "Clear Highlights" }, + u = { + name = "Utility", + c = { "w!!compiler \"%:p\"", "Compile" }, + }, + l = { + name = "LSP", + a = { function() vim.lsp.buf.code_action() end, "Code Action" }, + f = { function() require("funcs").format { async = true } end, "Format" }, + j = { function() vim.diagnostic.goto_next() end, "Next Diagnostic" }, + k = { function() vim.diagnostic.goto_prev() end, "Prev Diagnostic" }, + l = { function() vim.lsp.codelens.run() end, "CodeLens Action" }, + q = { function() vim.diagnostic.setloclist() end, "Quickfix" }, + r = { function() vim.lsp.buf.rename() end, "Rename" }, + } - } - }, - lspconfig = { - n = { - l = { - name = "LSP", - i = { "LspInfo", "Info" }, - } - } - }, - mason = { - n = { - l = { - name = "LSP", - I = { "Mason", "Mason Info" }, - } - } - }, - dap = { - n = { - d = { - name = "DAP", - b = { function() require("dap").toggle_breakpoint() end, "Toggle Breakpoint" }, - c = { function() require("dap").continue() end, "Continue" }, - i = { function() require("dap").step_into() end, "Step Into" }, - o = { function() require("dap").step_over() end, "Step Over" }, - O = { function() require("dap").step_out() end, "Step Out" }, - r = { function() require("dap").repl.toggle() end, "Toggle REPL" }, - l = { function() require("dap").run_last() end, "Run Last" }, - t = { function() require("dap").terminate() end, "Stop Debugger" }, - u = { function() require("dapui").toggle() end, "Toggle DAP UI" }, - } - } - }, - telescope = { - n = { - b = { - name = "Buffers", - f = { "Telescope buffers", "Find" }, - }, - g = { - name = "Git", - o = { "Telescope git_status", "Open changed file" }, - b = { "Telescope git_branches", "Checkout branch" }, - c = { "Telescope git_commits", "Checkout commit" }, - C = { "Telescope git_bcommits", "Checkout commit(for current file)" }, - }, - l = { - name = "LSP", - d = { "Telescope diagnostics bufnr=0 theme=get_ivy", "Buffer Diagnostics" }, - w = { "Telescope diagnostics", "Diagnostics" }, - s = { "Telescope lsp_document_symbols", "Document Symbols" }, - S = { "Telescope lsp_dynamic_workspace_symbols", "Workspace Symbols" }, - e = { "Telescope quickfix", "Telescope Quickfix" }, - }, - s = { - name = "Search", - c = { "Telescope colorscheme", "Colorscheme" }, - f = { "Telescope find_files", "Find File" }, - h = { "Telescope help_tags", "Find Help" }, - H = { "Telescope highlights", "Find highlight groups" }, - M = { "Telescope man_pages", "Man Pages" }, - r = { "Telescope oldfiles", "Open Recent File" }, - R = { "Telescope registers", "Registers" }, - t = { "Telescope live_grep", "Text" }, - T = { "TodoTelescope", "Todo Comments" }, - k = { "Telescope keymaps", "Keymaps" }, - C = { "Telescope commands", "Commands" }, - } - } - }, - blankline = { - n = { - c = { - function() - local ok, start = require("indent_blankline.utils").get_current_context( - vim.g.indent_blankline_context_patterns, - vim.g.indent_blankline_use_treesitter_scope - ) - if ok then - vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) - vim.cmd [[normal! _]] - end - end, - "Jump to current_context", - } - } - }, - bufferline = { - n = { - b = { - name = "Buffers", - j = { "BufferLinePick", "Jump" }, - b = { "BufferLineCyclePrev", "Previous" }, - n = { "BufferLineCycleNext", "Next" }, - e = { "BufferLinePickClose", "Pick which buffer to close" }, - h = { "BufferLineCloseLeft", "Close all to the left" }, - l = { "BufferLineCloseRight", "Close all to the right" }, - D = { "BufferLineSortByDirectory", "Sort by directory" }, - L = { "BufferLineSortByExtension", "Sort by language" }, - }, - } - }, - packer = { - n = { - p = { - name = "Packer", - c = { "PackerCompile", "Compile" }, - C = { "PackerClean", "Clean" }, - i = { "PackerInstall", "Install" }, - s = { "PackerSync", "Sync" }, - S = { "PackerStatus", "Status" }, - u = { "PackerUpdate", "Update" }, - }, - } - }, - lf = { - n = { - ["e"] = { function() require("lf").start() end, "File Picker" }, - } - }, - alpha = { - n = { - [";"] = { "Alpha", "Dashboard" }, - } - }, - treesitter = { - n = { - T = { - name = "Treesitter", - i = { "TSConfigInfo", "Info" }, - }, - } - }, - comment = { - n = { - ["/"] = { "(comment_toggle_linewise_current)", "Comment toggle current line" }, + } }, - v = { - ["/"] = { "(comment_toggle_linewise_visual)", "Comment toggle linewise" }, + lspconfig = { + n = { + l = { + name = "LSP", + i = { "LspInfo", "Info" }, + } + } }, - }, - gitsigns = { - n = { - g = { - name = "Git", - j = { function() require("gitsigns").next_hunk() end, "Next Hunk" }, - k = { function() require("gitsigns").prev_hunk() end, "Prev Hunk" }, - l = { function() require("gitsigns").blame_line() end, "Blame" }, - p = { function() require("gitsigns").preview_hunk() end, "Preview Hunk" }, - r = { function() require("gitsigns").reset_hunk() end, "Reset Hunk" }, - R = { function() require("gitsigns").reset_buffer() end, "Reset Buffer" }, - s = { function() require("gitsigns").stage_hunk() end, "Stage Hunk" }, - u = { function() require("gitsigns").undo_stage_hunk() end, "Undo Stage Hunk" }, - d = { "Gitsigns diffthis HEAD", "Git Diff" }, - }, + mason = { + n = { + l = { + name = "LSP", + I = { "Mason", "Mason Info" }, + } + } + }, + dap = { + n = { + d = { + name = "DAP", + b = { function() require("dap").toggle_breakpoint() end, "Toggle Breakpoint" }, + c = { function() require("dap").continue() end, "Continue" }, + i = { function() require("dap").step_into() end, "Step Into" }, + o = { function() require("dap").step_over() end, "Step Over" }, + O = { function() require("dap").step_out() end, "Step Out" }, + r = { function() require("dap").repl.toggle() end, "Toggle REPL" }, + l = { function() require("dap").run_last() end, "Run Last" }, + t = { function() require("dap").terminate() end, "Stop Debugger" }, + u = { function() require("dapui").toggle() end, "Toggle DAP UI" }, + } + } + }, + telescope = { + n = { + b = { + name = "Buffers", + f = { "Telescope buffers", "Find" }, + }, + g = { + name = "Git", + o = { "Telescope git_status", "Open changed file" }, + b = { "Telescope git_branches", "Checkout branch" }, + c = { "Telescope git_commits", "Checkout commit" }, + C = { "Telescope git_bcommits", "Checkout commit(for current file)" }, + }, + l = { + name = "LSP", + d = { "Telescope diagnostics bufnr=0 theme=get_ivy", "Buffer Diagnostics" }, + w = { "Telescope diagnostics", "Diagnostics" }, + s = { "Telescope lsp_document_symbols", "Document Symbols" }, + S = { "Telescope lsp_dynamic_workspace_symbols", "Workspace Symbols" }, + e = { "Telescope quickfix", "Telescope Quickfix" }, + }, + s = { + name = "Search", + c = { "Telescope colorscheme", "Colorscheme" }, + f = { "Telescope find_files", "Find File" }, + h = { "Telescope help_tags", "Find Help" }, + H = { "Telescope highlights", "Find highlight groups" }, + M = { "Telescope man_pages", "Man Pages" }, + r = { "Telescope oldfiles", "Open Recent File" }, + R = { "Telescope registers", "Registers" }, + t = { "Telescope live_grep", "Text" }, + T = { "TodoTelescope", "Todo Comments" }, + k = { "Telescope keymaps", "Keymaps" }, + C = { "Telescope commands", "Commands" }, + } + } + }, + blankline = { + n = { + c = { + function() + local ok, start = require("indent_blankline.utils").get_current_context( + vim.g.indent_blankline_context_patterns, + vim.g.indent_blankline_use_treesitter_scope + ) + if ok then + vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) + vim.cmd [[normal! _]] + end + end, + "Jump to current_context", + } + } + }, + bufferline = { + n = { + b = { + name = "Buffers", + j = { "BufferLinePick", "Jump" }, + b = { "BufferLineCyclePrev", "Previous" }, + n = { "BufferLineCycleNext", "Next" }, + e = { "BufferLinePickClose", "Pick which buffer to close" }, + h = { "BufferLineCloseLeft", "Close all to the left" }, + l = { "BufferLineCloseRight", "Close all to the right" }, + D = { "BufferLineSortByDirectory", "Sort by directory" }, + L = { "BufferLineSortByExtension", "Sort by language" }, + }, + } + }, + packer = { + n = { + p = { + name = "Packer", + c = { "PackerCompile", "Compile" }, + C = { "PackerClean", "Clean" }, + i = { "PackerInstall", "Install" }, + s = { "PackerSync", "Sync" }, + S = { "PackerStatus", "Status" }, + u = { "PackerUpdate", "Update" }, + }, + } + }, + lf = { + n = { + ["e"] = { function() require("lf").start() end, "File Picker" }, + } + }, + alpha = { + n = { + [";"] = { "Alpha", "Dashboard" }, + } + }, + treesitter = { + n = { + T = { + name = "Treesitter", + i = { "TSConfigInfo", "Info" }, + }, + } + }, + comment = { + n = { + ["/"] = { "(comment_toggle_linewise_current)", "Comment toggle current line" }, + }, + v = { + ["/"] = { "(comment_toggle_linewise_visual)", "Comment toggle linewise" }, + }, + }, + gitsigns = { + n = { + g = { + name = "Git", + j = { function() require("gitsigns").next_hunk() end, "Next Hunk" }, + k = { function() require("gitsigns").prev_hunk() end, "Prev Hunk" }, + l = { function() require("gitsigns").blame_line() end, "Blame" }, + p = { function() require("gitsigns").preview_hunk() end, "Preview Hunk" }, + r = { function() require("gitsigns").reset_hunk() end, "Reset Hunk" }, + R = { function() require("gitsigns").reset_buffer() end, "Reset Buffer" }, + s = { function() require("gitsigns").stage_hunk() end, "Stage Hunk" }, + u = { function() require("gitsigns").undo_stage_hunk() end, "Undo Stage Hunk" }, + d = { "Gitsigns diffthis HEAD", "Git Diff" }, + }, + } } - } } return M diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua index c5c3cfe3..85a40fbc 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -15,8 +15,8 @@ o.splitbelow = true o.updatetime = 250 o.writebackup = false o.expandtab = true -o.shiftwidth = 2 -o.tabstop = 2 +o.shiftwidth = 4 +o.tabstop = 4 o.cursorline = true o.signcolumn = "yes" o.wrap = false diff --git a/.config/nvim/lua/funcs.lua b/.config/nvim/lua/funcs.lua index 3a12b57b..90ee5cd9 100644 --- a/.config/nvim/lua/funcs.lua +++ b/.config/nvim/lua/funcs.lua @@ -1,197 +1,197 @@ local M = {} function M.lazy_load(tb) - vim.api.nvim_create_autocmd(tb.events, { - group = vim.api.nvim_create_augroup(tb.augroup_name, {}), - callback = function() - if tb.condition() then - vim.api.nvim_del_augroup_by_name(tb.augroup_name) - -- dont defer for treesitter as it will show slow highlighting - -- This deferring only happens only when we do "nvim filename" - if tb.plugin ~= "nvim-treesitter" then - vim.defer_fn(function() - require("packer").loader(tb.plugin) - if tb.plugin == "nvim-lspconfig" then - vim.cmd "silent! do FileType" + vim.api.nvim_create_autocmd(tb.events, { + group = vim.api.nvim_create_augroup(tb.augroup_name, {}), + callback = function() + if tb.condition() then + vim.api.nvim_del_augroup_by_name(tb.augroup_name) + -- dont defer for treesitter as it will show slow highlighting + -- This deferring only happens only when we do "nvim filename" + if tb.plugin ~= "nvim-treesitter" then + vim.defer_fn(function() + require("packer").loader(tb.plugin) + if tb.plugin == "nvim-lspconfig" then + vim.cmd "silent! do FileType" + end + end, 0) + else + require("packer").loader(tb.plugin) + end end - end, 0) - else - require("packer").loader(tb.plugin) - end - end - end, - }) + end, + }) end function M.on_file_open(plugin_name) - M.lazy_load { - events = { "BufRead", "BufWinEnter", "BufNewFile" }, - augroup_name = "BeLazyOnFileOpen" .. plugin_name, - plugin = plugin_name, - condition = function() - local file = vim.fn.expand "%" - return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" - end, - } + M.lazy_load { + events = { "BufRead", "BufWinEnter", "BufNewFile" }, + augroup_name = "BeLazyOnFileOpen" .. plugin_name, + plugin = plugin_name, + condition = function() + local file = vim.fn.expand "%" + return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= "" + end, + } end function M.gitsigns() - vim.api.nvim_create_autocmd({ "BufRead" }, { - group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }), - callback = function() - vim.fn.system("git rev-parse " .. vim.fn.expand "%:p:h") - if vim.v.shell_error == 0 then - vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad" - vim.schedule(function() - require("packer").loader "gitsigns.nvim" - end) - end - end, - }) + vim.api.nvim_create_autocmd({ "BufRead" }, { + group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }), + callback = function() + vim.fn.system("git rev-parse " .. vim.fn.expand "%:p:h") + if vim.v.shell_error == 0 then + vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad" + vim.schedule(function() + require("packer").loader "gitsigns.nvim" + end) + end + end, + }) end function M.bootstrap() - local fn = vim.fn - local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' - if fn.empty(fn.glob(install_path)) > 0 then - vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" }) - print "Cloning Packer..." - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) - vim.cmd "packadd packer.nvim" - require "plugins" - vim.cmd "PackerSync" - vim.api.nvim_create_autocmd("User", { - pattern = "PackerComplete", - callback = function() - vim.cmd "bw | silent! MasonInstallAll" -- close packer window - require("packer").loader "nvim-treesitter" - end, - }) - end + local fn = vim.fn + local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim' + if fn.empty(fn.glob(install_path)) > 0 then + vim.api.nvim_set_hl(0, "NormalFloat", { bg = "#1e222a" }) + print "Cloning Packer..." + fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path }) + vim.cmd "packadd packer.nvim" + require "plugins" + vim.cmd "PackerSync" + vim.api.nvim_create_autocmd("User", { + pattern = "PackerComplete", + callback = function() + vim.cmd "bw | silent! MasonInstallAll" -- close packer window + require("packer").loader "nvim-treesitter" + end, + }) + end end function M.map(section) - local maps = require('config.keymaplist').maps[section] - if maps then - for mode, binds in pairs(maps) do - for _, bind in pairs(binds) do - local key = bind[1] - local cmd = bind[2] - local opt = { silent = true, noremap = true } - vim.api.nvim_set_keymap(mode, key, cmd, opt) - end + local maps = require('config.keymaplist').maps[section] + if maps then + for mode, binds in pairs(maps) do + for _, bind in pairs(binds) do + local key = bind[1] + local cmd = bind[2] + local opt = { silent = true, noremap = true } + vim.api.nvim_set_keymap(mode, key, cmd, opt) + end + end end - end - local wk_ok, whichkey = pcall(require, 'which-key') - if wk_ok then - local wkmaps = require('config.keymaplist').whichkey[section] - if wkmaps then - for mode, binds in pairs(wkmaps) do - whichkey.register(binds, { - mode = mode, - prefix = "", - buffer = nil, - silent = true, - noremap = true, - nowait = true, - }) - end + local wk_ok, whichkey = pcall(require, 'which-key') + if wk_ok then + local wkmaps = require('config.keymaplist').whichkey[section] + if wkmaps then + for mode, binds in pairs(wkmaps) do + whichkey.register(binds, { + mode = mode, + prefix = "", + buffer = nil, + silent = true, + noremap = true, + nowait = true, + }) + end + end end - end end function M.format_filter(client) - local filetype = vim.bo.filetype - local n = require "null-ls" - local s = require "null-ls.sources" - local method = n.methods.FORMATTING - local available_formatters = s.get_available(filetype, method) + local filetype = vim.bo.filetype + local n = require "null-ls" + local s = require "null-ls.sources" + local method = n.methods.FORMATTING + local available_formatters = s.get_available(filetype, method) - if #available_formatters > 0 then - return client.name == "null-ls" - elseif client.supports_method "textDocument/formatting" then - return true - else - return false - end + if #available_formatters > 0 then + return client.name == "null-ls" + elseif client.supports_method "textDocument/formatting" then + return true + else + return false + end end function M.format(opts) - opts = opts or {} - opts.filter = opts.filter or M.format_filter - return vim.lsp.buf.format(opts) + opts = opts or {} + opts.filter = opts.filter or M.format_filter + return vim.lsp.buf.format(opts) end -- Modified version of a function stolen from LunarVim function M.buf_kill(kill_command, bufnr, force) - kill_command = kill_command or "bd" + kill_command = kill_command or "bd" - local bo = vim.bo - local api = vim.api - local fmt = string.format - local fnamemodify = vim.fn.fnamemodify + local bo = vim.bo + local api = vim.api + local fmt = string.format + local fnamemodify = vim.fn.fnamemodify - if bufnr == 0 or bufnr == nil then - bufnr = api.nvim_get_current_buf() - end - - local bufname = api.nvim_buf_get_name(bufnr) - - if not force then - local warning - if bo[bufnr].modified then - warning = fmt([[No write since last change for (%s)]], fnamemodify(bufname, ":t")) - elseif api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then - warning = fmt([[Terminal %s will be killed]], bufname) + if bufnr == 0 or bufnr == nil then + bufnr = api.nvim_get_current_buf() end - if warning then - vim.ui.input({ - prompt = string.format([[%s. Close it anyway? [y]es or [n]o (default: no): ]], warning), - }, function(choice) - if choice:match "ye?s?" then force = true end - end) - if not force then return end - end - end - -- Get list of windows IDs with the buffer to close - local windows = vim.tbl_filter(function(win) - return api.nvim_win_get_buf(win) == bufnr - end, api.nvim_list_wins()) + local bufname = api.nvim_buf_get_name(bufnr) - if #windows == 0 then return end - - if force then - kill_command = kill_command .. "!" - end - - -- Get list of active buffers - local buffers = vim.tbl_filter(function(buf) - return api.nvim_buf_is_valid(buf) and bo[buf].buflisted - end, api.nvim_list_bufs()) - - -- If there is only one buffer (which has to be the current one), vim will - -- create a new buffer on :bd. - -- For more than one buffer, pick the previous buffer (wrapping around if necessary) - if #buffers > 1 then - for i, v in ipairs(buffers) do - if v == bufnr then - local prev_buf_idx = i == 1 and (#buffers - 1) or (i - 1) - local prev_buffer = buffers[prev_buf_idx] - for _, win in ipairs(windows) do - api.nvim_win_set_buf(win, prev_buffer) + if not force then + local warning + if bo[bufnr].modified then + warning = fmt([[No write since last change for (%s)]], fnamemodify(bufname, ":t")) + elseif api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then + warning = fmt([[Terminal %s will be killed]], bufname) + end + if warning then + vim.ui.input({ + prompt = string.format([[%s. Close it anyway? [y]es or [n]o (default: no): ]], warning), + }, function(choice) + if choice:match "ye?s?" then force = true end + end) + if not force then return end end - end end - else - vim.cmd('q!') - end - -- Check if buffer still exists, to ensure the target buffer wasn't killed - -- due to options like bufhidden=wipe. - if api.nvim_buf_is_valid(bufnr) and bo[bufnr].buflisted then - vim.cmd(string.format("%s %d", kill_command, bufnr)) - end + -- Get list of windows IDs with the buffer to close + local windows = vim.tbl_filter(function(win) + return api.nvim_win_get_buf(win) == bufnr + end, api.nvim_list_wins()) + + if #windows == 0 then return end + + if force then + kill_command = kill_command .. "!" + end + + -- Get list of active buffers + local buffers = vim.tbl_filter(function(buf) + return api.nvim_buf_is_valid(buf) and bo[buf].buflisted + end, api.nvim_list_bufs()) + + -- If there is only one buffer (which has to be the current one), vim will + -- create a new buffer on :bd. + -- For more than one buffer, pick the previous buffer (wrapping around if necessary) + if #buffers > 1 then + for i, v in ipairs(buffers) do + if v == bufnr then + local prev_buf_idx = i == 1 and (#buffers - 1) or (i - 1) + local prev_buffer = buffers[prev_buf_idx] + for _, win in ipairs(windows) do + api.nvim_win_set_buf(win, prev_buffer) + end + end + end + else + vim.cmd('q!') + end + + -- Check if buffer still exists, to ensure the target buffer wasn't killed + -- due to options like bufhidden=wipe. + if api.nvim_buf_is_valid(bufnr) and bo[bufnr].buflisted then + vim.cmd(string.format("%s %d", kill_command, bufnr)) + end end return M diff --git a/.config/nvim/lua/plugins/config/alpha.lua b/.config/nvim/lua/plugins/config/alpha.lua index c0b1b951..221d7add 100644 --- a/.config/nvim/lua/plugins/config/alpha.lua +++ b/.config/nvim/lua/plugins/config/alpha.lua @@ -1,49 +1,49 @@ local status_ok, alpha = pcall(require, 'alpha') if not status_ok then - return + return end -local dashboard = require 'alpha.themes.dashboard' -local icons = require 'config.iconlist' +local dashboard = require('alpha.themes.dashboard') +local icons = require('config.icons').list local banner = { - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀", - "⠀⣀⣴⣶⣶⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀", - "⣰⣿⣿⠿⠛⠿⢿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀", - "⣿⣿⡇⠀⠀⠀⠀⠈⠛⢿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀", - "⠹⣿⣧⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⠀⢀⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀", - "⠀⠙⢿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⣤⣶⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠉⠻⠷⡄⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⢀⣠⣤⣤⣄⡀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣷⡀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⡀⠀⠀⠀⠀⣿⠟⠉⠉⠙⢿⣿⣿⣷", - "⠀⠀⠀⣀⣠⣤⣤⣤⣶⣶⣶⣤⣤⠀⣴⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠉⠀⠀⠀⢀⣼⣿⣿⡿", - "⠀⠀⠀⠈⠉⠉⠉⠉⠉⠉⠛⠻⠏⣼⣿⣿⡿⣋⣀⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣀⣠⣴⣾⣿⣿⡿⠁", - "⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡿⠋⠘⠿⠟⠛⠛⢻⣿⣿⣿⠋⠁⠈⠉⢿⣿⣿⣧⠀⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠉⠀⠀", - "⠙⣷⣤⣀⠀⠀⠀⢀⣀⣤⣶⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡟⠀⠀⠀⢠⣿⣿⣿⡟⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀", - "⠀⠈⠛⠿⢿⣿⣿⣿⠿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⡀⠀⢠⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣷⣶⣶⣶⣶⣦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢶⣦⣤⣶⣾⣿⣿⡶⠈⠉⠛⠿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣶⡿⠿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀", + "⠀⣀⣴⣶⣶⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀", + "⣰⣿⣿⠿⠛⠿⢿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀", + "⣿⣿⡇⠀⠀⠀⠀⠈⠛⢿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀", + "⠹⣿⣧⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⠀⢀⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀", + "⠀⠙⢿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⣤⣶⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠉⠻⠷⡄⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⢀⣠⣤⣤⣄⡀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣷⡀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⡀⠀⠀⠀⠀⣿⠟⠉⠉⠙⢿⣿⣿⣷", + "⠀⠀⠀⣀⣠⣤⣤⣤⣶⣶⣶⣤⣤⠀⣴⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠉⠀⠀⠀⢀⣼⣿⣿⡿", + "⠀⠀⠀⠈⠉⠉⠉⠉⠉⠉⠛⠻⠏⣼⣿⣿⡿⣋⣀⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣀⣠⣴⣾⣿⣿⡿⠁", + "⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡿⠋⠘⠿⠟⠛⠛⢻⣿⣿⣿⠋⠁⠈⠉⢿⣿⣿⣧⠀⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠉⠀⠀", + "⠙⣷⣤⣀⠀⠀⠀⢀⣀⣤⣶⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡟⠀⠀⠀⢠⣿⣿⣿⡟⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀", + "⠀⠈⠛⠿⢿⣿⣿⣿⠿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⡀⠀⢠⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣷⣶⣶⣶⣶⣦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢶⣦⣤⣶⣾⣿⣿⡶⠈⠉⠛⠿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣶⡿⠿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", } if vim.o.lines < 36 then - banner = vim.list_slice(banner, 16, 22) + banner = vim.list_slice(banner, 16, 22) end dashboard.section.header.val = banner dashboard.section.buttons.val = { - dashboard.button("f", icons.ui.FindFile .. " Find file", ":Telescope find_files"), - dashboard.button("n", icons.ui.NewFile .. " New file", ":ene startinsert"), - dashboard.button("p", icons.ui.Project .. " Find project", ":Telescope projects"), - dashboard.button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles"), - dashboard.button("t", icons.ui.FindText .. " Find text", ":Telescope live_grep"), - dashboard.button("q", icons.ui.SignOut .. " Quit", ":qa"), + dashboard.button("f", icons.ui.FindFile .. " Find file", ":Telescope find_files"), + dashboard.button("n", icons.ui.NewFile .. " New file", ":ene startinsert"), + dashboard.button("p", icons.ui.Project .. " Find project", ":Telescope projects"), + dashboard.button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles"), + dashboard.button("t", icons.ui.FindText .. " Find text", ":Telescope live_grep"), + dashboard.button("q", icons.ui.SignOut .. " Quit", ":qa"), } dashboard.section.footer.val = "Behold: a Snail's Vim" diff --git a/.config/nvim/lua/plugins/config/autopairs.lua b/.config/nvim/lua/plugins/config/autopairs.lua index 9a784666..dc890337 100644 --- a/.config/nvim/lua/plugins/config/autopairs.lua +++ b/.config/nvim/lua/plugins/config/autopairs.lua @@ -1,33 +1,33 @@ local status_ok, autopairs = pcall(require, "nvim-autopairs") if not status_ok then - return + return end autopairs.setup({ - check_ts = true, - disable_filetype = { "TelescopePrompt", "vim" }, - ts_config = { - lua = { "string", "source" }, - javascript = { "string", "template_string" }, - java = false, - }, - fast_wrap = { - map = "", - chars = { "{", "[", "("}, - -- chars = { "{", "[", "(", '"', "'" }, - pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), - offset = 0, - end_key = "$", - keys = "qwertyuiopzxcvbnmasdfghjkl", - check_comma = true, - highlight = "PmenuSel", - highlight_grey = "LineNr", - }, + check_ts = true, + disable_filetype = { "TelescopePrompt", "vim" }, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, + fast_wrap = { + map = "", + chars = { "{", "[", "(" }, + -- chars = { "{", "[", "(", '"', "'" }, + pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""), + offset = 0, + end_key = "$", + keys = "qwertyuiopzxcvbnmasdfghjkl", + check_comma = true, + highlight = "PmenuSel", + highlight_grey = "LineNr", + }, }) local cmp_autopairs = require("nvim-autopairs.completion.cmp") local cmp_status_ok, cmp = pcall(require, "cmp") if not cmp_status_ok then - return + return end cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) diff --git a/.config/nvim/lua/plugins/config/bufferline.lua b/.config/nvim/lua/plugins/config/bufferline.lua index dfc63adc..cd9c84ad 100644 --- a/.config/nvim/lua/plugins/config/bufferline.lua +++ b/.config/nvim/lua/plugins/config/bufferline.lua @@ -2,143 +2,143 @@ local colors = require('tokyonight.colors').setup({ transform = true }) local status_ok, bufferline = pcall(require, "bufferline") if not status_ok then - return + return end -local icons = require 'config.iconlist' +local icons = require('config.icons').list local function is_ft(b, ft) - return vim.bo[b].filetype == ft + return vim.bo[b].filetype == ft end local function diagnostics_indicator(_, _, diagnostics, _) - local result = {} - local symbols = { - error = icons.diagnostics.Error, - warning = icons.diagnostics.Warning, - info = icons.diagnostics.Information, - } - for name, count in pairs(diagnostics) do - if symbols[name] and count > 0 then - table.insert(result, symbols[name] .. " " .. count) + local result = {} + local symbols = { + error = icons.diagnostics.Error, + warning = icons.diagnostics.Warning, + info = icons.diagnostics.Information, + } + for name, count in pairs(diagnostics) do + if symbols[name] and count > 0 then + table.insert(result, symbols[name] .. " " .. count) + end end - end - result = table.concat(result, " ") - return #result > 0 and result or "" + result = table.concat(result, " ") + return #result > 0 and result or "" end local function custom_filter(buf, buf_nums) - local logs = vim.tbl_filter(function(b) - return is_ft(b, "log") - end, buf_nums) - if vim.tbl_isempty(logs) then - return true - end - local tab_num = vim.fn.tabpagenr() - local last_tab = vim.fn.tabpagenr "$" - local is_log = is_ft(buf, "log") - if last_tab == 1 then - return true - end - -- only show log buffers in secondary tabs - return (tab_num == last_tab and is_log) or (tab_num ~= last_tab and not is_log) + local logs = vim.tbl_filter(function(b) + return is_ft(b, "log") + end, buf_nums) + if vim.tbl_isempty(logs) then + return true + end + local tab_num = vim.fn.tabpagenr() + local last_tab = vim.fn.tabpagenr "$" + local is_log = is_ft(buf, "log") + if last_tab == 1 then + return true + end + -- only show log buffers in secondary tabs + return (tab_num == last_tab and is_log) or (tab_num ~= last_tab and not is_log) end local config = { - highlights = { - background = { - italic = true, - bold = false, + highlights = { + background = { + italic = true, + bold = false, + }, + buffer_selected = { + italic = false, + bold = true, + }, }, - buffer_selected = { - italic = false, - bold = true, + options = { + mode = "buffers", -- set to "tabs" to only show tabpages instead + numbers = "none", -- can be "none" | "ordinal" | "buffer_id" | "both" | function + close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" + right_mouse_command = "vert sbuffer %d", -- can be a string | function, see "Mouse actions" + left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" + middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" + indicator = { + -- icon = icons.ui.DoubleChevronRight, -- this should be omitted if indicator style is not 'icon' + style = "none", -- can also be 'underline'|'none', + }, + buffer_close_icon = icons.ui.Close, + modified_icon = icons.ui.Circle, + close_icon = icons.ui.BoldClose, + left_trunc_marker = icons.ui.ArrowCircleLeft, + right_trunc_marker = icons.ui.ArrowCircleRight, + --- name_formatter can be used to change the buffer's label in the bufferline. + --- Please note some names can/will break the + --- bufferline so use this at your discretion knowing that it has + --- some limitations that will *NOT* be fixed. + name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" + -- remove extension from markdown files for example + if buf.name:match "%.md" then + return vim.fn.fnamemodify(buf.name, ":t:r") + end + end, + max_name_length = 18, + max_prefix_length = 15, -- prefix used when a buffer is de-duplicated + truncate_names = true, -- whether or not tab names should be truncated + tab_size = 18, + diagnostics = "nvim_lsp", + diagnostics_update_in_insert = false, + diagnostics_indicator = diagnostics_indicator, + -- NOTE: this will be called a lot so don't do any heavy processing here + custom_filter = custom_filter, + offsets = { + { + filetype = "undotree", + text = "Undotree", + highlight = "PanelHeading", + padding = 1, + }, + { + filetype = "NvimTree", + text = "Explorer", + highlight = "PanelHeading", + padding = 1, + }, + { + filetype = "DiffviewFiles", + text = "Diff View", + highlight = "PanelHeading", + padding = 1, + }, + { + filetype = "flutterToolsOutline", + text = "Flutter Outline", + highlight = "PanelHeading", + }, + { + filetype = "packer", + text = "Packer", + highlight = "PanelHeading", + padding = 1, + }, + }, + color_icons = true, -- whether or not to add the filetype icon highlights + show_buffer_icons = true, -- disable filetype icons for buffers + show_buffer_close_icons = false, + show_close_icon = false, + show_tab_indicators = true, + persist_buffer_sort = true, -- whether or not custom sorted buffers should persist + -- can also be a table containing 2 custom separators + -- [focused and unfocused]. eg: { '|', '|' } + separator_style = { '', '' }, + enforce_regular_tabs = false, + always_show_bufferline = false, + hover = { + enabled = false, -- requires nvim 0.8+ + delay = 200, + reveal = { "close" }, + }, + sort_by = "id", }, - }, - options = { - mode = "buffers", -- set to "tabs" to only show tabpages instead - numbers = "none", -- can be "none" | "ordinal" | "buffer_id" | "both" | function - close_command = "bdelete! %d", -- can be a string | function, see "Mouse actions" - right_mouse_command = "vert sbuffer %d", -- can be a string | function, see "Mouse actions" - left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" - middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" - indicator = { - -- icon = icons.ui.DoubleChevronRight, -- this should be omitted if indicator style is not 'icon' - style = "none", -- can also be 'underline'|'none', - }, - buffer_close_icon = icons.ui.Close, - modified_icon = icons.ui.Circle, - close_icon = icons.ui.BoldClose, - left_trunc_marker = icons.ui.ArrowCircleLeft, - right_trunc_marker = icons.ui.ArrowCircleRight, - --- name_formatter can be used to change the buffer's label in the bufferline. - --- Please note some names can/will break the - --- bufferline so use this at your discretion knowing that it has - --- some limitations that will *NOT* be fixed. - name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr" - -- remove extension from markdown files for example - if buf.name:match "%.md" then - return vim.fn.fnamemodify(buf.name, ":t:r") - end - end, - max_name_length = 18, - max_prefix_length = 15, -- prefix used when a buffer is de-duplicated - truncate_names = true, -- whether or not tab names should be truncated - tab_size = 18, - diagnostics = "nvim_lsp", - diagnostics_update_in_insert = false, - diagnostics_indicator = diagnostics_indicator, - -- NOTE: this will be called a lot so don't do any heavy processing here - custom_filter = custom_filter, - offsets = { - { - filetype = "undotree", - text = "Undotree", - highlight = "PanelHeading", - padding = 1, - }, - { - filetype = "NvimTree", - text = "Explorer", - highlight = "PanelHeading", - padding = 1, - }, - { - filetype = "DiffviewFiles", - text = "Diff View", - highlight = "PanelHeading", - padding = 1, - }, - { - filetype = "flutterToolsOutline", - text = "Flutter Outline", - highlight = "PanelHeading", - }, - { - filetype = "packer", - text = "Packer", - highlight = "PanelHeading", - padding = 1, - }, - }, - color_icons = true, -- whether or not to add the filetype icon highlights - show_buffer_icons = true, -- disable filetype icons for buffers - show_buffer_close_icons = false, - show_close_icon = false, - show_tab_indicators = true, - persist_buffer_sort = true, -- whether or not custom sorted buffers should persist - -- can also be a table containing 2 custom separators - -- [focused and unfocused]. eg: { '|', '|' } - separator_style = { '', '' }, - enforce_regular_tabs = false, - always_show_bufferline = false, - hover = { - enabled = false, -- requires nvim 0.8+ - delay = 200, - reveal = { "close" }, - }, - sort_by = "id", - }, } bufferline.setup(config) diff --git a/.config/nvim/lua/plugins/config/cmp.lua b/.config/nvim/lua/plugins/config/cmp.lua index 901b8e17..ad6b6add 100644 --- a/.config/nvim/lua/plugins/config/cmp.lua +++ b/.config/nvim/lua/plugins/config/cmp.lua @@ -1,98 +1,98 @@ local cmp_status_ok, cmp = pcall(require, 'cmp') if not cmp_status_ok then - return + return end local luasnip_status_ok, luasnip = pcall(require, 'luasnip') if not luasnip_status_ok then - return + return end local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end local cmp_window = require "cmp.utils.window" cmp_window.info_ = cmp_window.info cmp_window.info = function(self) - local info = self:info_() - info.scrollable = false - return info + local info = self:info_() + info.scrollable = false + return info end cmp.setup({ - window = { - completion = { - winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", - col_offset = -3, - side_padding = 0, + window = { + completion = { + winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None", + col_offset = -3, + side_padding = 0, + }, }, - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item) - local strings = vim.split(kind.kind, "%s", { trimempty = true }) - kind.kind = " " .. (strings[1] or "") .. " " - kind.menu = " (" .. (strings[2] or "") .. ")" + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item) + local strings = vim.split(kind.kind, "%s", { trimempty = true }) + kind.kind = " " .. (strings[1] or "") .. " " + kind.menu = " (" .. (strings[2] or "") .. ")" - return kind - end, - }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = { - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() - -- they way you will only jump inside the snippet region - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), + return kind + end, + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() + -- they way you will only jump inside the snippet region + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }, - sources = { - { name = "nvim_lsp" }, - { name = "nvim_lua" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }, - experimental = { - ghost_text = true, - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - } + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }, + sources = { + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + experimental = { + ghost_text = true, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + } }) diff --git a/.config/nvim/lua/plugins/config/comment.lua b/.config/nvim/lua/plugins/config/comment.lua index ef0f480f..5edf837c 100644 --- a/.config/nvim/lua/plugins/config/comment.lua +++ b/.config/nvim/lua/plugins/config/comment.lua @@ -1,11 +1,11 @@ local status_ok, comment = pcall(require, "Comment") if not status_ok then - return + return end comment.setup({ - mappings = { - basic = false, - extra = false - } + mappings = { + basic = false, + extra = false + } }) diff --git a/.config/nvim/lua/plugins/config/dap.lua b/.config/nvim/lua/plugins/config/dap.lua index fb546239..987f44be 100644 --- a/.config/nvim/lua/plugins/config/dap.lua +++ b/.config/nvim/lua/plugins/config/dap.lua @@ -1,25 +1,25 @@ -local icons = require('config.iconlist') +local icons = require('config.icons').list local dap_status_ok, dap = pcall(require, 'dap') if not dap_status_ok then - return + return end local dap_ui_status_ok, dapui = pcall(require, 'dapui') if not dap_ui_status_ok then - return + return end vim.fn.sign_define("DapBreakpoint", { text = icons.ui.Bug, texthl = "DiagnosticSignError", linehl = "", numhl = "" }) dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() + dapui.open() end dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() + dapui.close() end dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() + dapui.close() end diff --git a/.config/nvim/lua/plugins/config/dapui.lua b/.config/nvim/lua/plugins/config/dapui.lua index 9fcc97d3..aad17305 100644 --- a/.config/nvim/lua/plugins/config/dapui.lua +++ b/.config/nvim/lua/plugins/config/dapui.lua @@ -1,27 +1,27 @@ local dap_ui_status_ok, dapui = pcall(require, 'nvim-dap-ui') if not dap_ui_status_ok then - return + return end dapui.setup { - layouts = { - { - elements = { - 'scopes', - 'breakpoints', - 'stacks', - 'watches', - }, - size = 40, - position = 'left', + layouts = { + { + elements = { + 'scopes', + 'breakpoints', + 'stacks', + 'watches', + }, + size = 40, + position = 'left', + }, + { + elements = { + 'repl', + 'console', + }, + size = 10, + position = 'bottom', + }, }, - { - elements = { - 'repl', - 'console', - }, - size = 10, - position = 'bottom', - }, - }, } diff --git a/.config/nvim/lua/plugins/config/gitsigns.lua b/.config/nvim/lua/plugins/config/gitsigns.lua index 9453e4f4..500f465e 100644 --- a/.config/nvim/lua/plugins/config/gitsigns.lua +++ b/.config/nvim/lua/plugins/config/gitsigns.lua @@ -1,36 +1,36 @@ local status_ok, gitsigns = pcall(require, "gitsigns") if not status_ok then - return + return end gitsigns.setup { - signs = { - add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, - change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, - changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - watch_gitdir = { - interval = 1000, - follow_files = true, - }, - attach_to_untracked = true, - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - }, - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - preview_config = { - -- Options passed to nvim_open_win - border = "single", - style = "minimal", - relative = "cursor", - row = 0, - col = 1, - }, + signs = { + add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, + change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, + changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + }, + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + preview_config = { + -- Options passed to nvim_open_win + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, } diff --git a/.config/nvim/lua/plugins/config/illuminate.lua b/.config/nvim/lua/plugins/config/illuminate.lua index c1da7751..af77a7d0 100644 --- a/.config/nvim/lua/plugins/config/illuminate.lua +++ b/.config/nvim/lua/plugins/config/illuminate.lua @@ -1,36 +1,36 @@ local status_ok, illuminate = pcall(require, "illuminate") if not status_ok then - return + return end vim.g.Illuminate_ftblacklist = { 'alpha', 'NvimTree' } illuminate.configure { - providers = { - "lsp", - "treesitter", - "regex", - }, - delay = 200, - filetypes_denylist = { - "dirvish", - "fugitive", - "alpha", - "NvimTree", - "packer", - "neogitstatus", - "Trouble", - "lir", - "Outline", - "spectre_panel", - "toggleterm", - "DressingSelect", - "TelescopePrompt", - }, - filetypes_allowlist = {}, - modes_denylist = {}, - modes_allowlist = {}, - providers_regex_syntax_denylist = {}, - providers_regex_syntax_allowlist = {}, - under_cursor = true, + providers = { + "lsp", + "treesitter", + "regex", + }, + delay = 200, + filetypes_denylist = { + "dirvish", + "fugitive", + "alpha", + "NvimTree", + "packer", + "neogitstatus", + "Trouble", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "DressingSelect", + "TelescopePrompt", + }, + filetypes_allowlist = {}, + modes_denylist = {}, + modes_allowlist = {}, + providers_regex_syntax_denylist = {}, + providers_regex_syntax_allowlist = {}, + under_cursor = true, } diff --git a/.config/nvim/lua/plugins/config/impatient.lua b/.config/nvim/lua/plugins/config/impatient.lua index b172d9b0..8fe79f7f 100644 --- a/.config/nvim/lua/plugins/config/impatient.lua +++ b/.config/nvim/lua/plugins/config/impatient.lua @@ -1,7 +1,7 @@ -- This file is currently not used anywhere local status_ok, impatient = pcall(require, "impatient") if not status_ok then - return + return end impatient.enable_profile() diff --git a/.config/nvim/lua/plugins/config/indent-blankline.lua b/.config/nvim/lua/plugins/config/indent-blankline.lua index c4bfa198..be9c1269 100644 --- a/.config/nvim/lua/plugins/config/indent-blankline.lua +++ b/.config/nvim/lua/plugins/config/indent-blankline.lua @@ -1,20 +1,20 @@ local status_ok, indent_blankline = pcall(require, "indent_blankline") if not status_ok then - return + return end indent_blankline.setup { - char = "▏", - context_char = "▏", - show_trailing_blankline_indent = false, - show_first_indent_level = true, - use_treesitter = true, - show_current_context = false, - show_end_of_line = false, - buftype_exclude = { "terminal", "nofile" }, - filetype_exclude = { - "help", - "packer", - "NvimTree", - }, + char = "▏", + context_char = "▏", + show_trailing_blankline_indent = false, + show_first_indent_level = true, + use_treesitter = true, + show_current_context = false, + show_end_of_line = false, + buftype_exclude = { "terminal", "nofile" }, + filetype_exclude = { + "help", + "packer", + "NvimTree", + }, } diff --git a/.config/nvim/lua/plugins/config/lf.lua b/.config/nvim/lua/plugins/config/lf.lua index 4971019d..c24baaee 100644 --- a/.config/nvim/lua/plugins/config/lf.lua +++ b/.config/nvim/lua/plugins/config/lf.lua @@ -1,9 +1,9 @@ -- Defaults require("lf").setup({ - winblend = 0, - highlights = { - border = "Normal", - background = "Normal", - }, - border = "rounded", + winblend = 0, + highlights = { + border = "Normal", + background = "Normal", + }, + border = "rounded", }) diff --git a/.config/nvim/lua/plugins/config/lspconfig.lua b/.config/nvim/lua/plugins/config/lspconfig.lua index 9fc842fb..134241b7 100644 --- a/.config/nvim/lua/plugins/config/lspconfig.lua +++ b/.config/nvim/lua/plugins/config/lspconfig.lua @@ -1,11 +1,11 @@ local mason_lspconfig_status_ok, mason_lspconfig = pcall(require, 'mason-lspconfig') if not mason_lspconfig_status_ok then - return + return end local lspconfig_status_ok, lspconfig = pcall(require, 'lspconfig') if not lspconfig_status_ok then - return + return end local on_attach = function(client, bufnr) @@ -13,78 +13,78 @@ end local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem = { - documentationFormat = { "markdown", "plaintext" }, - snippetSupport = true, - preselectSupport = true, - insertReplaceSupport = true, - labelDetailsSupport = true, - deprecatedSupport = true, - commitCharactersSupport = true, - tagSupport = { valueSet = { 1 } }, - resolveSupport = { - properties = { - "documentation", - "detail", - "additionalTextEdits", + documentationFormat = { "markdown", "plaintext" }, + snippetSupport = true, + preselectSupport = true, + insertReplaceSupport = true, + labelDetailsSupport = true, + deprecatedSupport = true, + commitCharactersSupport = true, + tagSupport = { valueSet = { 1 } }, + resolveSupport = { + properties = { + "documentation", + "detail", + "additionalTextEdits", + }, }, - }, } local opts = { - on_attach = on_attach, - capabilities = capabilities + on_attach = on_attach, + capabilities = capabilities } mason_lspconfig.setup({ - ensure_installed = {}, - automatic_installation = true, + ensure_installed = {}, + automatic_installation = true, }) mason_lspconfig.setup_handlers({ - function(server_name) - lspconfig[server_name].setup(opts) - end, - ["intelephense"] = function() - opts = { - on_attach = on_attach, - capabilities = capabilities, - init_options = { - storagePath = vim.fn.expand "$XDG_CACHE_HOME" .. "/intelephense", - globalStoragePath = vim.fn.expand "$XDG_DATA_HOME" .. "/intelephense" - }, - settings = { - intelephense = { - telemetry = { - enable = false, - } - } - } - } - lspconfig["intelephense"].setup(opts) - end, - ["sumneko_lua"] = function() - opts = { - on_attach = on_attach, - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = { "vim" }, - }, - workspace = { - library = { - [vim.fn.expand "$VIMRUNTIME/lua"] = true, - [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true + function(server_name) + lspconfig[server_name].setup(opts) + end, + ["intelephense"] = function() + opts = { + on_attach = on_attach, + capabilities = capabilities, + init_options = { + storagePath = vim.fn.expand "$XDG_CACHE_HOME" .. "/intelephense", + globalStoragePath = vim.fn.expand "$XDG_DATA_HOME" .. "/intelephense" }, - }, - telemetry = { - enable = false, - }, - maxPreload = 100000, - preloadFileSize = 10000, - }, - }, - } - lspconfig["sumneko_lua"].setup(opts) - end + settings = { + intelephense = { + telemetry = { + enable = false, + } + } + } + } + lspconfig["intelephense"].setup(opts) + end, + ["sumneko_lua"] = function() + opts = { + on_attach = on_attach, + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + workspace = { + library = { + [vim.fn.expand "$VIMRUNTIME/lua"] = true, + [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true + }, + }, + telemetry = { + enable = false, + }, + maxPreload = 100000, + preloadFileSize = 10000, + }, + }, + } + lspconfig["sumneko_lua"].setup(opts) + end }) diff --git a/.config/nvim/lua/plugins/config/lualine.lua b/.config/nvim/lua/plugins/config/lualine.lua index 7c8c712f..453dd8c9 100644 --- a/.config/nvim/lua/plugins/config/lualine.lua +++ b/.config/nvim/lua/plugins/config/lualine.lua @@ -1,199 +1,199 @@ local status_ok, lualine = pcall(require, 'lualine') if not status_ok then - return + return end local colors = require('tokyonight.colors').setup({ transform = true }) -local icons = require('config.iconlist') +local icons = require('config.icons').list local conditions = { - buffer_not_empty = function() - return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 - end, - hide_in_width = function() - return vim.fn.winwidth(0) > 80 - end, - check_git_workspace = function() - local filepath = vim.fn.expand('%:p:h') - local gitdir = vim.fn.finddir('.git', filepath .. ';') - return gitdir and #gitdir > 0 and #gitdir < #filepath - end, + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand('%:p:h') + local gitdir = vim.fn.finddir('.git', filepath .. ';') + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, } local config = { - options = { - component_separators = '', - section_separators = '', - -- theme = { - -- normal = { c = { fg = colors.fg, bg = colors.bg } }, - -- inactive = { c = { fg = colors.fg, bg = colors.bg } }, - -- }, - disabled_filetypes = { - statusline = { 'alpha' } + options = { + component_separators = '', + section_separators = '', + -- theme = { + -- normal = { c = { fg = colors.fg, bg = colors.bg } }, + -- inactive = { c = { fg = colors.fg, bg = colors.bg } }, + -- }, + disabled_filetypes = { + statusline = { 'alpha' } + }, + ignore_focus = { 'toggleterm', 'NvimTree' }, + globalstatus = true, }, - ignore_focus = { 'toggleterm', 'NvimTree' }, - globalstatus = true, - }, - sections = { - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - lualine_c = {}, - lualine_x = {}, - }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_y = {}, - lualine_z = {}, - lualine_c = {}, - lualine_x = {}, - } + sections = { + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + } } local function ins_left(component) - table.insert(config.sections.lualine_c, component) + table.insert(config.sections.lualine_c, component) end local function ins_right(component) - table.insert(config.sections.lualine_x, component) + table.insert(config.sections.lualine_x, component) end local function mode_color() - local color = { - n = colors.red, - i = colors.green, - v = colors.magenta, - [''] = colors.magenta, - V = colors.magenta, - c = colors.blue, - no = colors.red, - s = colors.orange, - S = colors.orange, - [''] = colors.orange, - ic = colors.yellow, - R = colors.violet, - Rv = colors.violet, - cv = colors.red, - ce = colors.red, - r = colors.cyan, - rm = colors.cyan, - ['r?'] = colors.cyan, - ['!'] = colors.red, - t = colors.red, - } - return { fg = color[vim.fn.mode()] } + local color = { + n = colors.red, + i = colors.green, + v = colors.magenta, + [''] = colors.magenta, + V = colors.magenta, + c = colors.blue, + no = colors.red, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.violet, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red, + } + return { fg = color[vim.fn.mode()] } end ins_left { - function() - return '▊' - end, - color = function() - return mode_color() - end, - padding = { right = 1 }, + function() + return '▊' + end, + color = function() + return mode_color() + end, + padding = { right = 1 }, } ins_left { - function() - local msg = 'No Active Lsp' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg - end, - icon = ' LSP:', - color = { fg = colors.white }, + function() + local msg = 'No Active Lsp' + local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end, + icon = ' LSP:', + color = { fg = colors.white }, } ins_left { - 'diagnostics', - sources = { 'nvim_diagnostic' }, - symbols = { error = icons.diagnostics.BoldError .. ' ', warn = icons.diagnostics.BoldWarning .. ' ', - info = icons.diagnostics.BoldInformation }, - diagnostics_color = { - color_error = { fg = colors.red }, - color_warn = { fg = colors.yellow }, - color_info = { fg = colors.cyan }, - }, + 'diagnostics', + sources = { 'nvim_diagnostic' }, + symbols = { error = icons.diagnostics.BoldError .. ' ', warn = icons.diagnostics.BoldWarning .. ' ', + info = icons.diagnostics.BoldInformation }, + diagnostics_color = { + color_error = { fg = colors.red }, + color_warn = { fg = colors.yellow }, + color_info = { fg = colors.cyan }, + }, } ins_left { - function() - return '%=' - end, + function() + return '%=' + end, } ins_left { - 'filename', - color = { fg = colors.magenta, gui = 'bold' }, + 'filename', + color = { fg = colors.magenta, gui = 'bold' }, } ins_left { - function() - local current_line = vim.fn.line "." - local total_lines = vim.fn.line "$" - local chars = icons.progress - local line_ratio = current_line / total_lines - local index = math.ceil(line_ratio * #chars) - return chars[index] - end, - color = { fg = colors.yellow } + function() + local current_line = vim.fn.line "." + local total_lines = vim.fn.line "$" + local chars = icons.progress + local line_ratio = current_line / total_lines + local index = math.ceil(line_ratio * #chars) + return chars[index] + end, + color = { fg = colors.yellow } } ins_left { - '%04l:%04c', + '%04l:%04c', } ins_right { - 'o:encoding', - fmt = string.upper, - cond = conditions.hide_in_width, - color = { fg = colors.green, gui = 'bold' }, + 'o:encoding', + fmt = string.upper, + cond = conditions.hide_in_width, + color = { fg = colors.green, gui = 'bold' }, } ins_right { - 'fileformat', - fmt = string.upper, - icons_enabled = false, - color = { fg = colors.green, gui = 'bold' }, + 'fileformat', + fmt = string.upper, + icons_enabled = false, + color = { fg = colors.green, gui = 'bold' }, } ins_right { - 'branch', - icon = icons.git.Branch, - color = { fg = colors.violet, gui = 'bold' }, + 'branch', + icon = icons.git.Branch, + color = { fg = colors.violet, gui = 'bold' }, } ins_right { - 'diff', - symbols = { added = ' ', modified = '柳', removed = ' ' }, - diff_color = { - added = { fg = colors.green }, - modified = { fg = colors.orange }, - removed = { fg = colors.red }, - }, - cond = conditions.hide_in_width, + 'diff', + symbols = { added = ' ', modified = '柳', removed = ' ' }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, } ins_right { - function() - return '▊' - end, - color = function() - return mode_color() - end, - padding = { left = 1 }, + function() + return '▊' + end, + color = function() + return mode_color() + end, + padding = { left = 1 }, } lualine.setup(config) diff --git a/.config/nvim/lua/plugins/config/luasnip.lua b/.config/nvim/lua/plugins/config/luasnip.lua index d4391cf4..73c9304f 100644 --- a/.config/nvim/lua/plugins/config/luasnip.lua +++ b/.config/nvim/lua/plugins/config/luasnip.lua @@ -1,11 +1,11 @@ local status_ok, luasnip = pcall(require, "LuaSnip") if not status_ok then - return + return end local options = { - history = true, - updateevents = "TextChanged,TextChangedI", + history = true, + updateevents = "TextChanged,TextChangedI", } luasnip.config.set_config(options) @@ -13,11 +13,11 @@ require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.luasnippets_pat require("luasnip.loaders.from_vscode").lazy_load() vim.api.nvim_create_autocmd("InsertLeave", { - callback = function() - if require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] - and not require("luasnip").session.jump_active - then - require("luasnip").unlink_current() - end - end, + callback = function() + if require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()] + and not require("luasnip").session.jump_active + then + require("luasnip").unlink_current() + end + end, }) diff --git a/.config/nvim/lua/plugins/config/mason.lua b/.config/nvim/lua/plugins/config/mason.lua index b5ca18fa..d03efefd 100644 --- a/.config/nvim/lua/plugins/config/mason.lua +++ b/.config/nvim/lua/plugins/config/mason.lua @@ -1,21 +1,21 @@ local status_ok, mason = pcall(require, 'mason') if not status_ok then - return + return end -local icons = require('config.iconlist') +local icons = require('config.icons').list local settings = { - ui = { - border = "none", - icons = { - package_installed = icons.ui.Check, - package_pending = icons.ui.BoldArrowRight, - package_uninstalled = icons.ui.BoldClose, + ui = { + border = "none", + icons = { + package_installed = icons.ui.Check, + package_pending = icons.ui.BoldArrowRight, + package_uninstalled = icons.ui.BoldClose, + }, }, - }, - log_level = vim.log.levels.INFO, - max_concurrent_installers = 4, + log_level = vim.log.levels.INFO, + max_concurrent_installers = 4, } mason.setup(settings) diff --git a/.config/nvim/lua/plugins/config/null-ls.lua b/.config/nvim/lua/plugins/config/null-ls.lua index f46311b7..6240db95 100644 --- a/.config/nvim/lua/plugins/config/null-ls.lua +++ b/.config/nvim/lua/plugins/config/null-ls.lua @@ -1,6 +1,6 @@ local null_ls_status_ok, null_ls = pcall(require, 'null-ls') if not null_ls_status_ok then - return + return end -- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting @@ -12,10 +12,10 @@ local diagnostics = null_ls.builtins.diagnostics -- https://github.com/LunarVim/LunarVim/blob/master/lua/lvim/lsp/utils.lua#L172 null_ls.setup { - debug = false, - sources = { - formatting.black.with { extra_args = { "--fast" } }, - -- formatting.stylua, - -- diagnostics.flake8, - }, + debug = false, + sources = { + formatting.black.with { extra_args = { "--fast" } }, + -- formatting.stylua, + -- diagnostics.flake8, + }, } diff --git a/.config/nvim/lua/plugins/config/nvim-colorizer.lua b/.config/nvim/lua/plugins/config/nvim-colorizer.lua index 10b0f45a..6b7fa411 100644 --- a/.config/nvim/lua/plugins/config/nvim-colorizer.lua +++ b/.config/nvim/lua/plugins/config/nvim-colorizer.lua @@ -1,13 +1,13 @@ local status_ok, colorizer = pcall(require, 'colorizer') if not status_ok then - return + return end colorizer.setup({ '*' }, { - RGB = true, -- #RGB hex codes - RRGGBB = true, -- #RRGGBB hex codes - RRGGBBAA = true, -- #RRGGBBAA hex codes - rgb_fn = true, -- CSS rgb() and rgba() functions - hsl_fn = true, -- CSS hsl() and hsla() functions - css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB - css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + RRGGBBAA = true, -- #RRGGBBAA hex codes + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn }) diff --git a/.config/nvim/lua/plugins/config/project.lua b/.config/nvim/lua/plugins/config/project.lua index 6a62c761..a1290bbe 100644 --- a/.config/nvim/lua/plugins/config/project.lua +++ b/.config/nvim/lua/plugins/config/project.lua @@ -1,18 +1,18 @@ local status_ok, project = pcall(require, 'project_nvim') if not status_ok then - return + return end project.setup({ - -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project - detection_methods = { "pattern" }, + -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project + detection_methods = { "pattern" }, - -- patterns used to detect root dir, when **"pattern"** is in detection_methods - patterns = { ".git", "Makefile", "package.json" }, + -- patterns used to detect root dir, when **"pattern"** is in detection_methods + patterns = { ".git", "Makefile", "package.json" }, }) local tele_status_ok, telescope = pcall(require, 'telescope') if not tele_status_ok then - return + return end telescope.load_extension('projects') diff --git a/.config/nvim/lua/plugins/config/telescope.lua b/.config/nvim/lua/plugins/config/telescope.lua index 176c6ac6..dea62a38 100644 --- a/.config/nvim/lua/plugins/config/telescope.lua +++ b/.config/nvim/lua/plugins/config/telescope.lua @@ -1,67 +1,67 @@ local status_ok, telescope = pcall(require, 'telescope') if not status_ok then - return + return end -local icons = require('config.iconlist') +local icons = require('config.icons').list telescope.setup { - defaults = { + defaults = { - prompt_prefix = icons.ui.Telescope, - selection_caret = icons.ui.Forward, - file_ignore_patterns = { ".git/", "node_modules" }, + prompt_prefix = icons.ui.Telescope, + selection_caret = icons.ui.Forward, + file_ignore_patterns = { ".git/", "node_modules" }, - }, + }, } telescope.setup { - defaults = { - vimgrep_arguments = { - "rg", - "-L", - "--color=never", - "--no-heading", - "--with-filename", - "--line-number", - "--column", - "--smart-case", + defaults = { + vimgrep_arguments = { + "rg", + "-L", + "--color=never", + "--no-heading", + "--with-filename", + "--line-number", + "--column", + "--smart-case", + }, + prompt_prefix = " " .. icons.ui.Search .. " ", + selection_caret = " ", + entry_prefix = " ", + initial_mode = "insert", + selection_strategy = "reset", + sorting_strategy = "ascending", + layout_strategy = "horizontal", + layout_config = { + horizontal = { + prompt_position = "top", + preview_width = 0.55, + results_width = 0.8, + }, + vertical = { + mirror = false, + }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, + file_sorter = require("telescope.sorters").get_fuzzy_file, + file_ignore_patterns = { ".git/", "node_modules" }, + generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, + path_display = { "truncate" }, + winblend = 0, + border = {}, + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, + color_devicons = true, + set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, + file_previewer = require("telescope.previewers").vim_buffer_cat.new, + grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, + qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, + -- Developer configurations: Not meant for general override + buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, + mappings = { + n = { ["q"] = require("telescope.actions").close }, + }, }, - prompt_prefix = " " .. icons.ui.Search .. " ", - selection_caret = " ", - entry_prefix = " ", - initial_mode = "insert", - selection_strategy = "reset", - sorting_strategy = "ascending", - layout_strategy = "horizontal", - layout_config = { - horizontal = { - prompt_position = "top", - preview_width = 0.55, - results_width = 0.8, - }, - vertical = { - mirror = false, - }, - width = 0.87, - height = 0.80, - preview_cutoff = 120, - }, - file_sorter = require("telescope.sorters").get_fuzzy_file, - file_ignore_patterns = { ".git/", "node_modules" }, - generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter, - path_display = { "truncate" }, - winblend = 0, - border = {}, - borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, - color_devicons = true, - set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, - file_previewer = require("telescope.previewers").vim_buffer_cat.new, - grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new, - qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new, - -- Developer configurations: Not meant for general override - buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, - mappings = { - n = { ["q"] = require("telescope.actions").close }, - }, - }, } diff --git a/.config/nvim/lua/plugins/config/todo-comments.lua b/.config/nvim/lua/plugins/config/todo-comments.lua index b3368daa..51a35d5e 100644 --- a/.config/nvim/lua/plugins/config/todo-comments.lua +++ b/.config/nvim/lua/plugins/config/todo-comments.lua @@ -1,10 +1,10 @@ local status_ok, todo_comments = pcall(require, 'todo-comments') if not status_ok then - return + return end todo_comments.setup({ - highlight = { - multiline = false, - comments_only = false - } + highlight = { + multiline = false, + comments_only = false + } }) diff --git a/.config/nvim/lua/plugins/config/toggleterm.lua b/.config/nvim/lua/plugins/config/toggleterm.lua index b6d8ada5..16f9ecac 100644 --- a/.config/nvim/lua/plugins/config/toggleterm.lua +++ b/.config/nvim/lua/plugins/config/toggleterm.lua @@ -1,33 +1,33 @@ local status_ok, toggleterm = pcall(require, 'toggleterm') if not status_ok then - return + return end toggleterm.setup({ - size = 20, - open_mapping = [[]], - hide_numbers = true, - shade_terminals = true, - shading_factor = 2, - start_in_insert = true, - insert_mappings = true, - persist_size = true, - direction = "float", - close_on_exit = true, - shell = vim.o.shell, - float_opts = { - winblend = 0, - highlights = { - border = "Normal", - background = "Normal", + size = 20, + open_mapping = [[]], + hide_numbers = true, + shade_terminals = true, + shading_factor = 2, + start_in_insert = true, + insert_mappings = true, + persist_size = true, + direction = "float", + close_on_exit = true, + shell = vim.o.shell, + float_opts = { + winblend = 0, + highlights = { + border = "Normal", + background = "Normal", + }, + border = "rounded", }, - border = "rounded", - }, }) local Terminal = require("toggleterm.terminal").Terminal local lazygit = Terminal:new({ cmd = "lazygit", hidden = true }) function _LAZYGIT_TOGGLE() - lazygit:toggle() + lazygit:toggle() end diff --git a/.config/nvim/lua/plugins/config/tokyonight.lua b/.config/nvim/lua/plugins/config/tokyonight.lua index 6a8eb8c1..52442420 100644 --- a/.config/nvim/lua/plugins/config/tokyonight.lua +++ b/.config/nvim/lua/plugins/config/tokyonight.lua @@ -1,12 +1,12 @@ local status_ok, tokyonight = pcall(require, 'tokyonight') if not status_ok then - return + return end tokyonight.setup({ - transparent = true, - terminal_colors = true, - dim_inactive = true, - lualine_bold = true, + transparent = true, + terminal_colors = true, + dim_inactive = true, + lualine_bold = true, }) vim.cmd [[colorscheme tokyonight]] diff --git a/.config/nvim/lua/plugins/config/treesitter.lua b/.config/nvim/lua/plugins/config/treesitter.lua index 95043676..004f5b73 100644 --- a/.config/nvim/lua/plugins/config/treesitter.lua +++ b/.config/nvim/lua/plugins/config/treesitter.lua @@ -1,15 +1,15 @@ local status_ok, configs = pcall(require, 'nvim-treesitter.configs') if not status_ok then - return + return end configs.setup({ - ensure_installed = { "lua", "bash", "c" }, - auto_install = true, - autopairs = { - enable = false, - }, - context_commentstring = { - enable = true, - enable_autocmd = false, - }, + ensure_installed = { "lua", "bash", "c" }, + auto_install = true, + autopairs = { + enable = false, + }, + context_commentstring = { + enable = true, + enable_autocmd = false, + }, }) diff --git a/.config/nvim/lua/plugins/config/whichkey.lua b/.config/nvim/lua/plugins/config/whichkey.lua index d619a577..1f8605e6 100644 --- a/.config/nvim/lua/plugins/config/whichkey.lua +++ b/.config/nvim/lua/plugins/config/whichkey.lua @@ -1,51 +1,51 @@ local status_ok, whichkey = pcall(require, 'which-key') if not status_ok then - return + return end -local icons = require('config.iconlist') +local icons = require('config.icons').list whichkey.setup { - marks = false, - registers = false, - presets = { - operators = false, - motions = false, - text_objects = false, - windows = false, - nav = false, - z = false, - g = false, - }, - spelling = { - enabled = false, - suggestions = 20, - }, - icons = { - breadcrumb = icons.ui.DoubleChevronRight, - separator = icons.ui.BoldArrowRight, - group = icons.ui.Plus, - }, - popup_mappings = { - scroll_down = "", - scroll_up = "", - }, - window = { - border = "single", - position = "bottom", - margin = { 1, 0, 1, 0 }, - padding = { 2, 2, 2, 2 }, - winblend = 0, - }, - layout = { - height = { min = 4, max = 25 }, - width = { min = 20, max = 50 }, - spacing = 3, - align = "left", - }, - hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, - triggers = "auto", - triggers_blacklist = { - i = { "j", "k" }, - v = { "j", "k", "c", "y", "d", "v" }, - }, + marks = false, + registers = false, + presets = { + operators = false, + motions = false, + text_objects = false, + windows = false, + nav = false, + z = false, + g = false, + }, + spelling = { + enabled = false, + suggestions = 20, + }, + icons = { + breadcrumb = icons.ui.DoubleChevronRight, + separator = icons.ui.BoldArrowRight, + group = icons.ui.Plus, + }, + popup_mappings = { + scroll_down = "", + scroll_up = "", + }, + window = { + border = "single", + position = "bottom", + margin = { 1, 0, 1, 0 }, + padding = { 2, 2, 2, 2 }, + winblend = 0, + }, + layout = { + height = { min = 4, max = 25 }, + width = { min = 20, max = 50 }, + spacing = 3, + align = "left", + }, + hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, + triggers = "auto", + triggers_blacklist = { + i = { "j", "k" }, + v = { "j", "k", "c", "y", "d", "v" }, + }, } diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua index 50409cc1..24e2b2ab 100644 --- a/.config/nvim/lua/plugins/init.lua +++ b/.config/nvim/lua/plugins/init.lua @@ -1,244 +1,250 @@ -local icons = require "config.iconlist" +local icons = require('config.icons').list local plugins = { - { "wbthomason/packer.nvim", - config = function() - require('funcs').map("packer") - end - }, - { "nvim-lua/plenary.nvim" }, - { "lewis6991/impatient.nvim" }, - { "tpope/vim-surround", - setup = function() - require('funcs').on_file_open("vim-surround") - end - }, - { "tpope/vim-repeat", - setup = function() - require('funcs').on_file_open("vim-repeat") - end - }, - { "fladson/vim-kitty", - ft = "kitty" - }, - { "kyazdani42/nvim-web-devicons" }, - { "felipec/vim-sanegx", - setup = function() - require('funcs').on_file_open("vim-sanegx") - end - }, - { "folke/which-key.nvim", - config = function() - require('plugins.config.whichkey') - end, - }, - { "folke/tokyonight.nvim", - config = function() - require('plugins.config.tokyonight') - end - }, - { "folke/todo-comments.nvim", - setup = function() - require('funcs').on_file_open("todo-comments.nvim") - end, - config = function() - require('plugins.config.todo-comments') - end - }, - { "akinsho/bufferline.nvim", - setup = function() - require('funcs').on_file_open("bufferline.nvim") - require('funcs').map("bufferline") - end, - config = function() - require('plugins.config.bufferline') - end, - }, - { "nvim-lualine/lualine.nvim", - setup = function() - require('funcs').on_file_open("lualine.nvim") - end, - config = function() - require('plugins.config.lualine') - end, - }, - { "akinsho/toggleterm.nvim", - config = function() - require('plugins.config.toggleterm') - end, - }, - { "lukas-reineke/indent-blankline.nvim", - after = "nvim-treesitter", - setup = function() - require('funcs').on_file_open("indent-blankline.nvim") - require('funcs').map("blankline") - end, - config = function() - require('plugins.config.indent-blankline') - end, - }, - { "norcalli/nvim-colorizer.lua", - setup = function() - require('funcs').on_file_open("nvim-colorizer.lua") - end, - config = function() - require('plugins.config.nvim-colorizer') - end, - }, - { "RRethy/vim-illuminate", - setup = function() - require('funcs').on_file_open("vim-illuminate") - require('funcs').map("illuminate") - end, - config = function() - require('plugins.config.illuminate') - end, - }, - { "nvim-treesitter/nvim-treesitter", - setup = function() - require('funcs').on_file_open("nvim-treesitter") - end, - cmd = { - "TSInstall", - "TSBufEnable", - "TSBufDisable", - "TSEnable", - "TSDisable", - "TSModuleInfo" + { "wbthomason/packer.nvim", + config = function() + require('funcs').map("packer") + end + }, + { "nvim-lua/plenary.nvim" }, + { "lewis6991/impatient.nvim" }, + { "tpope/vim-surround", + setup = function() + require('funcs').on_file_open("vim-surround") + end + }, + { "tpope/vim-repeat", + setup = function() + require('funcs').on_file_open("vim-repeat") + end + }, + { "fladson/vim-kitty", + ft = "kitty" + }, + { "kyazdani42/nvim-web-devicons" }, + { "felipec/vim-sanegx", + setup = function() + require('funcs').on_file_open("vim-sanegx") + end + }, + { "folke/which-key.nvim", + config = function() + require('plugins.config.whichkey') + end, + }, + { "folke/tokyonight.nvim", + config = function() + require('plugins.config.tokyonight') + end + }, + { "folke/todo-comments.nvim", + setup = function() + require('funcs').on_file_open("todo-comments.nvim") + end, + config = function() + require('plugins.config.todo-comments') + end + }, + { "akinsho/bufferline.nvim", + setup = function() + require('funcs').on_file_open("bufferline.nvim") + require('funcs').map("bufferline") + end, + config = function() + require('plugins.config.bufferline') + end, + }, + { "nvim-lualine/lualine.nvim", + setup = function() + require('funcs').on_file_open("lualine.nvim") + end, + config = function() + require('plugins.config.lualine') + end, + }, + { "akinsho/toggleterm.nvim", + config = function() + require('plugins.config.toggleterm') + end, + }, + { "lukas-reineke/indent-blankline.nvim", + after = "nvim-treesitter", + setup = function() + require('funcs').on_file_open("indent-blankline.nvim") + require('funcs').map("blankline") + end, + config = function() + require('plugins.config.indent-blankline') + end, + }, + { "norcalli/nvim-colorizer.lua", + setup = function() + require('funcs').on_file_open("nvim-colorizer.lua") + end, + config = function() + require('plugins.config.nvim-colorizer') + end, + }, + { "RRethy/vim-illuminate", + setup = function() + require('funcs').on_file_open("vim-illuminate") + require('funcs').map("illuminate") + end, + config = function() + require('plugins.config.illuminate') + end, + }, + { "nvim-treesitter/nvim-treesitter", + setup = function() + require('funcs').on_file_open("nvim-treesitter") + end, + cmd = { + "TSInstall", + "TSBufEnable", + "TSBufDisable", + "TSEnable", + "TSDisable", + "TSModuleInfo" + }, + run = ":TSUpdate", + config = function() + require('plugins.config.treesitter') + end, + }, + { "lewis6991/gitsigns.nvim", + ft = "gitcommit", + setup = function() + require('funcs').gitsigns() + end, + config = function() + require('plugins.config.gitsigns') + end, + }, + { "williamboman/mason.nvim", + setup = function() + require('funcs').map("mason") + end, + config = function() + require "plugins.config.mason" + end, + }, + { "williamboman/mason-lspconfig.nvim" }, + { "neovim/nvim-lspconfig", + after = "mason-lspconfig.nvim", + setup = function() + require('funcs').on_file_open("nvim-lspconfig") + require('funcs').map("lspconfig") + end, + config = function() + require('plugins.config.lspconfig') + end, + }, + { "jose-elias-alvarez/null-ls.nvim", + config = function() + require('plugins.config.null-ls') + end, + }, + { "rcarriga/nvim-dap-ui", + after = "nvim-dap", + setup = function() + require('funcs').on_file_open("nvim-dap-ui") + end, + config = function() + require('plugins.config.dapui') + end, + }, + { "mfussenegger/nvim-dap", + setup = function() + require('funcs').on_file_open("nvim-dap") + require('funcs').map("dap") + end, + config = function() + require('plugins.config.dap') + end, + }, + { "olical/aniseed" }, + { "olical/conjure" }, + { "rafamadriz/friendly-snippets", + event = "InsertEnter", + module = { "cmp", "cmp_nvim_lsp" }, + }, + { "hrsh7th/nvim-cmp", + after = "friendly-snippets", + config = function() + require('plugins.config.cmp') + end, + }, + { "L3MON4D3/LuaSnip", + after = "nvim-cmp", + config = function() + require('plugins.config.luasnip') + end, + }, + { "saadparwaiz1/cmp_luasnip", after = "LuaSnip" }, + { "hrsh7th/cmp-nvim-lua", after = "cmp_luasnip" }, + { "hrsh7th/cmp-nvim-lsp", after = "cmp-nvim-lua" }, + { "hrsh7th/cmp-buffer", after = "cmp-nvim-lsp" }, + { "hrsh7th/cmp-path", after = "cmp-buffer" }, + { "paterjason/cmp-conjure", + after = { "cmp-buffer", "conjure" }, + ft = "fennel" + }, + { "onsails/lspkind.nvim" }, + { "windwp/nvim-autopairs", + after = "nvim-cmp", + config = function() + require('plugins.config.autopairs') + end, + }, + { "goolord/alpha-nvim", + config = function() + require('plugins.config.alpha') + end, + }, + { "numToStr/Comment.nvim", + config = function() + require('plugins.config.comment') + end, + setup = function() + require('funcs').on_file_open("Comment.nvim") + require('funcs').map("comment") + end, + }, + { "lmburns/lf.nvim", + config = function() + require('plugins.config.lf') + require('funcs').map("lf") + end + }, + { "nvim-telescope/telescope.nvim", + config = function() + require('plugins.config.telescope') + require('funcs').map("telescope") + end, + }, + { "ahmedkhalf/project.nvim", + after = "telescope.nvim", + config = function() + require('plugins.config.project') + end, }, - run = ":TSUpdate", - config = function() - require('plugins.config.treesitter') - end, - }, - { "lewis6991/gitsigns.nvim", - ft = "gitcommit", - setup = function() - require('funcs').gitsigns() - end, - config = function() - require('plugins.config.gitsigns') - end, - }, - { "williamboman/mason.nvim", - setup = function() - require('funcs').map("mason") - end, - config = function() - require "plugins.config.mason" - end, - }, - { "williamboman/mason-lspconfig.nvim" }, - { "neovim/nvim-lspconfig", - after = "mason-lspconfig.nvim", - setup = function() - require('funcs').on_file_open("nvim-lspconfig") - require('funcs').map("lspconfig") - end, - config = function() - require('plugins.config.lspconfig') - end, - }, - { "jose-elias-alvarez/null-ls.nvim", - config = function() - require('plugins.config.null-ls') - end, - }, - { "rcarriga/nvim-dap-ui", - after = "nvim-dap", - setup = function() - require('funcs').on_file_open("nvim-dap-ui") - end, - config = function() - require('plugins.config.dapui') - end, - }, - { "mfussenegger/nvim-dap", - setup = function() - require('funcs').on_file_open("nvim-dap") - require('funcs').map("dap") - end, - config = function() - require('plugins.config.dap') - end, - }, - { "rafamadriz/friendly-snippets", - event = "InsertEnter", - module = { "cmp", "cmp_nvim_lsp" }, - }, - { "hrsh7th/nvim-cmp", - after = "friendly-snippets", - config = function() - require('plugins.config.cmp') - end, - }, - { "L3MON4D3/LuaSnip", - after = "nvim-cmp", - config = function() - require('plugins.config.luasnip') - end, - }, - { "saadparwaiz1/cmp_luasnip", after = "LuaSnip" }, - { "hrsh7th/cmp-nvim-lua", after = "cmp_luasnip" }, - { "hrsh7th/cmp-nvim-lsp", after = "cmp-nvim-lua" }, - { "hrsh7th/cmp-buffer", after = "cmp-nvim-lsp" }, - { "hrsh7th/cmp-path", after = "cmp-buffer" }, - { "onsails/lspkind.nvim" }, - { "windwp/nvim-autopairs", - after = "nvim-cmp", - config = function() - require('plugins.config.autopairs') - end, - }, - { "goolord/alpha-nvim", - config = function() - require('plugins.config.alpha') - end, - }, - { "numToStr/Comment.nvim", - config = function() - require('plugins.config.comment') - end, - setup = function() - require('funcs').on_file_open("Comment.nvim") - require('funcs').map("comment") - end, - }, - { "lmburns/lf.nvim", - config = function() - require('plugins.config.lf') - require('funcs').map("lf") - end - }, - { "nvim-telescope/telescope.nvim", - config = function() - require('plugins.config.telescope') - require('funcs').map("telescope") - end, - }, - { "ahmedkhalf/project.nvim", - after = "telescope.nvim", - config = function() - require('plugins.config.project') - end, - }, } local status_ok, packer = pcall(require, "packer") if not status_ok then - return + return end vim.cmd "packadd packer.nvim" packer.init { - git = { clone_timeout = 6000 }, - display = { - working_sym = icons.misc.Watch, - error_sym = icons.ui.Close, - done_sym = icons.ui.Check, - removed_sym = icons.ui.MinusCircle, - moved_sym = icons.ui.Forward, - open_fn = function() - return require('packer.util').float { border = "single" } - end - } + git = { clone_timeout = 6000 }, + display = { + working_sym = icons.misc.Watch, + error_sym = icons.ui.Close, + done_sym = icons.ui.Check, + removed_sym = icons.ui.MinusCircle, + moved_sym = icons.ui.Forward, + open_fn = function() + return require('packer.util').float { border = "single" } + end + } } packer.startup { plugins } diff --git a/.config/nvim/lua/plugins/test.fnl b/.config/nvim/lua/plugins/test.fnl new file mode 100644 index 00000000..e69de29b