diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 0c0cd37f..42647be5 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -1,78 +1,78 @@ local autocmds = { - { -- 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", - }, - }, - { -- Use 'q' to quit from common plugins - "FileType", - { - pattern = { "help", "man" }, - callback = function() - vim.cmd([[ - nnoremap q :close - set nobuflisted + { -- 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", + }, + }, + { -- Use 'q' to quit from common plugins + "FileType", + { + pattern = { "help", "man" }, + callback = function() + vim.cmd([[ + nnoremap q :close + set nobuflisted ]]) - end, - }, - }, - { - "Filetype", - { - pattern = { "gitcommit", "markdown" }, - callback = function() - vim.opt_local.spell = true - end, - }, - }, - { -- Fix auto comment - "BufWinEnter", - { - command = "set formatoptions-=cro", - }, - }, - { -- Highlight yanked text - "TextYankPost", - { - callback = function() - vim.highlight.on_yank({ higroup = "Visual", timeout = 200 }) - end, - }, - }, - { -- Trigger shortcuts script - "BufWritePost", - { + end, + }, + }, + { + "Filetype", + { + pattern = { "gitcommit", "markdown" }, + callback = function() + vim.opt_local.spell = true + end, + }, + }, + { -- Fix auto comment + "BufWinEnter", + { + command = "set formatoptions-=cro", + }, + }, + { -- Highlight yanked text + "TextYankPost", + { + callback = function() + vim.highlight.on_yank({ higroup = "Visual", timeout = 200 }) + end, + }, + }, + { -- Trigger shortcuts script + "BufWritePost", + { pattern = { "directories", "files" }, command = "!shortcuts" - }, - }, - { -- Trigger xrdb - "BufWritePost", - { + }, + }, + { -- Trigger xrdb + "BufWritePost", + { pattern = { "xresources" }, command = "!xrdb %" - }, - }, + }, + }, } vim.api.nvim_create_augroup("user_config", { clear = true }) for _, entry in ipairs(autocmds) 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) + 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/filetypes.lua b/.config/nvim/lua/config/filetypes.lua index 5982590e..4a9b4007 100644 --- a/.config/nvim/lua/config/filetypes.lua +++ b/.config/nvim/lua/config/filetypes.lua @@ -2,26 +2,26 @@ local ansible_test = function(path, bufnr) if string.find(path, "templates") or string.find(path, "files") then return "yaml" end - local find = { "tasks", "roles", "handlers", "group_vars", "host_vars", "ansible.cfg", ".ansible-lint" } - local opts = { stop = os.getenv("HOME"), upward = true, limit = 1, path = path } - if next(vim.fs.find(find, opts)) ~= nil then - return "yaml.ansible" - else - return "yaml" - end + local find = { "tasks", "roles", "handlers", "group_vars", "host_vars", "ansible.cfg", ".ansible-lint" } + local opts = { stop = os.getenv("HOME"), upward = true, limit = 1, path = path } + if next(vim.fs.find(find, opts)) ~= nil then + return "yaml.ansible" + else + return "yaml" + end end local filetypes = { - extension = { - yml = ansible_test, - yaml = ansible_test, - }, - filename = { - ["Xresources"] = "xdefaults", - ["Xdefaults"] = "xdefaults", - ["xresources"] = "xdefaults", - ["xdefaults"] = "xdefaults", - }, + extension = { + yml = ansible_test, + yaml = ansible_test, + }, + filename = { + ["Xresources"] = "xdefaults", + ["Xdefaults"] = "xdefaults", + ["xresources"] = "xdefaults", + ["xdefaults"] = "xdefaults", + }, } vim.filetype.add(filetypes) diff --git a/.config/nvim/lua/config/icons.lua b/.config/nvim/lua/config/icons.lua index e1af69a3..430c1580 100644 --- a/.config/nvim/lua/config/icons.lua +++ b/.config/nvim/lua/config/icons.lua @@ -1,81 +1,81 @@ return { - Diagnostic = "󰭷", - Error = "󰅗", - Hint = "󰌵", - Info = "󰋼", - Warn = "󰀦", - Bug = "󰠭", - True = "󰸞", - Pending = "󰁪", - False = "󱎘", - Close = "󱎘", - Selected = "󰅂", - Console = "󰆍", - Gear = "󰒓", - Event = "󱐋", - File = "󰈔", - NewFile = "󰝒", - FileTree = "󰙅", - Import = "󰈠", - Keyboard = "󰌌", - Sleep = "󰒲", - Package = "󰏗", - Runtime = "", - Source = "󰈮", - Code = "", - Start = "", - Task = "󰱒", - Buffer = "󰧭", - Search = "", - Speed = "󰾆", - Test = "", - Flame = "", - Leave = "", - Git = "󰊢", - Loaded = "󰜄", - Unloaded = "󰛲", - Added = "󰜄", - Modified = "󱗝", - Removed = "󰛲", - Untracked = "", - ChangeDelete = "󰅘", - Truncate = "", - Note = "", - lspkind = { - 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 = "", - }, - -- progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" }, + Diagnostic = "󰭷", + Error = "󰅗", + Hint = "󰌵", + Info = "󰋼", + Warn = "󰀦", + Bug = "󰠭", + True = "󰸞", + Pending = "󰁪", + False = "󱎘", + Close = "󱎘", + Selected = "󰅂", + Console = "󰆍", + Gear = "󰒓", + Event = "󱐋", + File = "󰈔", + NewFile = "󰝒", + FileTree = "󰙅", + Import = "󰈠", + Keyboard = "󰌌", + Sleep = "󰒲", + Package = "󰏗", + Runtime = "", + Source = "󰈮", + Code = "", + Start = "", + Task = "󰱒", + Buffer = "󰧭", + Search = "", + Speed = "󰾆", + Test = "", + Flame = "", + Leave = "", + Git = "󰊢", + Loaded = "󰜄", + Unloaded = "󰛲", + Added = "󰜄", + Modified = "󱗝", + Removed = "󰛲", + Untracked = "", + ChangeDelete = "󰅘", + Truncate = "", + Note = "", + lspkind = { + 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 = "", + }, + -- progress = { "", "", "", "", "", "", "", "", "", "", "", "", "" }, } diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index a613c934..d203961b 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -25,7 +25,6 @@ M.maps = function() maps.n["w"] = { "w", desc = "Write buffer" } maps.n["c"] = { "conf q", desc = "Quit" } maps.n["C"] = { "conf qa", desc = "Quit all" } - maps.n["n"] = { "ene", desc = "New buffer" } maps.n["h"] = { "noh", desc = "Clear highlight" } maps.n[""] = { "w!", desc = "Force write buffer" } maps.n[""] = { "qa!", desc = "Force quit all" } @@ -38,6 +37,7 @@ M.maps = function() maps.n[""] = { "" } maps.i[""] = { "" } maps.v["p"] = { "pgvy" } + maps.n["bn"] = { "ene", desc = "New buffer" } -- Utility -- if f.is_available("nvim-colorizer.lua") then @@ -496,7 +496,7 @@ M.maps = function() function() local worktree = f.file_worktree() local flags = worktree - and (" --work-tree=%s --git-dir=%s"):format(worktree.toplevel, worktree.gitdir) + and (" --work-tree=%s --git-dir=%s"):format(worktree.toplevel, worktree.gitdir) or "" f.toggle_term_cmd("lazygit " .. flags) end, diff --git a/.config/nvim/lua/config/lsp.lua b/.config/nvim/lua/config/lsp.lua index c0b89e41..e492484e 100644 --- a/.config/nvim/lua/config/lsp.lua +++ b/.config/nvim/lua/config/lsp.lua @@ -2,29 +2,29 @@ local conf = { handlers = {} } -- https://github.com/bmewburn/intelephense-docs/blob/master/installation.md#configuration-options conf.handlers["intelephense"] = { - init_options = { - storagePath = os.getenv("XDG_CACHE_HOME") .. "/intelephense", - globalStoragePath = os.getenv("XDG_CONFIG_HOME") .. "/intelephense", - licenceKey = os.getenv("XDG_CONFIG_HOME") .. "/intelephense/license.txt", - }, + init_options = { + storagePath = os.getenv("XDG_CACHE_HOME") .. "/intelephense", + globalStoragePath = os.getenv("XDG_CONFIG_HOME") .. "/intelephense", + licenceKey = os.getenv("XDG_CONFIG_HOME") .. "/intelephense/license.txt", + }, } conf.handlers["bashls"] = { - settings = { - bashIde = { - shellcheckPath = vim.fn.stdpath("data") .. "mason/bin/shellcheck", - }, - }, + settings = { + bashIde = { + shellcheckPath = vim.fn.stdpath("data") .. "mason/bin/shellcheck", + }, + }, } conf.required = { - "zk", - "jsonls", - "yamlls", - "lua_ls", - "bashls", - "ansiblels", - "dockerls", + "zk", + "jsonls", + "yamlls", + "lua_ls", + "bashls", + "ansiblels", + "dockerls", } diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua index a243e3c3..a5e6f2d0 100644 --- a/.config/nvim/lua/config/options.lua +++ b/.config/nvim/lua/config/options.lua @@ -7,7 +7,7 @@ g.mapleader = " " g.maplocalleader = " " g.vim_json_conceal = 0 g.git_worktrees = { - { toplevel = vim.env.HOME, gitdir = vim.env.XDG_DATA_HOME .. "/dots" }, + { toplevel = vim.env.HOME, gitdir = vim.env.XDG_DATA_HOME .. "/dots" }, } g.max_lines = 1000 g.max_size = 1024 * 100 diff --git a/.config/nvim/lua/funcs.lua b/.config/nvim/lua/funcs.lua index 255c011c..48b564af 100644 --- a/.config/nvim/lua/funcs.lua +++ b/.config/nvim/lua/funcs.lua @@ -2,566 +2,566 @@ local M = {} local icons = require("config.icons") function M.set_title() - local title = " %t" - local f = io.popen([[ zsh -lc 'print -P $PS1' | sed 's/\[[0-9;]*m//g;s/» / %t/g' ]]) - if f ~= nil then - title = f:read("*a") or "" - f:close() - end - vim.opt.titlestring = title + local title = " %t" + local f = io.popen([[ zsh -lc 'print -P $PS1' | sed 's/\[[0-9;]*m//g;s/» / %t/g' ]]) + if f ~= nil then + title = f:read("*a") or "" + f:close() + end + vim.opt.titlestring = title end function M.buf_close(bufnr, force) - local kill_command = "bd" + local kill_command = "bd" - local bo = vim.bo - local api = vim.api - local fnamemodify = vim.fn.fnamemodify + local bo = vim.bo + local api = vim.api + local fnamemodify = vim.fn.fnamemodify - if bufnr == 0 or bufnr == nil then - bufnr = api.nvim_get_current_buf() - end + if bufnr == 0 or bufnr == nil then + bufnr = api.nvim_get_current_buf() + end - local bufname = api.nvim_buf_get_name(bufnr) + local bufname = api.nvim_buf_get_name(bufnr) - if not force then - local warning - if bo[bufnr].modified then - warning = string.format([[No write since last change for (%s)]], fnamemodify(bufname, ":t")) - elseif api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then - warning = string.format([[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 + if not force then + local warning + if bo[bufnr].modified then + warning = string.format([[No write since last change for (%s)]], fnamemodify(bufname, ":t")) + elseif api.nvim_buf_get_option(bufnr, "buftype") == "terminal" then + warning = string.format([[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 - -- Get list of window 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()) + -- Get list of window 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 #windows == 0 then + return + end - if force then - kill_command = kill_command .. "!" - 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()) + -- 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 + -- 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 + -- 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 function M.is_available(plugin) - local lazy_config_avail, lazy_config = pcall(require, "lazy.core.config") - return lazy_config_avail and lazy_config.spec.plugins[plugin] ~= nil + local lazy_config_avail, lazy_config = pcall(require, "lazy.core.config") + return lazy_config_avail and lazy_config.spec.plugins[plugin] ~= nil end function M.empty_map_table() - local maps = {} - for _, mode in ipairs({ "", "n", "v", "x", "s", "o", "!", "i", "l", "c", "t" }) do - maps[mode] = {} - end - -- TODO: Check this on 0.10.0 release - if vim.fn.has("nvim-0.10.0") == 1 then - for _, abbr_mode in ipairs({ "ia", "ca", "!a" }) do - maps[abbr_mode] = {} - end - end - return maps + local maps = {} + for _, mode in ipairs({ "", "n", "v", "x", "s", "o", "!", "i", "l", "c", "t" }) do + maps[mode] = {} + end + -- TODO: Check this on 0.10.0 release + if vim.fn.has("nvim-0.10.0") == 1 then + for _, abbr_mode in ipairs({ "ia", "ca", "!a" }) do + maps[abbr_mode] = {} + end + end + return maps end function M.toggle_term_cmd(opts) - if not vim.g.user_terminals then - vim.g.user_terminals = {} - end - local terms = vim.g.user_terminals - if type(opts) == "string" then - opts = { cmd = opts, hidden = true } - end - local num = vim.v.count > 0 and vim.v.count or 1 - if not terms[opts.cmd] then - terms[opts.cmd] = {} - end - if not terms[opts.cmd][num] then - if not opts.count then - opts.count = vim.tbl_count(terms) * 100 + num - end - if not opts.on_exit then - opts.on_exit = function() - terms[opts.cmd][num] = nil - end - end - terms[opts.cmd][num] = require("toggleterm.terminal").Terminal:new(opts) - end - terms[opts.cmd][num]:toggle() + if not vim.g.user_terminals then + vim.g.user_terminals = {} + end + local terms = vim.g.user_terminals + if type(opts) == "string" then + opts = { cmd = opts, hidden = true } + end + local num = vim.v.count > 0 and vim.v.count or 1 + if not terms[opts.cmd] then + terms[opts.cmd] = {} + end + if not terms[opts.cmd][num] then + if not opts.count then + opts.count = vim.tbl_count(terms) * 100 + num + end + if not opts.on_exit then + opts.on_exit = function() + terms[opts.cmd][num] = nil + end + end + terms[opts.cmd][num] = require("toggleterm.terminal").Terminal:new(opts) + end + terms[opts.cmd][num]:toggle() end function M.cmd(cmd, show_error) - if type(cmd) == "string" then - cmd = { cmd } - end - local result = vim.fn.system(cmd) - local success = vim.api.nvim_get_vvar("shell_error") == 0 - if not success and (show_error == nil or show_error) then - vim.api.nvim_err_writeln( - ("Error running command %s\nError message:\n%s"):format(table.concat(cmd, " "), result) - ) - end - return success and result:gsub("[\27\155][][()#;?%d]*[A-PRZcf-ntqry=><~]", "") or nil + if type(cmd) == "string" then + cmd = { cmd } + end + local result = vim.fn.system(cmd) + local success = vim.api.nvim_get_vvar("shell_error") == 0 + if not success and (show_error == nil or show_error) then + vim.api.nvim_err_writeln( + ("Error running command %s\nError message:\n%s"):format(table.concat(cmd, " "), result) + ) + end + return success and result:gsub("[\27\155][][()#;?%d]*[A-PRZcf-ntqry=><~]", "") or nil end function M.file_worktree(file, worktrees) - worktrees = worktrees or vim.g.git_worktrees - file = file or vim.fn.expand("%") - for _, worktree in ipairs(worktrees) do - if - M.cmd({ - "git", - "--work-tree", - worktree.toplevel, - "--git-dir", - worktree.gitdir, - "ls-files", - "--error-unmatch", - file, - }, false) - then - return worktree - end - end + worktrees = worktrees or vim.g.git_worktrees + file = file or vim.fn.expand("%") + for _, worktree in ipairs(worktrees) do + if + M.cmd({ + "git", + "--work-tree", + worktree.toplevel, + "--git-dir", + worktree.gitdir, + "ls-files", + "--error-unmatch", + file, + }, false) + then + return worktree + end + end end function M.which_key_register() - if M.which_key_queue then - local wk_avail, wk = pcall(require, "which-key") - if wk_avail then - for mode, registration in pairs(M.which_key_queue) do - wk.register(registration, { mode = mode }) - end - M.which_key_queue = nil - end - end + if M.which_key_queue then + local wk_avail, wk = pcall(require, "which-key") + if wk_avail then + for mode, registration in pairs(M.which_key_queue) do + wk.register(registration, { mode = mode }) + end + M.which_key_queue = nil + end + end end function M.set_maps(map_table, base) - base = base or {} - for mode, maps in pairs(map_table) do - for keymap, options in pairs(maps) do - if options then - local cmd = options - local keymap_opts = base - if type(options) == "table" then - cmd = options[1] - keymap_opts = vim.tbl_deep_extend("force", keymap_opts, options) - keymap_opts[1] = nil - end - if not cmd or keymap_opts.name then -- which-key mapping - if not keymap_opts.name then - keymap_opts.name = keymap_opts.desc - end - if not M.which_key_queue then - M.which_key_queue = {} - end - if not M.which_key_queue[mode] then - M.which_key_queue[mode] = {} - end - M.which_key_queue[mode][keymap] = keymap_opts - else -- not which-key mapping - vim.keymap.set(mode, keymap, cmd, keymap_opts) - end - end - end - end - if package.loaded["which-key"] then - M.which_key_register() - end + base = base or {} + for mode, maps in pairs(map_table) do + for keymap, options in pairs(maps) do + if options then + local cmd = options + local keymap_opts = base + if type(options) == "table" then + cmd = options[1] + keymap_opts = vim.tbl_deep_extend("force", keymap_opts, options) + keymap_opts[1] = nil + end + if not cmd or keymap_opts.name then -- which-key mapping + if not keymap_opts.name then + keymap_opts.name = keymap_opts.desc + end + if not M.which_key_queue then + M.which_key_queue = {} + end + if not M.which_key_queue[mode] then + M.which_key_queue[mode] = {} + end + M.which_key_queue[mode][keymap] = keymap_opts + else -- not which-key mapping + vim.keymap.set(mode, keymap, cmd, keymap_opts) + end + end + end + end + if package.loaded["which-key"] then + M.which_key_register() + end end local function del_buffer_autocmd(augroup, bufnr) - local cmds_found, cmds = pcall(vim.api.nvim_get_autocmds, { group = augroup, buffer = bufnr }) - if cmds_found then - vim.tbl_map(function(cmd) - vim.api.nvim_del_autocmd(cmd.id) - end, cmds) - end + local cmds_found, cmds = pcall(vim.api.nvim_get_autocmds, { group = augroup, buffer = bufnr }) + if cmds_found then + vim.tbl_map(function(cmd) + vim.api.nvim_del_autocmd(cmd.id) + end, cmds) + end end local function add_buffer_autocmd(augroup, bufnr, autocmds) - if not vim.tbl_islist(autocmds) then - autocmds = { autocmds } - end - local cmds_found, cmds = pcall(vim.api.nvim_get_autocmds, { group = augroup, buffer = bufnr }) - if not cmds_found or vim.tbl_isempty(cmds) then - vim.api.nvim_create_augroup(augroup, { clear = false }) - for _, autocmd in ipairs(autocmds) do - local events = autocmd.events - autocmd.events = nil - autocmd.group = augroup - autocmd.buffer = bufnr - vim.api.nvim_create_autocmd(events, autocmd) - end - end + if not vim.tbl_islist(autocmds) then + autocmds = { autocmds } + end + local cmds_found, cmds = pcall(vim.api.nvim_get_autocmds, { group = augroup, buffer = bufnr }) + if not cmds_found or vim.tbl_isempty(cmds) then + vim.api.nvim_create_augroup(augroup, { clear = false }) + for _, autocmd in ipairs(autocmds) do + local events = autocmd.events + autocmd.events = nil + autocmd.group = augroup + autocmd.buffer = bufnr + vim.api.nvim_create_autocmd(events, autocmd) + end + end end local function has_capability(capability, filter) - for _, client in ipairs(vim.lsp.get_active_clients(filter)) do - if client.supports_method(capability) then - return true - end - end - return false + for _, client in ipairs(vim.lsp.get_active_clients(filter)) do + if client.supports_method(capability) then + return true + end + end + return false end -- NOTE: LSP Keymaps here -- TODO: Move to config.keymaps function M.lsp_on_attach(client, bufnr) - local lsp_mappings = M.empty_map_table() + local lsp_mappings = M.empty_map_table() - lsp_mappings.n["ld"] = { - function() - vim.diagnostic.open_float() - end, - desc = "Hover diagnostics", - } - lsp_mappings.n["[d"] = { - function() - vim.diagnostic.goto_prev() - end, - desc = "Previous diagnostic", - } - lsp_mappings.n["]d"] = { - function() - vim.diagnostic.goto_next() - end, - desc = "Next diagnostic", - } - lsp_mappings.n["gl"] = { - function() - vim.diagnostic.open_float() - end, - desc = "Hover diagnostics", - } + lsp_mappings.n["ld"] = { + function() + vim.diagnostic.open_float() + end, + desc = "Hover diagnostics", + } + lsp_mappings.n["[d"] = { + function() + vim.diagnostic.goto_prev() + end, + desc = "Previous diagnostic", + } + lsp_mappings.n["]d"] = { + function() + vim.diagnostic.goto_next() + end, + desc = "Next diagnostic", + } + lsp_mappings.n["gl"] = { + function() + vim.diagnostic.open_float() + end, + desc = "Hover diagnostics", + } - if M.is_available("telescope.nvim") then - lsp_mappings.n["lD"] = { - function() - require("telescope.builtin").diagnostics() - end, - desc = "Search diagnostics", - } - end + if M.is_available("telescope.nvim") then + lsp_mappings.n["lD"] = { + function() + require("telescope.builtin").diagnostics() + end, + desc = "Search diagnostics", + } + end - if M.is_available("mason-lspconfig.nvim") then - lsp_mappings.n["li"] = { "LspInfo", desc = "LSP information" } - end + if M.is_available("mason-lspconfig.nvim") then + lsp_mappings.n["li"] = { "LspInfo", desc = "LSP information" } + end - if M.is_available("none-ls.nvim") then - lsp_mappings.n["lI"] = { "NullLsInfo", desc = "Null-ls information" } - end + if M.is_available("none-ls.nvim") then + lsp_mappings.n["lI"] = { "NullLsInfo", desc = "Null-ls information" } + end - if client.supports_method("textDocument/codeAction") then - lsp_mappings.n["la"] = { - function() - vim.lsp.buf.code_action() - end, - desc = "Code action", - } - lsp_mappings.v["la"] = lsp_mappings.n["la"] - end + if client.supports_method("textDocument/codeAction") then + lsp_mappings.n["la"] = { + function() + vim.lsp.buf.code_action() + end, + desc = "Code action", + } + lsp_mappings.v["la"] = lsp_mappings.n["la"] + end - if client.supports_method("textDocument/codeLens") then - vim.lsp.codelens.refresh() - lsp_mappings.n["ll"] = { - function() - vim.lsp.codelens.refresh() - end, - desc = "Refresh CodeLens", - } - lsp_mappings.n["lL"] = { - function() - vim.lsp.codelens.run() - end, - desc = "Run CodeLens", - } - lsp_mappings.n["u"] = { desc = icons.Gear .. " Utility" } - lsp_mappings.n["uL"] = { - function() - vim.lsp.codelens.clear() - end, - desc = "Toggle CodeLens", - } - end + if client.supports_method("textDocument/codeLens") then + vim.lsp.codelens.refresh() + lsp_mappings.n["ll"] = { + function() + vim.lsp.codelens.refresh() + end, + desc = "Refresh CodeLens", + } + lsp_mappings.n["lL"] = { + function() + vim.lsp.codelens.run() + end, + desc = "Run CodeLens", + } + lsp_mappings.n["u"] = { desc = icons.Gear .. " Utility" } + lsp_mappings.n["uL"] = { + function() + vim.lsp.codelens.clear() + end, + desc = "Toggle CodeLens", + } + end - if client.supports_method("textDocument/definition") then - lsp_mappings.n["gd"] = { - function() - vim.lsp.buf.definition() - end, - desc = "Go to definition", - } - end + if client.supports_method("textDocument/definition") then + lsp_mappings.n["gd"] = { + function() + vim.lsp.buf.definition() + end, + desc = "Go to definition", + } + end - if client.supports_method("textDocument/typeDefinition") then - lsp_mappings.n["gy"] = { - function() - vim.lsp.buf.type_definition() - end, - desc = "Go to type definition", - } - end + if client.supports_method("textDocument/typeDefinition") then + lsp_mappings.n["gy"] = { + function() + vim.lsp.buf.type_definition() + end, + desc = "Go to type definition", + } + end - if client.supports_method("textDocument/declaration") then - lsp_mappings.n["gD"] = { - function() - vim.lsp.buf.declaration() - end, - desc = "Go to declaration", - } - end + if client.supports_method("textDocument/declaration") then + lsp_mappings.n["gD"] = { + function() + vim.lsp.buf.declaration() + end, + desc = "Go to declaration", + } + end - if client.supports_method("textDocument/implementation") then - lsp_mappings.n["gI"] = { - function() - vim.lsp.buf.implementation() - end, - desc = "List implementations", - } - end + if client.supports_method("textDocument/implementation") then + lsp_mappings.n["gI"] = { + function() + vim.lsp.buf.implementation() + end, + desc = "List implementations", + } + end - if client.supports_method("textDocument/references") then - lsp_mappings.n["gr"] = { - function() - vim.lsp.buf.references() - end, - desc = "List references", - } - end + if client.supports_method("textDocument/references") then + lsp_mappings.n["gr"] = { + function() + vim.lsp.buf.references() + end, + desc = "List references", + } + end - if client.supports_method("workspace/symbol") then - lsp_mappings.n["lG"] = { - function() - vim.lsp.buf.workspace_symbol() - end, - desc = "List symbols", - } - end + if client.supports_method("workspace/symbol") then + lsp_mappings.n["lG"] = { + function() + vim.lsp.buf.workspace_symbol() + end, + desc = "List symbols", + } + end - if client.supports_method("textDocument/rename") then - lsp_mappings.n["lr"] = { - function() - vim.lsp.buf.rename() - end, - desc = "Rename symbol", - } - end + if client.supports_method("textDocument/rename") then + lsp_mappings.n["lr"] = { + function() + vim.lsp.buf.rename() + end, + desc = "Rename symbol", + } + end - -- TODO: Check this on 0.10.0 release - if client.supports_method("textDocument/semanticTokens/full") and vim.lsp.semantic_tokens then - vim.b[bufnr].semantic_tokens_enabled = true - lsp_mappings.n["u"] = { desc = icons.Gear .. " Utility" } - lsp_mappings.n["uY"] = { - function() - vim.b[bufnr].semantic_tokens_enabled = not vim.b[bufnr].semantic_tokens_enabled - for _, active_client in ipairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do - if active_client.server_capabilities.semanticTokensProvider then - vim.lsp.semantic_tokens[vim.b[bufnr].semantic_tokens_enabled and "start" or "stop"]( - bufnr, - active_client.id - ) - end - end - end, - desc = "Toggle LSP semantic highlight (buffer)", - } - end + -- TODO: Check this on 0.10.0 release + if client.supports_method("textDocument/semanticTokens/full") and vim.lsp.semantic_tokens then + vim.b[bufnr].semantic_tokens_enabled = true + lsp_mappings.n["u"] = { desc = icons.Gear .. " Utility" } + lsp_mappings.n["uY"] = { + function() + vim.b[bufnr].semantic_tokens_enabled = not vim.b[bufnr].semantic_tokens_enabled + for _, active_client in ipairs(vim.lsp.get_active_clients({ bufnr = bufnr })) do + if active_client.server_capabilities.semanticTokensProvider then + vim.lsp.semantic_tokens[vim.b[bufnr].semantic_tokens_enabled and "start" or "stop"]( + bufnr, + active_client.id + ) + end + end + end, + desc = "Toggle LSP semantic highlight (buffer)", + } + end - if client.supports_method("textDocument/formatting") then - lsp_mappings.n["lf"] = { - function() - vim.lsp.buf.format({ - filter = function(c) - 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 c.name == "null-ls" - end - return true - end, - }) - end, - desc = "Format buffer", - } - lsp_mappings.v["lf"] = lsp_mappings.n["lf"] - end + if client.supports_method("textDocument/formatting") then + lsp_mappings.n["lf"] = { + function() + vim.lsp.buf.format({ + filter = function(c) + 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 c.name == "null-ls" + end + return true + end, + }) + end, + desc = "Format buffer", + } + lsp_mappings.v["lf"] = lsp_mappings.n["lf"] + end - if client.supports_method("textDocument/documentHighlight") then - add_buffer_autocmd("lsp_document_highlight", bufnr, { - { - events = { "CursorHold", "CursorHoldI" }, - desc = "highlight references when cursor holds", - callback = function() - if not has_capability("textDocument/documentHighlight", { bufnr = bufnr }) then - del_buffer_autocmd("lsp_document_highlight", bufnr) - return - end - vim.lsp.buf.document_highlight() - end, - }, - { - events = { "CursorMoved", "CursorMovedI", "BufLeave" }, - desc = "clear references when cursor moves", - callback = function() - vim.lsp.buf.clear_references() - end, - }, - }) - end + if client.supports_method("textDocument/documentHighlight") then + add_buffer_autocmd("lsp_document_highlight", bufnr, { + { + events = { "CursorHold", "CursorHoldI" }, + desc = "highlight references when cursor holds", + callback = function() + if not has_capability("textDocument/documentHighlight", { bufnr = bufnr }) then + del_buffer_autocmd("lsp_document_highlight", bufnr) + return + end + vim.lsp.buf.document_highlight() + end, + }, + { + events = { "CursorMoved", "CursorMovedI", "BufLeave" }, + desc = "clear references when cursor moves", + callback = function() + vim.lsp.buf.clear_references() + end, + }, + }) + end - if client.supports_method("textDocument/hover") then - -- TODO: Check this on 0.10.0 release - if vim.fn.has("nvim-0.10") == 0 then - lsp_mappings.n["K"] = { - function() - vim.lsp.buf.hover() - end, - desc = "Hover symbol", - } - end - end + if client.supports_method("textDocument/hover") then + -- TODO: Check this on 0.10.0 release + if vim.fn.has("nvim-0.10") == 0 then + lsp_mappings.n["K"] = { + function() + vim.lsp.buf.hover() + end, + desc = "Hover symbol", + } + end + end - if client.supports_method("textDocument/inlayHint") then - if vim.b.inlay_hints_enabled == nil then - vim.b.inlay_hints_enabled = true - end - -- TODO: Check this on 0.10.0 release - if vim.lsp.inlay_hint then - if vim.b.inlay_hints_enabled then - vim.lsp.inlay_hint.enable(bufnr, true) - end - lsp_mappings.n["u"] = { desc = icons.Gear .. " Utility" } - lsp_mappings.n["uH"] = { - function() - vim.b[bufnr].inlay_hints_enabled = not vim.b[bufnr].inlay_hints_enabled - if vim.lsp.inlay_hint then - vim.lsp.inlay_hint.enable(bufnr, vim.b[bufnr].inlay_hints_enabled) - end - end, - desc = "Toggle inlay hints", - } - end - end + if client.supports_method("textDocument/inlayHint") then + if vim.b.inlay_hints_enabled == nil then + vim.b.inlay_hints_enabled = true + end + -- TODO: Check this on 0.10.0 release + if vim.lsp.inlay_hint then + if vim.b.inlay_hints_enabled then + vim.lsp.inlay_hint.enable(bufnr, true) + end + lsp_mappings.n["u"] = { desc = icons.Gear .. " Utility" } + lsp_mappings.n["uH"] = { + function() + vim.b[bufnr].inlay_hints_enabled = not vim.b[bufnr].inlay_hints_enabled + if vim.lsp.inlay_hint then + vim.lsp.inlay_hint.enable(bufnr, vim.b[bufnr].inlay_hints_enabled) + end + end, + desc = "Toggle inlay hints", + } + end + end - if client.supports_method("textDocument/signatureHelp") then - lsp_mappings.n["lh"] = { - function() - vim.lsp.buf.signature_help() - end, - desc = "Signature help", - } - end + if client.supports_method("textDocument/signatureHelp") then + lsp_mappings.n["lh"] = { + function() + vim.lsp.buf.signature_help() + end, + desc = "Signature help", + } + end - if M.is_available("telescope.nvim") then - if lsp_mappings.n.gd then - lsp_mappings.n.gd[1] = function() - require("telescope.builtin").lsp_definitions() - end - end - if lsp_mappings.n.gI then - lsp_mappings.n.gI[1] = function() - require("telescope.builtin").lsp_implementations() - end - end - if lsp_mappings.n.gr then - lsp_mappings.n.gr[1] = function() - require("telescope.builtin").lsp_references() - end - end - if lsp_mappings.n["lR"] then - lsp_mappings.n["lR"][1] = function() - require("telescope.builtin").lsp_references() - end - end - if lsp_mappings.n.gy then - lsp_mappings.n.gy[1] = function() - require("telescope.builtin").lsp_type_definitions() - end - end - if lsp_mappings.n["lG"] then - lsp_mappings.n["lG"][1] = function() - vim.ui.input({ prompt = "Symbol Query: (leave empty for word under cursor)" }, function(query) - if query then - -- word under cursor if given query is empty - if query == "" then - query = vim.fn.expand("") - end - require("telescope.builtin").lsp_workspace_symbols({ - query = query, - prompt_title = ("Find word (%s)"):format(query), - }) - end - end) - end - end - end + if M.is_available("telescope.nvim") then + if lsp_mappings.n.gd then + lsp_mappings.n.gd[1] = function() + require("telescope.builtin").lsp_definitions() + end + end + if lsp_mappings.n.gI then + lsp_mappings.n.gI[1] = function() + require("telescope.builtin").lsp_implementations() + end + end + if lsp_mappings.n.gr then + lsp_mappings.n.gr[1] = function() + require("telescope.builtin").lsp_references() + end + end + if lsp_mappings.n["lR"] then + lsp_mappings.n["lR"][1] = function() + require("telescope.builtin").lsp_references() + end + end + if lsp_mappings.n.gy then + lsp_mappings.n.gy[1] = function() + require("telescope.builtin").lsp_type_definitions() + end + end + if lsp_mappings.n["lG"] then + lsp_mappings.n["lG"][1] = function() + vim.ui.input({ prompt = "Symbol Query: (leave empty for word under cursor)" }, function(query) + if query then + -- word under cursor if given query is empty + if query == "" then + query = vim.fn.expand("") + end + require("telescope.builtin").lsp_workspace_symbols({ + query = query, + prompt_title = ("Find word (%s)"):format(query), + }) + end + end) + end + end + end - if not vim.tbl_isempty(lsp_mappings.v) then - if lsp_mappings.v["l"] then - lsp_mappings.v["l"] = { desc = icons.Code .. " LSP" } - end - if lsp_mappings.v["u"] then - lsp_mappings.v["u"] = { desc = icons.Code .. " LSP" } - end - end + if not vim.tbl_isempty(lsp_mappings.v) then + if lsp_mappings.v["l"] then + lsp_mappings.v["l"] = { desc = icons.Code .. " LSP" } + end + if lsp_mappings.v["u"] then + lsp_mappings.v["u"] = { desc = icons.Code .. " LSP" } + end + end - M.set_maps(lsp_mappings, { buffer = bufnr }) + M.set_maps(lsp_mappings, { buffer = bufnr }) end function M.has_value(table, value) - for _, v in ipairs(table) do - if v == value then - return true - end - end - return false + for _, v in ipairs(table) do + if v == value then + return true + end + end + return false end function M.get_gwd(path) diff --git a/.config/nvim/lua/lazy-init.lua b/.config/nvim/lua/lazy-init.lua index 993a32db..d083a9be 100644 --- a/.config/nvim/lua/lazy-init.lua +++ b/.config/nvim/lua/lazy-init.lua @@ -1,13 +1,13 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup("plugins", require("plugins.lazy").opts) diff --git a/.config/nvim/lua/plugins/cmp/cmp.lua b/.config/nvim/lua/plugins/cmp/cmp.lua index 34822bc6..523e1a1a 100644 --- a/.config/nvim/lua/plugins/cmp/cmp.lua +++ b/.config/nvim/lua/plugins/cmp/cmp.lua @@ -1,111 +1,111 @@ local M = { "hrsh7th/nvim-cmp" } M.dependencies = { - "saadparwaiz1/cmp_luasnip", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-nvim-lsp", + "saadparwaiz1/cmp_luasnip", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-nvim-lsp", } M.event = "InsertEnter" M.opts = function() - local cmp = require("cmp") - local snip_status_ok, luasnip = pcall(require, "luasnip") - local lspkind_status_ok, lspkind = pcall(require, "lspkind") - if not snip_status_ok then - return - end + local cmp = require("cmp") + local snip_status_ok, luasnip = pcall(require, "luasnip") + local lspkind_status_ok, lspkind = pcall(require, "lspkind") + if not snip_status_ok then + return + end - local border_opts = { - border = "rounded", - winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", - } + local border_opts = { + border = "rounded", + winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", + } - local function has_words_before() - local line, col = (unpack or table.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 function has_words_before() + local line, col = (unpack or table.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 - return { - enabled = function() - local dap_prompt = require("funcs").is_available("cmp-dap") - and vim.tbl_contains( - { "dap-repl", "dapui_watches", "dapui_hover" }, - vim.api.nvim_get_option_value("filetype", { buf = 0 }) - ) - if vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt" and not dap_prompt then - return false - end - return true - end, - preselect = cmp.PreselectMode.None, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = lspkind_status_ok and lspkind.cmp_format(require("plugins.misc.lspkind").opts) or nil, - }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - duplicates = { - nvim_lsp = 1, - luasnip = 1, - cmp_tabnine = 1, - buffer = 1, - path = 1, - }, - confirm_opts = { - behavior = cmp.ConfirmBehavior.Replace, - select = false, - }, - window = { - completion = cmp.config.window.bordered(border_opts), - documentation = cmp.config.window.bordered(border_opts), - }, + return { + enabled = function() + local dap_prompt = require("funcs").is_available("cmp-dap") + and vim.tbl_contains( + { "dap-repl", "dapui_watches", "dapui_hover" }, + vim.api.nvim_get_option_value("filetype", { buf = 0 }) + ) + if vim.api.nvim_get_option_value("buftype", { buf = 0 }) == "prompt" and not dap_prompt then + return false + end + return true + end, + preselect = cmp.PreselectMode.None, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = lspkind_status_ok and lspkind.cmp_format(require("plugins.misc.lspkind").opts) or nil, + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + duplicates = { + nvim_lsp = 1, + luasnip = 1, + cmp_tabnine = 1, + buffer = 1, + path = 1, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + window = { + completion = cmp.config.window.bordered(border_opts), + documentation = cmp.config.window.bordered(border_opts), + }, -- TODO: Move to config.keymaps - mapping = { - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.config.disable, - [""] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }), - [""] = cmp.mapping.confirm({ select = false }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_locally_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 = cmp.config.sources({ - { name = "nvim_lsp", priority = 1000 }, - { name = "luasnip", priority = 750 }, - { name = "buffer", priority = 500 }, - { name = "path", priority = 250 }, - }), - } + mapping = { + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.config.disable, + [""] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }), + [""] = cmp.mapping.confirm({ select = false }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_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 = cmp.config.sources({ + { name = "nvim_lsp", priority = 1000 }, + { name = "luasnip", priority = 750 }, + { name = "buffer", priority = 500 }, + { name = "path", priority = 250 }, + }), + } end return M diff --git a/.config/nvim/lua/plugins/cmp/dap.lua b/.config/nvim/lua/plugins/cmp/dap.lua index a0347f38..477e6522 100644 --- a/.config/nvim/lua/plugins/cmp/dap.lua +++ b/.config/nvim/lua/plugins/cmp/dap.lua @@ -2,11 +2,11 @@ local M = { "rcarriga/cmp-dap" } M.dependencies = { "nvim-cmp" } M.config = function() - require("cmp").setup.filetype({ "dap-repl", "dapui_watches", "dapui_hover" }, { - sources = { - { name = "dap" }, - }, - }) + require("cmp").setup.filetype({ "dap-repl", "dapui_watches", "dapui_hover" }, { + sources = { + { name = "dap" }, + }, + }) end return M diff --git a/.config/nvim/lua/plugins/cmp/init.lua b/.config/nvim/lua/plugins/cmp/init.lua index 5ad1ef43..7a3f456d 100644 --- a/.config/nvim/lua/plugins/cmp/init.lua +++ b/.config/nvim/lua/plugins/cmp/init.lua @@ -1,5 +1,5 @@ return { - require("plugins.cmp.cmp"), - require("plugins.cmp.dap"), - require("plugins.cmp.luasnip"), + require("plugins.cmp.cmp"), + require("plugins.cmp.dap"), + require("plugins.cmp.luasnip"), } diff --git a/.config/nvim/lua/plugins/cmp/luasnip.lua b/.config/nvim/lua/plugins/cmp/luasnip.lua index e7c56009..9ab255a6 100644 --- a/.config/nvim/lua/plugins/cmp/luasnip.lua +++ b/.config/nvim/lua/plugins/cmp/luasnip.lua @@ -7,16 +7,16 @@ M.build = "make install_jsregexp" M.dependencies = { "rafamadriz/friendly-snippets" } M.opts = { - history = true, - delete_check_events = "TextChanged", - region_check_events = "CursorMoved", + history = true, + delete_check_events = "TextChanged", + region_check_events = "CursorMoved", } M.config = function(_, opts) - require("luasnip").config.setup(opts) - vim.tbl_map(function(type) - require("luasnip.loaders.from_" .. type).lazy_load() - end, { "vscode", "snipmate", "lua" }) + require("luasnip").config.setup(opts) + vim.tbl_map(function(type) + require("luasnip.loaders.from_" .. type).lazy_load() + end, { "vscode", "snipmate", "lua" }) end return M diff --git a/.config/nvim/lua/plugins/dap/dap-ui.lua b/.config/nvim/lua/plugins/dap/dap-ui.lua index dea56bc2..d54a4129 100644 --- a/.config/nvim/lua/plugins/dap/dap-ui.lua +++ b/.config/nvim/lua/plugins/dap/dap-ui.lua @@ -3,21 +3,21 @@ local M = { "rcarriga/nvim-dap-ui" } M.dependencies = { "mason-nvim-dap.nvim" } M.opts = { - floating = { border = "rounded" }, + floating = { border = "rounded" }, } M.config = function(_, opts) - local dap, dapui = require("dap"), require("dapui") - dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() - end - dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() - end - dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() - end - dapui.setup(opts) + local dap, dapui = require("dap"), require("dapui") + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + dap.listeners.before.event_terminated["dapui_config"] = function() + dapui.close() + end + dap.listeners.before.event_exited["dapui_config"] = function() + dapui.close() + end + dapui.setup(opts) end return M diff --git a/.config/nvim/lua/plugins/lazy.lua b/.config/nvim/lua/plugins/lazy.lua index 3380091c..08086b33 100644 --- a/.config/nvim/lua/plugins/lazy.lua +++ b/.config/nvim/lua/plugins/lazy.lua @@ -2,33 +2,33 @@ local M = { "folke/lazy.nvim" } local icons = require("config.icons") M.opts = { - dev = { - path = (os.getenv("XDG_DOCUMENTS_DIR") or "~/Documents") .. "/dev/nvim", - }, - install = { - missing = true, - colorscheme = { "tokyonight" }, - }, - ui = { - border = "single", - icons = { - cmd = icons.Console .. " ", - config = icons.Gear, - event = icons.Event, - ft = icons.File .. " ", - init = icons.Gear .. " ", - import = icons.Import .. " ", - keys = icons.Keyboard .. " ", - lazy = icons.Sleep .. " ", - loaded = icons.Loaded, - not_loaded = icons.Unloaded, - plugin = icons.Package, - runtime = icons.Runtime .. " ", - source = icons.Source .. " ", - start = icons.Start, - task = icons.Task, - }, - }, + dev = { + path = (os.getenv("XDG_DOCUMENTS_DIR") or "~/Documents") .. "/dev/nvim", + }, + install = { + missing = true, + colorscheme = { "tokyonight" }, + }, + ui = { + border = "single", + icons = { + cmd = icons.Console .. " ", + config = icons.Gear, + event = icons.Event, + ft = icons.File .. " ", + init = icons.Gear .. " ", + import = icons.Import .. " ", + keys = icons.Keyboard .. " ", + lazy = icons.Sleep .. " ", + loaded = icons.Loaded, + not_loaded = icons.Unloaded, + plugin = icons.Package, + runtime = icons.Runtime .. " ", + source = icons.Source .. " ", + start = icons.Start, + task = icons.Task, + }, + }, } return M diff --git a/.config/nvim/lua/plugins/lsp/aerial.lua b/.config/nvim/lua/plugins/lsp/aerial.lua index a0ad3f1f..54a04e20 100644 --- a/.config/nvim/lua/plugins/lsp/aerial.lua +++ b/.config/nvim/lua/plugins/lsp/aerial.lua @@ -3,20 +3,20 @@ local M = { "stevearc/aerial.nvim" } M.event = { "BufReadPost", "BufNewFile", "BufNew" } M.opts = { - attach_mode = "global", - backends = { "lsp", "treesitter", "markdown", "man" }, - disable_max_lines = vim.g.max_lines, - disable_max_size = vim.g.max_size, - layout = { min_width = 28 }, - show_guides = true, - filter_kind = false, - guides = { - mid_item = "├ ", - last_item = "└ ", - nested_top = "│ ", - whitespace = " ", - }, - keymaps = require("config.keymaps").aerial, + attach_mode = "global", + backends = { "lsp", "treesitter", "markdown", "man" }, + disable_max_lines = vim.g.max_lines, + disable_max_size = vim.g.max_size, + layout = { min_width = 28 }, + show_guides = true, + filter_kind = false, + guides = { + mid_item = "├ ", + last_item = "└ ", + nested_top = "│ ", + whitespace = " ", + }, + keymaps = require("config.keymaps").aerial, } return M diff --git a/.config/nvim/lua/plugins/lsp/init.lua b/.config/nvim/lua/plugins/lsp/init.lua index 692c60a4..da80ace5 100644 --- a/.config/nvim/lua/plugins/lsp/init.lua +++ b/.config/nvim/lua/plugins/lsp/init.lua @@ -1,9 +1,9 @@ return { - { "neovim/nvim-lspconfig" }, - { "folke/neoconf.nvim", config = true }, - { "folke/neodev.nvim", config = true }, - require("plugins.lsp.mason-lspconfig"), - require("plugins.lsp.mason-null-ls"), - require("plugins.lsp.null-ls"), - require("plugins.lsp.aerial"), + { "neovim/nvim-lspconfig" }, + { "folke/neoconf.nvim", config = true }, + { "folke/neodev.nvim", config = true }, + require("plugins.lsp.mason-lspconfig"), + require("plugins.lsp.mason-null-ls"), + require("plugins.lsp.null-ls"), + require("plugins.lsp.aerial"), } diff --git a/.config/nvim/lua/plugins/lsp/mason-lspconfig.lua b/.config/nvim/lua/plugins/lsp/mason-lspconfig.lua index 91e5569c..856a3ab8 100644 --- a/.config/nvim/lua/plugins/lsp/mason-lspconfig.lua +++ b/.config/nvim/lua/plugins/lsp/mason-lspconfig.lua @@ -12,13 +12,13 @@ capabilities.textDocument.completion.completionItem.deprecatedSupport = true capabilities.textDocument.completion.completionItem.commitCharactersSupport = true capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } capabilities.textDocument.completion.completionItem.resolveSupport = { - properties = { "documentation", "detail", "additionalTextEdits" }, + properties = { "documentation", "detail", "additionalTextEdits" }, } capabilities.textDocument.foldingRange = { dynamicRegistration = false, lineFoldingOnly = true } local function merge(table, overwrite) - overwrite = overwrite or {} - return table and vim.tbl_deep_extend("force", table, overwrite) or overwrite + overwrite = overwrite or {} + return table and vim.tbl_deep_extend("force", table, overwrite) or overwrite end M.dependencies = { "mason.nvim", "neoconf.nvim", "neodev.nvim" } @@ -28,63 +28,63 @@ M.event = { "BufReadPost", "BufNewFile", "BufNew" } M.cmd = { "LspInstall", "LspUninstall" } M.config = function() - local icons = require("config.icons") - local signs = { - { name = "DiagnosticSignError", text = icons.Error, texthl = "DiagnosticSignError" }, - { name = "DiagnosticSignWarn", text = icons.Warn, texthl = "DiagnosticSignWarn" }, - { name = "DiagnosticSignHint", text = icons.Hint, texthl = "DiagnosticSignHint" }, - { name = "DiagnosticSignInfo", text = icons.Info, texthl = "DiagnosticSignInfo" }, - { name = "DapStopped", text = icons.DapStopped, texthl = "DiagnosticWarn" }, - { name = "DapBreakpoint", text = icons.DapBreakpoint, texthl = "DiagnosticInfo" }, - { name = "DapBreakpointRejected", text = icons.DapBreakpointRejected, texthl = "DiagnosticError" }, - { name = "DapBreakpointCondition", text = icons.DapBreakpointCondition, texthl = "DiagnosticInfo" }, - { name = "DapLogPoint", text = icons.DapLogPoint, texthl = "DiagnosticInfo" }, - } - for _, sign in ipairs(signs) do - vim.fn.sign_define(sign.name, sign) - end + local icons = require("config.icons") + local signs = { + { name = "DiagnosticSignError", text = icons.Error, texthl = "DiagnosticSignError" }, + { name = "DiagnosticSignWarn", text = icons.Warn, texthl = "DiagnosticSignWarn" }, + { name = "DiagnosticSignHint", text = icons.Hint, texthl = "DiagnosticSignHint" }, + { name = "DiagnosticSignInfo", text = icons.Info, texthl = "DiagnosticSignInfo" }, + { name = "DapStopped", text = icons.DapStopped, texthl = "DiagnosticWarn" }, + { name = "DapBreakpoint", text = icons.DapBreakpoint, texthl = "DiagnosticInfo" }, + { name = "DapBreakpointRejected", text = icons.DapBreakpointRejected, texthl = "DiagnosticError" }, + { name = "DapBreakpointCondition", text = icons.DapBreakpointCondition, texthl = "DiagnosticInfo" }, + { name = "DapLogPoint", text = icons.DapLogPoint, texthl = "DiagnosticInfo" }, + } + for _, sign in ipairs(signs) do + vim.fn.sign_define(sign.name, sign) + end - vim.diagnostic.config({ - virtual_text = true, - signs = { - text = { - [vim.diagnostic.severity.ERROR] = icons.Error, - [vim.diagnostic.severity.HINT] = icons.Hint, - [vim.diagnostic.severity.WARN] = icons.Warn, - [vim.diagnostic.severity.INFO] = icons.Info, - }, - active = signs, - }, - update_in_insert = true, - underline = true, - severity_sort = true, - float = { - focused = false, - style = "minimal", - border = "rounded", - source = "always", - header = "", - prefix = "", - }, - }) + vim.diagnostic.config({ + virtual_text = true, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = icons.Error, + [vim.diagnostic.severity.HINT] = icons.Hint, + [vim.diagnostic.severity.WARN] = icons.Warn, + [vim.diagnostic.severity.INFO] = icons.Info, + }, + active = signs, + }, + update_in_insert = true, + underline = true, + severity_sort = true, + float = { + focused = false, + style = "minimal", + border = "rounded", + source = "always", + header = "", + prefix = "", + }, + }) - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded", silent = true }) - vim.lsp.handlers["textDocument/signatureHelp"] = - vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded", silent = true }) + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded", silent = true }) + vim.lsp.handlers["textDocument/signatureHelp"] = + vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded", silent = true }) - local mlsp = require("mason-lspconfig") - mlsp.setup({ ensure_installed = serverconf.required }) + local mlsp = require("mason-lspconfig") + mlsp.setup({ ensure_installed = serverconf.required }) - mlsp.setup_handlers({ - function(server) - if not f.has_value(serverconf.ignore, server) then - local ls = require("lspconfig")[server] - local ls_opts = merge(ls, { capabilities = capabilities, on_attach = require("funcs").lsp_on_attach }) - local opts = merge(ls_opts, serverconf.handlers[server]) - require("lspconfig")[server].setup(opts) - end - end, - }) + mlsp.setup_handlers({ + function(server) + if not f.has_value(serverconf.ignore, server) then + local ls = require("lspconfig")[server] + local ls_opts = merge(ls, { capabilities = capabilities, on_attach = require("funcs").lsp_on_attach }) + local opts = merge(ls_opts, serverconf.handlers[server]) + require("lspconfig")[server].setup(opts) + end + end, + }) end return M diff --git a/.config/nvim/lua/plugins/lsp/null-ls.lua b/.config/nvim/lua/plugins/lsp/null-ls.lua index ac0f073f..a9bacc7a 100644 --- a/.config/nvim/lua/plugins/lsp/null-ls.lua +++ b/.config/nvim/lua/plugins/lsp/null-ls.lua @@ -5,7 +5,7 @@ M.event = { "BufReadPost", "BufNewFile", "BufNew" } M.dependencies = { "mason-null-ls.nvim" } M.opts = { - on_attach = require("funcs").lsp_on_attach, + on_attach = require("funcs").lsp_on_attach, } return M diff --git a/.config/nvim/lua/plugins/misc/alpha.lua b/.config/nvim/lua/plugins/misc/alpha.lua index 9c575b27..c15a72a4 100644 --- a/.config/nvim/lua/plugins/misc/alpha.lua +++ b/.config/nvim/lua/plugins/misc/alpha.lua @@ -3,163 +3,163 @@ local M = { "goolord/alpha-nvim" } M.dependencies = { "telescope.nvim", "todo-comments.nvim" } M.opts = function() - local icons = require("config.icons") - local dashboard = require("alpha.themes.dashboard") + local icons = require("config.icons") + local dashboard = require("alpha.themes.dashboard") - dashboard.section.header.opts.hl = "DashboardHeader" - dashboard.section.footer.opts.hl = "DashboardFooter" + dashboard.section.header.opts.hl = "DashboardHeader" + dashboard.section.footer.opts.hl = "DashboardFooter" - local banners = { - [1] = { - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀", - "⠀⣀⣴⣶⣶⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀", - "⣰⣿⣿⠿⠛⠿⢿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀", - "⣿⣿⡇⠀⠀⠀⠀⠈⠛⢿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀", - "⠹⣿⣧⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⠀⢀⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀", - "⠀⠙⢿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⣤⣶⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠉⠻⠷⡄⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⢀⣠⣤⣤⣄⡀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣷⡀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⡀⠀⠀⠀⠀⣿⠟⠉⠉⠙⢿⣿⣿⣷", - "⠀⠀⠀⣀⣠⣤⣤⣤⣶⣶⣶⣤⣤⠀⣴⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠉⠀⠀⠀⢀⣼⣿⣿⡿", - "⠀⠀⠀⠈⠉⠉⠉⠉⠉⠉⠛⠻⠏⣼⣿⣿⡿⣋⣀⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣀⣠⣴⣾⣿⣿⡿⠁", - "⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡿⠋⠘⠿⠟⠛⠛⢻⣿⣿⣿⠋⠁⠈⠉⢿⣿⣿⣧⠀⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠉⠀⠀", - "⠙⣷⣤⣀⠀⠀⠀⢀⣀⣤⣶⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡟⠀⠀⠀⢠⣿⣿⣿⡟⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀", - "⠀⠈⠛⠿⢿⣿⣿⣿⠿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⡀⠀⢠⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣷⣶⣶⣶⣶⣦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢶⣦⣤⣶⣾⣿⣿⡶⠈⠉⠛⠿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣶⡿⠿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - }, - [2] = { - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢒⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢘⡈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢣⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡌⡦⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡐⣸⠂⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠸⡢⡀⠀⠀⠀⠀⠀⠔⣰⠏⡌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⢖⡠⣨⠊⠒⠠⣀⢀⠊⣠⠃⡰⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠠⠀⠀⠠⠠⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⢰⠑⠚⠀⠀⠀⡉⠀⢇⡰⠀⠀⠀⠀⠀⢀⠠⠐⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠐⠤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠈⡄⠀⠀⠀⠀⠘⠠⠐⡇⠀⠀⠀⠠⠐⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⢃⠀⠀⠀⠀⠀⠀⢀⠁⠀⢀⠌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠀⠀⠼⢄⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⢸⠀⢠⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠎⠀⠀⠀⠀⠀⠈⠢⠄⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠸⠀⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠎⠀⠀⠀⠀⠀⠀⡠⠀⠈⢆⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠨⠀⠀⠀⠀⠀⠀⠀⢆⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠀⠀⠀⠀⡌⠀⠀⢎⠨⡄⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⡂⠀⠀⠀⠀⠀⠀⠈⢎⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠸⠀⠀⢸⠸⢀⠇⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠡⢕⠠⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⠀⠀⠀⠀⢐⠀⠀⠈⠢⠥⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⡉⠒⠠⣀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠰⡀⠀⠀⡰⠁⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⠠⢄⠈⠑⠒⠤⡀⠀⢐⠅⠀⠀⠀⠀⠀⠀⠀⡁⡂⠉⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠂⠤⢀⠓⠈⠢⢀⢀⠠⠤⠐⠀⡉⠌⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠰⠐⠪⠤⢀⢀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠢⠄⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠂⠒⡠⠄", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠂⠐⠐⠐⠂⠂⠠⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠄⠐⠂⠂⠀⠉⠀⠀⠀", - }, - [3] = { - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣴⣶⣶⣾⣿⣿⣿⣿⣿⣷⣶⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣿⣿⣿⣿⣿⣿⠿⠟⠛⠉⠉⠉⠉⠉⢉⣭⡉⠉⠛⠻⠿⣿⣿⣿⣿⣿⣿⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣦⡀⠀⠀⠀⠉⠛⢿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀", - "⠀⠀⠀⢀⣴⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣦⡀⠀⠀⠀", - "⠀⠀⢀⣾⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣦⡀⠀⠀⠀⠀⠈⢿⣿⣿⣿⣷⡀⠀⠀", - "⠀⠀⣾⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡦⠀⠀⠀⠀⠀⢻⣿⣿⣿⣷⠀⠀", - "⠀⣼⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⠛⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣧⠀", - "⢠⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣿⡄", - "⢸⣿⣿⣿⡇⠀⡀⠀⠀⠀⣠⣾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣦⡀⢸⣿⣿⣿⡇", - "⣿⣿⣿⣿⡇⠀⣿⣦⣤⣾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⢸⣿⣿⣿⣿", - "⣿⣿⣿⣿⠀⠀⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⣿⣿⣿⣿", - "⣿⣿⣿⣿⡇⠀⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⢸⣿⣿⣿⣿", - "⢸⣿⣿⣿⡇⠀⠉⠉⠉⠉⠉⠉⠉⢠⡀⠀⠀⣠⣾⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⢸⣿⣿⣿⡇", - "⠘⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣦⣾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⠃", - "⠀⢻⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⣤⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⡟⠀", - "⠀⠀⢿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⡿⠀⠀", - "⠀⠀⠈⢿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣦⡀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⡿⠁⠀⠀", - "⠀⠀⠀⠈⠻⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⠟⠁⠀⠀⠀", - "⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣷⣤⣀⠀⠀⠀⠀⠀⠿⠿⠿⠿⠿⠿⠦⠀⠀⠀⠀⠀⣀⣤⣾⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⣿⣶⣦⣤⣀⣀⣀⣀⣀⣀⣀⣀⣀⣤⣴⣶⣿⣿⣿⣿⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠻⠿⠿⢿⣿⣿⣿⣿⣿⡿⠿⠿⠟⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - }, - [4] = { - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡠⠤⠤⠤⠤⠤⠤⠤⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠒⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠓⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠳⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⢀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢦⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⢀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢇⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⡾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⡆⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⢸⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡀⠀⠀⠀⠀⠀", - "⠀⠀⠀⣾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⡇⠀⠀⠀⠀⠀", - "⠀⠀⢠⣯⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⠀⠀⠀⠀⠀", - "⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⠿⠟⠁⠀⠀⠀⠀⠀⠀⠘⢿⣿⣿⣿⠀⠀⠀⠀⠀", - "⠀⠀⣸⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣀⡀⠀⠀⢉⣿⣿⠀⠀⠀⠀⠀", - "⠀⠀⣿⣿⣿⣿⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠻⠿⠿⠿⠟⠀⠀⣼⣿⡏⠀⠀⠀⠀⠀", - "⠀⠀⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣤⣀⡀⠀⠀⢀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⢀⣴⣿⣿⡇⠀⠀⠀⠀⠀", - "⠀⠀⠀⠘⣿⣿⣿⣯⡉⠙⠛⠻⠿⢿⣿⣿⣿⣿⣿⣶⣿⣿⣿⣿⣶⣦⣄⣀⡀⠀⠀⠀⣀⣀⣠⣤⣾⣿⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠸⣿⣿⣿⣷⣤⠀⠀⠀⠀⠀⠉⠙⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣿⣶⣀⠀⠀⠀⠀⠀⠈⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠘⢿⣿⣿⣿⣿⣿⣿⣶⣶⣤⣄⠀⢀⠀⠉⢿⣿⣿⣿⣿⣿⣿⣿⣿⠉⠀⠈⠙⠛⠻⠿⠿⠿⠀⢀⣠⣴⣶⣦⡀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣾⣿⣿⣿⣿⣿⣿⣿⣷⡀⢀⠀⠀⠀⠀⠀⠀⡀⢠⣿⠟⠉⠀⠀⠁⣀⡀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣷⣤⣦⣀⣤⣿⣿⣿⡀⠀⢀⣠⣾⣿⣿", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠃", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠛⠻⠿⠿⠿⣿⡿⠿⠿⠿⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀", - }, - } + local banners = { + [1] = { + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣷⣶⣤⡀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀", + "⠀⣀⣴⣶⣶⣶⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⠀⠀⠀", + "⣰⣿⣿⠿⠛⠿⢿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀", + "⣿⣿⡇⠀⠀⠀⠀⠈⠛⢿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀", + "⠹⣿⣧⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣦⣄⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⡿⠛⠉⠀⢀⣿⣿⣿⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀", + "⠀⠙⢿⣧⡀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⣤⣶⣿⣿⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠉⠻⠷⡄⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⢀⣠⣤⣤⣄⡀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠋⠁⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣷⡀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⡀⠀⠀⠀⠀⣿⠟⠉⠉⠙⢿⣿⣿⣷", + "⠀⠀⠀⣀⣠⣤⣤⣤⣶⣶⣶⣤⣤⠀⣴⣿⣿⣿⡿⠟⠛⠛⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠉⠀⠀⠀⢀⣼⣿⣿⡿", + "⠀⠀⠀⠈⠉⠉⠉⠉⠉⠉⠛⠻⠏⣼⣿⣿⡿⣋⣀⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣄⣀⣠⣴⣾⣿⣿⡿⠁", + "⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⡿⠋⠘⠿⠟⠛⠛⢻⣿⣿⣿⠋⠁⠈⠉⢿⣿⣿⣧⠀⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠉⠀⠀", + "⠙⣷⣤⣀⠀⠀⠀⢀⣀⣤⣶⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⡟⠀⠀⠀⢠⣿⣿⣿⡟⠀⠀⠀⠀⠀⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀", + "⠀⠈⠛⠿⢿⣿⣿⣿⠿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⡀⠀⢠⣿⣿⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣷⣶⣶⣶⣶⣦⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣙⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠐⢶⣦⣤⣶⣾⣿⣿⡶⠈⠉⠛⠿⣿⣿⣿⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣤⣶⡿⠿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + }, + [2] = { + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢒⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢘⡈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⢣⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡌⡦⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡐⣸⠂⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠸⡢⡀⠀⠀⠀⠀⠀⠔⣰⠏⡌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⢖⡠⣨⠊⠒⠠⣀⢀⠊⣠⠃⡰⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠠⠀⠀⠠⠠⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⢰⠑⠚⠀⠀⠀⡉⠀⢇⡰⠀⠀⠀⠀⠀⢀⠠⠐⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠐⠤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠈⡄⠀⠀⠀⠀⠘⠠⠐⡇⠀⠀⠀⠠⠐⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⢃⠀⠀⠀⠀⠀⠀⢀⠁⠀⢀⠌⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠀⠀⠼⢄⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⢸⠀⢠⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠎⠀⠀⠀⠀⠀⠈⠢⠄⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠸⠀⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠎⠀⠀⠀⠀⠀⠀⡠⠀⠈⢆⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠨⠀⠀⠀⠀⠀⠀⠀⢆⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⠀⠀⠀⠀⠀⠀⡌⠀⠀⢎⠨⡄⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⡂⠀⠀⠀⠀⠀⠀⠈⢎⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠇⠀⠀⠀⠀⠀⠸⠀⠀⢸⠸⢀⠇⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠡⢕⠠⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⠀⠀⠀⠀⢐⠀⠀⠈⠢⠥⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⢱⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⡉⠒⠠⣀⠀⠀⠀⠀⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠰⡀⠀⠀⡰⠁⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⠠⢄⠈⠑⠒⠤⡀⠀⢐⠅⠀⠀⠀⠀⠀⠀⠀⡁⡂⠉⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠂⠤⢀⠓⠈⠢⢀⢀⠠⠤⠐⠀⡉⠌⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠰⠐⠪⠤⢀⢀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠢⠄⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠂⠒⡠⠄", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠂⠐⠐⠐⠂⠂⠠⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠄⠐⠂⠂⠀⠉⠀⠀⠀", + }, + [3] = { + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣴⣶⣶⣾⣿⣿⣿⣿⣿⣷⣶⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣶⣿⣿⣿⣿⣿⣿⠿⠟⠛⠉⠉⠉⠉⠉⢉⣭⡉⠉⠛⠻⠿⣿⣿⣿⣿⣿⣿⣶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣦⡀⠀⠀⠀⠉⠛⢿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠈⠻⢿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀", + "⠀⠀⠀⢀⣴⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣿⣿⣦⡀⠀⠀⠀", + "⠀⠀⢀⣾⣿⣿⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣦⡀⠀⠀⠀⠀⠈⢿⣿⣿⣿⣷⡀⠀⠀", + "⠀⠀⣾⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡦⠀⠀⠀⠀⠀⢻⣿⣿⣿⣷⠀⠀", + "⠀⣼⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⠛⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣧⠀", + "⢠⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣿⣿⣿⡄", + "⢸⣿⣿⣿⡇⠀⡀⠀⠀⠀⣠⣾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣦⡀⢸⣿⣿⣿⡇", + "⣿⣿⣿⣿⡇⠀⣿⣦⣤⣾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⢸⣿⣿⣿⣿", + "⣿⣿⣿⣿⠀⠀⣿⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⣿⣿⣿⣿", + "⣿⣿⣿⣿⡇⠀⣿⣿⣿⣿⣿⣧⡀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⠋⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⢸⣿⣿⣿⣿", + "⢸⣿⣿⣿⡇⠀⠉⠉⠉⠉⠉⠉⠉⢠⡀⠀⠀⣠⣾⣿⣿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⢸⣿⣿⣿⡇", + "⠘⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣦⣾⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⠃", + "⠀⢻⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⣤⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⡟⠀", + "⠀⠀⢿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⡿⠀⠀", + "⠀⠀⠈⢿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣦⡀⠀⣠⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⡿⠁⠀⠀", + "⠀⠀⠀⠈⠻⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⠟⠁⠀⠀⠀", + "⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣾⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣷⣤⣀⠀⠀⠀⠀⠀⠿⠿⠿⠿⠿⠿⠦⠀⠀⠀⠀⠀⣀⣤⣾⣿⣿⣿⣿⡿⠋⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⣿⣿⣿⣶⣦⣤⣀⣀⣀⣀⣀⣀⣀⣀⣀⣤⣴⣶⣿⣿⣿⣿⣿⣿⠿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠻⠿⠿⢿⣿⣿⣿⣿⣿⡿⠿⠿⠟⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + }, + [4] = { + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡠⠤⠤⠤⠤⠤⠤⠤⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠤⠒⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡤⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠓⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠳⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⢀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢦⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⢀⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢇⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⡾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⡆⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⢸⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡀⠀⠀⠀⠀⠀", + "⠀⠀⠀⣾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⡇⠀⠀⠀⠀⠀", + "⠀⠀⢠⣯⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠰⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⠀⠀⠀⠀⠀", + "⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⠿⠟⠁⠀⠀⠀⠀⠀⠀⠘⢿⣿⣿⣿⠀⠀⠀⠀⠀", + "⠀⠀⣸⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⣀⣀⣀⡀⠀⠀⢉⣿⣿⠀⠀⠀⠀⠀", + "⠀⠀⣿⣿⣿⣿⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠻⠿⠿⠿⠟⠀⠀⣼⣿⡏⠀⠀⠀⠀⠀", + "⠀⠀⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣤⣀⡀⠀⠀⢀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⢀⣴⣿⣿⡇⠀⠀⠀⠀⠀", + "⠀⠀⠀⠘⣿⣿⣿⣯⡉⠙⠛⠻⠿⢿⣿⣿⣿⣿⣿⣶⣿⣿⣿⣿⣶⣦⣄⣀⡀⠀⠀⠀⣀⣀⣠⣤⣾⣿⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠸⣿⣿⣿⣷⣤⠀⠀⠀⠀⠀⠉⠙⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣿⣶⣀⠀⠀⠀⠀⠀⠈⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠘⢿⣿⣿⣿⣿⣿⣿⣶⣶⣤⣄⠀⢀⠀⠉⢿⣿⣿⣿⣿⣿⣿⣿⣿⠉⠀⠈⠙⠛⠻⠿⠿⠿⠀⢀⣠⣴⣶⣦⡀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣾⣿⣿⣿⣿⣿⣿⣿⣷⡀⢀⠀⠀⠀⠀⠀⠀⡀⢠⣿⠟⠉⠀⠀⠁⣀⡀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣷⣤⣦⣀⣤⣿⣿⣿⡀⠀⢀⣠⣾⣿⣿", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠃", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠛⠻⠿⠿⠿⣿⡿⠿⠿⠿⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠉⠀⠀⠀", + }, + } - dashboard.section.header.val = banners[1] + dashboard.section.header.val = banners[1] - dashboard.section.buttons.val = { - dashboard.button("n", icons.File .. " New file", "ene"), - dashboard.button("f", icons.Search .. " Find file", "lua require('telescope.builtin').find_files()"), - dashboard.button( - "e", - icons.FileTree .. " Browse files", - "lua require('taolf').start({ dir = 'gwd' })" - ), - dashboard.button( - "t", - icons.Task .. " Find todo", - ":lua require('telescope').extensions['todo-comments'].todo()" - ), - dashboard.button("q", icons.Leave .. " Quit", "qa"), - } + dashboard.section.buttons.val = { + dashboard.button("n", icons.File .. " New file", "ene"), + dashboard.button("f", icons.Search .. " Find file", "lua require('telescope.builtin').find_files()"), + dashboard.button( + "e", + icons.FileTree .. " Browse files", + "lua require('taolf').start({ dir = 'gwd' })" + ), + dashboard.button( + "t", + icons.Task .. " Find todo", + ":lua require('telescope').extensions['todo-comments'].todo()" + ), + dashboard.button("q", icons.Leave .. " Quit", "qa"), + } - dashboard.section.footer.val = "Behold: a Snail's Vim" + dashboard.section.footer.val = "Behold: a Snail's Vim" - dashboard.config.layout = { - { type = "padding", val = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }) }, - dashboard.section.header, - { type = "padding", val = 5 }, - dashboard.section.buttons, - { type = "padding", val = 3 }, - dashboard.section.footer, - } + dashboard.config.layout = { + { type = "padding", val = vim.fn.max({ 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }) }, + dashboard.section.header, + { type = "padding", val = 5 }, + dashboard.section.buttons, + { type = "padding", val = 3 }, + dashboard.section.footer, + } - dashboard.config.opts.noautocmd = true + dashboard.config.opts.noautocmd = true - return dashboard + return dashboard end M.config = function(_, opts) - require("alpha").setup(opts.config) + require("alpha").setup(opts.config) - vim.api.nvim_create_autocmd("User", { - pattern = "LazyVimStarted", - desc = "Add Alpha dashboard footer", - once = true, - callback = function() - local stats = require("lazy").stats() - local ms = math.floor(stats.startuptime * 100 + 0.5) / 100 - opts.section.footer.val = { "Behold: a Snail's Vim | " .. stats.count .. "  " .. ms .. "ms" } - pcall(vim.cmd.AlphaRedraw) - end, - }) + vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimStarted", + desc = "Add Alpha dashboard footer", + once = true, + callback = function() + local stats = require("lazy").stats() + local ms = math.floor(stats.startuptime * 100 + 0.5) / 100 + opts.section.footer.val = { "Behold: a Snail's Vim | " .. stats.count .. "  " .. ms .. "ms" } + pcall(vim.cmd.AlphaRedraw) + end, + }) end return M diff --git a/.config/nvim/lua/plugins/misc/autopairs.lua b/.config/nvim/lua/plugins/misc/autopairs.lua index 5b658d8f..f7291120 100644 --- a/.config/nvim/lua/plugins/misc/autopairs.lua +++ b/.config/nvim/lua/plugins/misc/autopairs.lua @@ -3,13 +3,13 @@ local M = { "windwp/nvim-autopairs" } M.event = { "BufReadPost", "BufNewFile", "BufNew" } M.opts = { - check_ts = true, - disable_filetype = { "TelescopePrompt", "vim" }, - ts_config = { - lua = { "string", "source" }, - javascript = { "string", "template_string" }, - java = false, - }, + check_ts = true, + disable_filetype = { "TelescopePrompt", "vim" }, + ts_config = { + lua = { "string", "source" }, + javascript = { "string", "template_string" }, + java = false, + }, } return M diff --git a/.config/nvim/lua/plugins/misc/bufferline.lua b/.config/nvim/lua/plugins/misc/bufferline.lua index b2300c62..2e3ca77f 100644 --- a/.config/nvim/lua/plugins/misc/bufferline.lua +++ b/.config/nvim/lua/plugins/misc/bufferline.lua @@ -3,56 +3,56 @@ local M = { "akinsho/bufferline.nvim" } M.event = { "BufReadPost", "BufNewFile", "BufNew" } M.opts = function() - local icons = require("config.icons") + local icons = require("config.icons") - local function diagnostics_indicator(_, _, diagnostics, _) - local result = {} - local symbols = { - error = icons.Error, - warning = icons.Warn, - info = icons.Info, - } - for name, count in pairs(diagnostics) do - if symbols[name] and count > 0 then - table.insert(result, symbols[name] .. " " .. count) - end - end - local result_str = table.concat(result, " ") - return #result_str > 0 and result_str or "" - end + local function diagnostics_indicator(_, _, diagnostics, _) + local result = {} + local symbols = { + error = icons.Error, + warning = icons.Warn, + info = icons.Info, + } + for name, count in pairs(diagnostics) do + if symbols[name] and count > 0 then + table.insert(result, symbols[name] .. " " .. count) + end + end + local result_str = table.concat(result, " ") + return #result_str > 0 and result_str or "" + end - local config = { - highlights = { - background = { - italic = true, - bold = false, - }, - buffer_selected = { - italic = false, - bold = true, - }, - }, - options = { - indicator = { - style = "none", - }, - buffer_close_icon = icons.Close, - modified_icon = icons.Modified, - close_icon = icons.Close, - left_trunc_marker = icons.Truncate, - right_trunc_marker = icons.Truncate, - diagnostics = "nvim_lsp", - diagnostics_indicator = diagnostics_indicator, - offsets = {}, - show_buffer_close_icons = false, - show_close_icon = false, - separator_style = { "", "" }, - move_wraps_at_ends = true, - always_show_bufferline = false, - sort_by = "id", - }, - } - return config + local config = { + highlights = { + background = { + italic = true, + bold = false, + }, + buffer_selected = { + italic = false, + bold = true, + }, + }, + options = { + indicator = { + style = "none", + }, + buffer_close_icon = icons.Close, + modified_icon = icons.Modified, + close_icon = icons.Close, + left_trunc_marker = icons.Truncate, + right_trunc_marker = icons.Truncate, + diagnostics = "nvim_lsp", + diagnostics_indicator = diagnostics_indicator, + offsets = {}, + show_buffer_close_icons = false, + show_close_icon = false, + separator_style = { "", "" }, + move_wraps_at_ends = true, + always_show_bufferline = false, + sort_by = "id", + }, + } + return config end return M diff --git a/.config/nvim/lua/plugins/misc/comment.lua b/.config/nvim/lua/plugins/misc/comment.lua index 77ecd0f2..0a59fd16 100644 --- a/.config/nvim/lua/plugins/misc/comment.lua +++ b/.config/nvim/lua/plugins/misc/comment.lua @@ -3,10 +3,10 @@ local M = { "numToStr/Comment.nvim" } M.event = { "BufReadPost", "BufNewFile", "BufNew" } M.opts = { - mappings = { - basic = false, - extra = false, - }, + mappings = { + basic = false, + extra = false, + }, } return M diff --git a/.config/nvim/lua/plugins/misc/gitsigns.lua b/.config/nvim/lua/plugins/misc/gitsigns.lua index d3a06daf..95d97431 100644 --- a/.config/nvim/lua/plugins/misc/gitsigns.lua +++ b/.config/nvim/lua/plugins/misc/gitsigns.lua @@ -5,14 +5,14 @@ M.event = { "BufReadPost", "BufNewFile", "BufNew" } local icons = require("config.icons") M.opts = { - signs = { - add = { text = icons.Added }, - change = { text = icons.Modified }, - delete = { text = icons.Removed }, - topdelete = { text = icons.Removed }, - changedelete = { text = icons.ChangeDelete }, - untracked = { text = icons.Untracked }, - }, + signs = { + add = { text = icons.Added }, + change = { text = icons.Modified }, + delete = { text = icons.Removed }, + topdelete = { text = icons.Removed }, + changedelete = { text = icons.ChangeDelete }, + untracked = { text = icons.Untracked }, + }, } return M diff --git a/.config/nvim/lua/plugins/misc/indent-blankline.lua b/.config/nvim/lua/plugins/misc/indent-blankline.lua index c24366e4..34065f51 100644 --- a/.config/nvim/lua/plugins/misc/indent-blankline.lua +++ b/.config/nvim/lua/plugins/misc/indent-blankline.lua @@ -5,31 +5,31 @@ M.main = "ibl" M.event = { "BufReadPost", "BufNewFile", "BufNew" } M.dependencies = { - "nvim-treesitter", + "nvim-treesitter", } M.opts = { - indent = { - char = "▏", - tab_char = "▏", - }, - scope = { - char = "▎", - enabled = true, - show_start = false, - show_end = false, - }, - exclude = { - filetypes = { - "help", - "packer", - "NvimTree", - }, - buftypes = { - "terminal", - "nofile", - }, - }, + indent = { + char = "▏", + tab_char = "▏", + }, + scope = { + char = "▎", + enabled = true, + show_start = true, + show_end = true, + }, + exclude = { + filetypes = { + "help", + "packer", + "NvimTree", + }, + buftypes = { + "terminal", + "nofile", + }, + }, } return M diff --git a/.config/nvim/lua/plugins/misc/init.lua b/.config/nvim/lua/plugins/misc/init.lua index 86f58314..75a36865 100644 --- a/.config/nvim/lua/plugins/misc/init.lua +++ b/.config/nvim/lua/plugins/misc/init.lua @@ -1,30 +1,30 @@ return { - { "nvim-lua/plenary.nvim", lazy = true }, - { "kyazdani42/nvim-web-devicons", lazy = true }, - { "zk-org/zk-nvim", opts = { picker = "telescope" }, main = "zk" }, - { "NMAC427/guess-indent.nvim" }, - { "JoosepAlviste/nvim-ts-context-commentstring" }, - require("plugins.misc.alpha"), - require("plugins.misc.autopairs"), - require("plugins.misc.bufferline"), - require("plugins.misc.colorizer"), - require("plugins.misc.comment"), - require("plugins.misc.gitsigns"), - require("plugins.misc.indent-blankline"), - require("plugins.misc.taolf"), - require("plugins.misc.lspkind"), - require("plugins.misc.lualine"), - require("plugins.misc.mason"), - require("plugins.misc.rustacean"), - require("plugins.misc.surround"), - require("plugins.misc.telescope"), - require("plugins.misc.telescope-fzf-native"), - require("plugins.misc.todo-comments"), - require("plugins.misc.toggleterm"), - require("plugins.misc.tokyonight"), - require("plugins.misc.treesitter"), - require("plugins.misc.ufo"), - require("plugins.misc.vimtex"), - require("plugins.misc.which-key"), - -- require("plugins.misc.tabnine"), + { "nvim-lua/plenary.nvim", lazy = true }, + { "kyazdani42/nvim-web-devicons", lazy = true }, + { "zk-org/zk-nvim", opts = { picker = "telescope" }, main = "zk" }, + { "NMAC427/guess-indent.nvim" }, + { "JoosepAlviste/nvim-ts-context-commentstring" }, + require("plugins.misc.alpha"), + require("plugins.misc.autopairs"), + require("plugins.misc.bufferline"), + require("plugins.misc.colorizer"), + require("plugins.misc.comment"), + require("plugins.misc.gitsigns"), + require("plugins.misc.indent-blankline"), + require("plugins.misc.taolf"), + require("plugins.misc.lspkind"), + require("plugins.misc.lualine"), + require("plugins.misc.mason"), + require("plugins.misc.rustacean"), + require("plugins.misc.surround"), + require("plugins.misc.telescope"), + require("plugins.misc.telescope-fzf-native"), + require("plugins.misc.todo-comments"), + require("plugins.misc.toggleterm"), + require("plugins.misc.tokyonight"), + require("plugins.misc.treesitter"), + require("plugins.misc.ufo"), + require("plugins.misc.vimtex"), + require("plugins.misc.which-key"), + -- require("plugins.misc.tabnine"), } diff --git a/.config/nvim/lua/plugins/misc/lspkind.lua b/.config/nvim/lua/plugins/misc/lspkind.lua index e097ddac..0ca29c04 100644 --- a/.config/nvim/lua/plugins/misc/lspkind.lua +++ b/.config/nvim/lua/plugins/misc/lspkind.lua @@ -3,13 +3,13 @@ local M = { "onsails/lspkind.nvim" } M.lazy = true M.opts = { - mode = "symbol", - symbol_map = require("config.icons").lspkind, - menu = {}, + mode = "symbol", + symbol_map = require("config.icons").lspkind, + menu = {}, } M.config = function(_, opts) - require("lspkind").init(opts) + require("lspkind").init(opts) end return M diff --git a/.config/nvim/lua/plugins/misc/lualine.lua b/.config/nvim/lua/plugins/misc/lualine.lua index 93be4816..c65c6ca6 100644 --- a/.config/nvim/lua/plugins/misc/lualine.lua +++ b/.config/nvim/lua/plugins/misc/lualine.lua @@ -1,217 +1,217 @@ local M = { "nvim-lualine/lualine.nvim" } M.opts = function() - local colors = require("tokyonight.colors").setup({ transform = true }) - local icons = require("config.icons") - 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, - } + local colors = require("tokyonight.colors").setup({ transform = true }) + local icons = require("config.icons") + 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, + } - -- local function search_result() - -- if vim.v.hlsearch == 0 then - -- return "" - -- end - -- local last_search = vim.fn.getreg("/") - -- if not last_search or last_search == "" then - -- return "" - -- end - -- local searchcount = vim.fn.searchcount({ maxcount = 9999 }) - -- return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")" - -- end + -- local function search_result() + -- if vim.v.hlsearch == 0 then + -- return "" + -- end + -- local last_search = vim.fn.getreg("/") + -- if not last_search or last_search == "" then + -- return "" + -- end + -- local searchcount = vim.fn.searchcount({ maxcount = 9999 }) + -- return last_search .. "(" .. searchcount.current .. "/" .. searchcount.total .. ")" + -- 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" }, - }, - 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 = {}, - }, - } + 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" }, + }, + 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 = {}, + }, + } - local function ins_left(component) - table.insert(config.sections.lualine_c, component) - end + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end - local function ins_right(component) - table.insert(config.sections.lualine_x, component) - end + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end - local function mode_color() - local color = { - n = colors.red, - i = colors.green, - v = colors.magenta, - [string.char(22)] = colors.magenta, - V = colors.magenta, - c = colors.blue, - no = colors.red, - s = colors.orange, - S = colors.orange, - [string.char(19)] = colors.orange, - ic = colors.yellow, - R = colors.purple, - Rv = colors.purple, - 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 + local function mode_color() + local color = { + n = colors.red, + i = colors.green, + v = colors.magenta, + [string.char(22)] = colors.magenta, + V = colors.magenta, + c = colors.blue, + no = colors.red, + s = colors.orange, + S = colors.orange, + [string.char(19)] = colors.orange, + ic = colors.yellow, + R = colors.purple, + Rv = colors.purple, + 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 }, - }) + ins_left({ + function() + return "▊" + end, + color = function() + return mode_color() + end, + padding = { right = 1 }, + }) - ins_left({ - "filename", - cond = conditions.buffer_not_empty, - color = { fg = colors.magenta, gui = "bold" }, - }) + ins_left({ + "filename", + cond = conditions.buffer_not_empty, + color = { fg = colors.magenta, gui = "bold" }, + }) - ins_left({ - "fileformat", - fmt = string.upper, - icons_enabled = false, - color = { fg = colors.green }, - }) + ins_left({ + "fileformat", + fmt = string.upper, + icons_enabled = false, + color = { fg = colors.green }, + }) - ins_left({ - "o:encoding", - fmt = string.upper, - cond = conditions.hide_in_width, - color = { fg = colors.green }, - }) + ins_left({ + "o:encoding", + fmt = string.upper, + cond = conditions.hide_in_width, + color = { fg = colors.green }, + }) - ins_left({ - "filesize", - fmt = string.upper, - icons_enabled = false, - color = { fg = colors.green }, - }) + ins_left({ + "filesize", + fmt = string.upper, + icons_enabled = false, + color = { fg = colors.green }, + }) - ins_left({ - "%04l:%04c", - }) + ins_left({ + "%04l:%04c", + }) - -- NOTE: My beloved :( + -- NOTE: My beloved :( - -- 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 } - -- } + -- 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 } + -- } - -- ins_right({ - -- search_result, - -- color = { fg = colors.fg }, - -- padding = { left = 1 }, - -- }) + -- ins_right({ + -- search_result, + -- color = { fg = colors.fg }, + -- padding = { left = 1 }, + -- }) - -- ins_right({ - -- 'tabnine', - -- color = { fg = colors.green1, gui = "bold" }, - -- }) + -- ins_right({ + -- 'tabnine', + -- color = { fg = colors.green1, gui = "bold" }, + -- }) - ins_right({ - function() - local msg = "" - local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return "No LSP" - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - msg = msg .. ", " .. client.name - end - end - return msg:sub(3) - end, - color = { fg = colors.green2, gui = "bold" }, - }) + ins_right({ + function() + local msg = "" + local buf_ft = vim.api.nvim_buf_get_option(0, "filetype") + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return "No LSP" + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + msg = msg .. ", " .. client.name + end + end + return msg:sub(3) + end, + color = { fg = colors.green2, gui = "bold" }, + }) - ins_right({ - "diagnostics", - sources = { "nvim_diagnostic" }, - symbols = { - error = icons.Error .. " ", - warn = icons.Warn .. " ", - info = icons.Info .. " ", - }, - diagnostics_color = { - color_error = { fg = colors.red }, - color_warn = { fg = colors.yellow }, - color_info = { fg = colors.cyan }, - }, - }) + ins_right({ + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { + error = icons.Error .. " ", + warn = icons.Warn .. " ", + info = icons.Info .. " ", + }, + diagnostics_color = { + color_error = { fg = colors.red }, + color_warn = { fg = colors.yellow }, + color_info = { fg = colors.cyan }, + }, + }) - ins_right({ - "filetype", - color = { fg = colors.green, gui = "bold" }, - padding = { left = 1 }, - }) + ins_right({ + "filetype", + color = { fg = colors.green, gui = "bold" }, + padding = { left = 1 }, + }) - ins_right({ - function() - return "▊" - end, - color = function() - return mode_color() - end, - padding = { left = 1 }, - }) + ins_right({ + function() + return "▊" + end, + color = function() + return mode_color() + end, + padding = { left = 1 }, + }) - return config + return config end return M diff --git a/.config/nvim/lua/plugins/misc/mason.lua b/.config/nvim/lua/plugins/misc/mason.lua index 713bc61c..378bb14c 100644 --- a/.config/nvim/lua/plugins/misc/mason.lua +++ b/.config/nvim/lua/plugins/misc/mason.lua @@ -3,27 +3,27 @@ local M = { "williamboman/mason.nvim" } local icons = require("config.icons") M.cmd = { - "Mason", - "MasonInstall", - "MasonUninstall", - "MasonUninstallAll", - "MasonLog", - "MasonUpdate", + "Mason", + "MasonInstall", + "MasonUninstall", + "MasonUninstallAll", + "MasonLog", + "MasonUpdate", } M.build = ":MasonUpdate" M.opts = { - ui = { - border = "none", - icons = { - package_installed = icons.True, - package_pending = icons.Pending, - package_uninstalled = icons.False, - }, - }, - log_level = vim.log.levels.INFO, - max_concurrent_installers = 4, + ui = { + border = "none", + icons = { + package_installed = icons.True, + package_pending = icons.Pending, + package_uninstalled = icons.False, + }, + }, + log_level = vim.log.levels.INFO, + max_concurrent_installers = 4, } return M diff --git a/.config/nvim/lua/plugins/misc/rustacean.lua b/.config/nvim/lua/plugins/misc/rustacean.lua index 47c5eb96..2133549b 100644 --- a/.config/nvim/lua/plugins/misc/rustacean.lua +++ b/.config/nvim/lua/plugins/misc/rustacean.lua @@ -5,20 +5,20 @@ M.build = ":MasonInstall codelldb" M.ft = { "rust" } M.init = function() - local extension_path = os.getenv("XDG_DATA_HOME") .. "/nvim/mason/packages/codelldb/extension/" - local codelldb_path = extension_path .. "apapter/codelldb" - local liblldb_path = extension_path .. "lldb/lib/liblldb.so" - local adapter = require("rustaceanvim.config").get_codelldb_adapter(codelldb_path, liblldb_path) - vim.g.rustaceanvim = function() - return { - dap = { - adapter = adapter, - }, - server = { - on_attach = require("funcs").lsp_on_attach, - }, - } - end + local extension_path = os.getenv("XDG_DATA_HOME") .. "/nvim/mason/packages/codelldb/extension/" + local codelldb_path = extension_path .. "apapter/codelldb" + local liblldb_path = extension_path .. "lldb/lib/liblldb.so" + local adapter = require("rustaceanvim.config").get_codelldb_adapter(codelldb_path, liblldb_path) + vim.g.rustaceanvim = function() + return { + dap = { + adapter = adapter, + }, + server = { + on_attach = require("funcs").lsp_on_attach, + }, + } + end end return M diff --git a/.config/nvim/lua/plugins/misc/surround.lua b/.config/nvim/lua/plugins/misc/surround.lua index 4fa088f2..7b3f6f9b 100644 --- a/.config/nvim/lua/plugins/misc/surround.lua +++ b/.config/nvim/lua/plugins/misc/surround.lua @@ -3,19 +3,19 @@ local M = { "kylechui/nvim-surround" } M.event = "VeryLazy" M.opts = { - keymaps = require("config.keymaps").surround, - surrounds = { - ["B"] = { - add = { "{{ ", " }}" }, - find = function() - return require("nvim-surround.config").get_selection({ pattern = "{{ .- }}" }) - end, - delete = "^(.. ?)().-( ?..)()$", - }, - }, - aliases = { - ["B"] = false, - }, + keymaps = require("config.keymaps").surround, + surrounds = { + ["B"] = { + add = { "{{ ", " }}" }, + find = function() + return require("nvim-surround.config").get_selection({ pattern = "{{ .- }}" }) + end, + delete = "^(.. ?)().-( ?..)()$", + }, + }, + aliases = { + ["B"] = false, + }, } return M diff --git a/.config/nvim/lua/plugins/misc/tabnine.lua b/.config/nvim/lua/plugins/misc/tabnine.lua index e19c78b2..439de931 100644 --- a/.config/nvim/lua/plugins/misc/tabnine.lua +++ b/.config/nvim/lua/plugins/misc/tabnine.lua @@ -7,16 +7,16 @@ M.event = { "BufReadPost", "BufNewFile", "BufNew" } M.main = "tabnine" M.opts = function() - local colors = require("tokyonight.colors").setup({ transform = true }) - return { - disable_auto_comment = true, - accept_keymap = "", - dismiss_keymap = "", - debounce_ms = 800, - suggestion_color = { gui = colors.fg_gutter, cterm = 244 }, - exclude_filetypes = { "TelescopePrompt", "NvimTree" }, - log_file_path = nil, -- absolute path to Tabnine log file - } + local colors = require("tokyonight.colors").setup({ transform = true }) + return { + disable_auto_comment = true, + accept_keymap = "", + dismiss_keymap = "", + debounce_ms = 800, + suggestion_color = { gui = colors.fg_gutter, cterm = 244 }, + exclude_filetypes = { "TelescopePrompt", "NvimTree" }, + log_file_path = nil, -- absolute path to Tabnine log file + } end return M diff --git a/.config/nvim/lua/plugins/misc/telescope.lua b/.config/nvim/lua/plugins/misc/telescope.lua index 121c5859..78350c9b 100644 --- a/.config/nvim/lua/plugins/misc/telescope.lua +++ b/.config/nvim/lua/plugins/misc/telescope.lua @@ -6,43 +6,43 @@ M.dependencies = { "telescope-fzf-native.nvim" } M.cmd = "Telescope" local opts = function() - local actions = require("telescope.actions") - return { - defaults = { - git_worktrees = vim.g.git_worktrees, - prompt_prefix = icons.Selected, - path_display = { "truncate" }, - sorting_startegy = "ascending", - layout_config = { - horizontal = { prompt_position = "top", preview_width = 0.7 }, - vertical = { mirror = false }, - width = 0.87, - height = 0.80, - preview_cutoff = 120, - }, + local actions = require("telescope.actions") + return { + defaults = { + git_worktrees = vim.g.git_worktrees, + prompt_prefix = icons.Selected, + path_display = { "truncate" }, + sorting_startegy = "ascending", + layout_config = { + horizontal = { prompt_position = "top", preview_width = 0.7 }, + vertical = { mirror = false }, + width = 0.87, + height = 0.80, + preview_cutoff = 120, + }, -- TODO: Move to config.keymaps - mappings = { - i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - }, - n = { q = actions.close }, - }, - }, - } + mappings = { + i = { + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, + }, + n = { q = actions.close }, + }, + }, + } end M.config = function() - local telescope = require("telescope") - telescope.setup(opts()) - if pcall(require, "aerial") then - telescope.load_extension("aerial") - end - if require("funcs").is_available("telescope-fzf-native.nvim") then - telescope.load_extension("fzf") - end + local telescope = require("telescope") + telescope.setup(opts()) + if pcall(require, "aerial") then + telescope.load_extension("aerial") + end + if require("funcs").is_available("telescope-fzf-native.nvim") then + telescope.load_extension("fzf") + end end return M diff --git a/.config/nvim/lua/plugins/misc/todo-comments.lua b/.config/nvim/lua/plugins/misc/todo-comments.lua index 0740ff24..9ce17788 100644 --- a/.config/nvim/lua/plugins/misc/todo-comments.lua +++ b/.config/nvim/lua/plugins/misc/todo-comments.lua @@ -4,16 +4,16 @@ local icons = require("config.icons") M.event = { "BufReadPost", "BufNewFile", "BufNew" } M.opts = { - signs = false, - keywords = { - BUG = { icon = icons.Bug, color = "error", alt = { "FIXME", "FIX", "FIXIT", "ISSUE" } }, - TODO = { icon = icons.Task, color = "info" }, - HACK = { icon = icons.Flame, color = "warning" }, - WARN = { icon = icons.Warn, color = "warning", alt = { "WARNING", "XXX" } }, - PERF = { icon = icons.Speed, alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, - NOTE = { icon = icons.Buffer, color = "hint", alt = { "INFO" } }, - TEST = { icon = icons.Test, color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, - }, + signs = false, + keywords = { + BUG = { icon = icons.Bug, color = "error", alt = { "FIXME", "FIX", "FIXIT", "ISSUE" } }, + TODO = { icon = icons.Task, color = "info" }, + HACK = { icon = icons.Flame, color = "warning" }, + WARN = { icon = icons.Warn, color = "warning", alt = { "WARNING", "XXX" } }, + PERF = { icon = icons.Speed, alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } }, + NOTE = { icon = icons.Buffer, color = "hint", alt = { "INFO" } }, + TEST = { icon = icons.Test, color = "test", alt = { "TESTING", "PASSED", "FAILED" } }, + }, } return M diff --git a/.config/nvim/lua/plugins/misc/toggleterm.lua b/.config/nvim/lua/plugins/misc/toggleterm.lua index 4d00a698..cdee562d 100644 --- a/.config/nvim/lua/plugins/misc/toggleterm.lua +++ b/.config/nvim/lua/plugins/misc/toggleterm.lua @@ -3,40 +3,40 @@ local M = { "akinsho/toggleterm.nvim" } M.cmd = { "ToggleTerm", "TermExec" } M.opts = { - size = function(term) - if term.direction == "horizontal" then - return vim.o.lines * 0.33 - elseif term.direction == "vertical" then - return vim.o.colums * 0.33 - end - end, + size = function(term) + if term.direction == "horizontal" then + return vim.o.lines * 0.33 + elseif term.direction == "vertical" then + return vim.o.colums * 0.33 + end + end, -- TODO: Move to config.keymaps - open_mapping = "", - direction = "float", - highlights = { - Normal = { link = "Normal" }, - NormalNC = { link = "NormalNC" }, - NormalFloat = { link = "NormalFloat" }, - FloatBorder = { link = "FloatBorder" }, - StatusLine = { link = "StatusLine" }, - StatusLineNC = { link = "StatusLineNC" }, - WinBar = { link = "WinBar" }, - WinBarNC = { link = "WinBarNC" }, - }, - float_opts = { - border = "curved", - -- winblend = 10, - width = function() - return math.ceil(math.min(vim.o.columns, math.max(80, vim.o.columns - 20))) - end, - height = function() - return math.ceil(math.min(vim.o.lines, math.max(20, vim.o.lines - 10))) - end, - }, - on_create = function() - vim.opt.foldcolumn = "0" - vim.opt.signcolumn = "no" - end, + open_mapping = "", + direction = "float", + highlights = { + Normal = { link = "Normal" }, + NormalNC = { link = "NormalNC" }, + NormalFloat = { link = "NormalFloat" }, + FloatBorder = { link = "FloatBorder" }, + StatusLine = { link = "StatusLine" }, + StatusLineNC = { link = "StatusLineNC" }, + WinBar = { link = "WinBar" }, + WinBarNC = { link = "WinBarNC" }, + }, + float_opts = { + border = "curved", + -- winblend = 10, + width = function() + return math.ceil(math.min(vim.o.columns, math.max(80, vim.o.columns - 20))) + end, + height = function() + return math.ceil(math.min(vim.o.lines, math.max(20, vim.o.lines - 10))) + end, + }, + on_create = function() + vim.opt.foldcolumn = "0" + vim.opt.signcolumn = "no" + end, } return M diff --git a/.config/nvim/lua/plugins/misc/tokyonight.lua b/.config/nvim/lua/plugins/misc/tokyonight.lua index 89f758ad..689f2da3 100644 --- a/.config/nvim/lua/plugins/misc/tokyonight.lua +++ b/.config/nvim/lua/plugins/misc/tokyonight.lua @@ -3,16 +3,16 @@ local M = { "folke/tokyonight.nvim" } M.priority = 1000 local opts = { - style = "night", - transparent = true, - on_highlights = function(hl, _) - hl.CurSearch = nil - end, + style = "night", + transparent = true, + on_highlights = function(hl, _) + hl.CurSearch = nil + end, } M.config = function() - require("tokyonight").setup(opts) - vim.cmd("colorscheme tokyonight") + require("tokyonight").setup(opts) + vim.cmd("colorscheme tokyonight") end return M diff --git a/.config/nvim/lua/plugins/misc/ufo.lua b/.config/nvim/lua/plugins/misc/ufo.lua index 8e8dac91..26dceccb 100644 --- a/.config/nvim/lua/plugins/misc/ufo.lua +++ b/.config/nvim/lua/plugins/misc/ufo.lua @@ -5,35 +5,35 @@ M.event = { "InsertEnter" } M.dependencies = { "kevinhwang91/promise-async" } M.opts = { - preview = { - mappings = { - scrollB = "", - scrollF = "", - scrollU = "", - scrollD = "", - }, - }, - provider_selector = function(_, filetype, buftype) - local function handleFallbackException(bufnr, err, providerName) - if type(err) == "string" and err:match("UfoFallbackException") then - return require("ufo").getFolds(bufnr, providerName) - else - return require("promise").reject(err) - end - end + preview = { + mappings = { + scrollB = "", + scrollF = "", + scrollU = "", + scrollD = "", + }, + }, + provider_selector = function(_, filetype, buftype) + local function handleFallbackException(bufnr, err, providerName) + if type(err) == "string" and err:match("UfoFallbackException") then + return require("ufo").getFolds(bufnr, providerName) + else + return require("promise").reject(err) + end + end - return (filetype == "" or buftype == "nofile") and "indent" -- only use indent until a file is opened - or function(bufnr) - return require("ufo") - .getFolds(bufnr, "lsp") - :catch(function(err) - return handleFallbackException(bufnr, err, "treesitter") - end) - :catch(function(err) - return handleFallbackException(bufnr, err, "indent") - end) - end - end, + return (filetype == "" or buftype == "nofile") and "indent" -- only use indent until a file is opened + or function(bufnr) + return require("ufo") + .getFolds(bufnr, "lsp") + :catch(function(err) + return handleFallbackException(bufnr, err, "treesitter") + end) + :catch(function(err) + return handleFallbackException(bufnr, err, "indent") + end) + end + end, } return M diff --git a/.config/nvim/lua/plugins/misc/vimtex.lua b/.config/nvim/lua/plugins/misc/vimtex.lua index 0cea2a28..190340f5 100644 --- a/.config/nvim/lua/plugins/misc/vimtex.lua +++ b/.config/nvim/lua/plugins/misc/vimtex.lua @@ -1,11 +1,11 @@ local M = { "lervag/vimtex" } M.init = function() - vim.g.vimtex_view_method = "zathura" - vim.g.tex_flavor = "latex" - vim.g.vimtex_quickfix_mode = 0 - vim.o.conceallevel = 1 - vim.g.tex_conceal = "abdmg" + vim.g.vimtex_view_method = "zathura" + vim.g.tex_flavor = "latex" + vim.g.vimtex_quickfix_mode = 0 + vim.o.conceallevel = 1 + vim.g.tex_conceal = "abdmg" end return M diff --git a/.config/nvim/lua/plugins/misc/which-key.lua b/.config/nvim/lua/plugins/misc/which-key.lua index 9385214f..6e667cfe 100644 --- a/.config/nvim/lua/plugins/misc/which-key.lua +++ b/.config/nvim/lua/plugins/misc/which-key.lua @@ -5,33 +5,33 @@ local icons = require("config.icons") M.event = "VeryLazy" M.init = function() - vim.o.timeout = true - vim.o.timeoutlen = 300 + vim.o.timeout = true + vim.o.timeoutlen = 300 end M.opts = { - plugins = { - presets = { - operators = false, - motions = false, - }, - }, - icons = { - breadcrumb = icons.Selected, - separator = icons.Selected, - group = "", - }, - hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, - triggers = "auto", - triggers_blacklist = { - i = { "j", "k", "v", "y" }, - v = { "j", "k", "y" }, - }, + plugins = { + presets = { + operators = false, + motions = false, + }, + }, + icons = { + breadcrumb = icons.Selected, + separator = icons.Selected, + group = "", + }, + hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, + triggers = "auto", + triggers_blacklist = { + i = { "j", "k", "v", "y" }, + v = { "j", "k", "y" }, + }, } M.config = function(_, opts) - require("which-key").setup(opts) - require("funcs").which_key_register() + require("which-key").setup(opts) + require("funcs").which_key_register() end return M