diff --git a/config/nvim/lua/fschauen/util/icons.lua b/config/nvim/lua/fschauen/util/icons.lua index 4b4417f..737dd71 100644 --- a/config/nvim/lua/fschauen/util/icons.lua +++ b/config/nvim/lua/fschauen/util/icons.lua @@ -1,135 +1,138 @@ local M = {} +-- stylua: ignore start + M.diagnostics = { - Debug = ' ', - Error = ' ', - Hint = ' ', - Info = ' ', - Trace = '✎ ', - Warn = ' ', + Debug = " ", + Error = " ", + Hint = " ", + Info = " ", + Trace = "✎ ", + Warn = " ", } M.diagnostics_bold = { - Debug = ' ', - Error = ' ', - Hint = '󰌵 ', - Info = ' ', - Trace = '✎ ', - Warn = ' ', + Debug = " ", + Error = " ", + Hint = "󰌵 ", + Info = " ", + Trace = "✎ ", + Warn = " ", } M.git = { - Branch = '󰘬', --  + Branch = "󰘬", --  file = { - Deleted = '✗', --  - Ignored = '◌', - Renamed = '➜', --  - Staged = '✓', -- S - Unmerged = '', --  - Unstaged = '✶', --  - Untracked = '', -- U + Deleted = "✗", --  + Ignored = "◌", + Renamed = "➜", --  + Staged = "✓", -- S + Unmerged = "", --  + Unstaged = "✶", --  + Untracked = "", -- U } } -- Custom mix of lspkind defaults and VS Code codicons :) M.kind = { - Array = ' ', - Boolean = ' ', - Class = ' ', - Color = ' ', - Constant = '󰏿 ', --  - Constructor = ' ', - Copilot = ' ', - 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 = '󰀫 ', --  + Array = " ", + Boolean = " ", + Class = " ", + Color = " ", + Constant = "󰏿 ", --  + Constructor = " ", + Copilot = " ", + 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 = "󰀫 ", --  } M.modes = { - Normal = '', -- 'Normal ' 'n' - OperatorPending = '', -- 'O-Pend ' 'no' - NormalI = '', -- 'Normal ' 'ni' (normal via i_CTRL-O) - Visual = '󰒉', -- 'Visual ' 'v' - VisualBlock = '󰩭', -- 'V-Block' '' - Select = '󰒉', -- 'Select ' 's' - SelectBlock = '󰩭', -- 'S-Block' '' - Insert = '', -- 'Insert ' 'i' - Replace = '󰄾', -- 'Replace' 'r' - VirtualReplace = '󰶻', -- 'V-Repl ' 'rv' - Command = '', -- 'Command' 'c' - Ex = '', -- ' Ex ' 'cv' - modeore = '', -- ' modeore 'rm' (modeORE) - Confirm = '󰭚', -- 'Confirm' 'r?' (:confirm) - Shell = '', -- ' Shell ' '!' (external command executing) - Terminal = '', -- ' Term ' 't' + Normal = "", -- "Normal " "n" + OperatorPending = "", -- "O-Pend " "no" + NormalI = "", -- "Normal " "ni" (normal via i_CTRL-O) + Visual = "󰒉", -- "Visual " "v" + VisualBlock = "󰩭", -- "V-Block" "" + Select = "󰒉", -- "Select " "s" + SelectBlock = "󰩭", -- "S-Block" "" + Insert = "", -- "Insert " "i" + Replace = "󰄾", -- "Replace" "r" + VirtualReplace = "󰶻", -- "V-Repl " "rv" + Command = "", -- "Command" "c" + Ex = "", -- " Ex " "cv" + modeore = "", -- " modeore "rm" (modeORE) + Confirm = "󰭚", -- "Confirm" "r?" (:confirm) + Shell = "", -- " Shell " "!" (external command executing) + Terminal = "", -- " Term " "t" } M.ui = { - Attention = '', - Bug = '', --  - Checkbox = '', --  󰄬 󰄬  - Checkmark = '', --  󰄬 󰄬  - ChevronDown = '', --  - ChevronLeft = '', --  - ChevronRight = '', --  - ChevronUp = '', --  - ChevronSmallDown = '', - ChevronSmallLeft = '', - ChevronSmallRight = '', - ChevronSmallUp = '', - Circle = '●', - Diagnostic = '', - EmptyFolder = '', - EmptyFolderOpen = '', - File = '', --  - FileSymlink = '', --  - Files = '', - Fire = '', --  - Folder = '󰉋', - FolderOpen = '', - FolderSymlink = '', - Gauge = '󰓅', --  - LineLeft = '▏', - LineLeftBold = '▎', - LineMiddle = '│', - LineMiddleBold = '┃', - Modified = '', - Note = '', --  - Paste = '', - Play = '', - ReadOnly = '', -- 'RO', - Search = '', --  - Sleep = '󰒲', - Telescope = '', - TestTube = '󰙨', -- 󰤑 - Toggle = '󰨚', - Warning = '', + Attention = "", + Bug = "", --  + Checkbox = "", --  󰄬 󰄬  + Checkmark = "", --  󰄬 󰄬  + ChevronDown = "", --  + ChevronLeft = "", --  + ChevronRight = "", --  + ChevronUp = "", --  + ChevronSmallDown = "", + ChevronSmallLeft = "", + ChevronSmallRight = "", + ChevronSmallUp = "", + Circle = "●", + Diagnostic = "", + EmptyFolder = "", + EmptyFolderOpen = "", + File = "", --  + FileSymlink = "", --  + Files = "", + Fire = "", --  + Folder = "󰉋", + FolderOpen = "", + FolderSymlink = "", + Gauge = "󰓅", --  + LineLeft = "▏", + LineLeftBold = "▎", + LineMiddle = "│", + LineMiddleBold = "┃", + Modified = "", + Note = "", --  + Paste = "", + Play = "", + ReadOnly = "", -- "RO", + Search = "", --  + Sleep = "󰒲", + Telescope = "", + TestTube = "󰙨", -- 󰤑 + Toggle = "󰨚", + Warning = "", } -return M +-- stylua: ignore end +return M diff --git a/config/nvim/lua/fschauen/util/init.lua b/config/nvim/lua/fschauen/util/init.lua index 9cc7f3c..ef4c4bb 100644 --- a/config/nvim/lua/fschauen/util/init.lua +++ b/config/nvim/lua/fschauen/util/init.lua @@ -22,13 +22,14 @@ end ---Get selected text. ---@return string: selected text, or work under cursor if not in visual mode. M.get_selected_text = function() - if vim.fn.mode() ~= 'v' then return vim.fn.expand '' end + if vim.fn.mode() ~= "v" then + return vim.fn.expand("") + end - return M.preserve_register('v', function() - vim.cmd [[noautocmd sil norm "vy]] - return vim.fn.getreg 'v' + return M.preserve_register("v", function() + vim.cmd([[noautocmd sil norm "vy]]) + return vim.fn.getreg("v") end) end return M - diff --git a/config/nvim/lua/fschauen/util/lua.lua b/config/nvim/lua/fschauen/util/lua.lua index 06f7c45..d191cc7 100644 --- a/config/nvim/lua/fschauen/util/lua.lua +++ b/config/nvim/lua/fschauen/util/lua.lua @@ -1,17 +1,17 @@ local M = {} -local util = require('fschauen.util') +local util = require("fschauen.util") local exists = util.exists local find_module_sources = function(modname) - modname = modname:gsub('^%.+', ''):gsub('/', '.') - local base = 'lua/' .. modname:gsub('%.', '/') - local candidates = { base .. '.lua', base .. '/init.lua' } + modname = modname:gsub("^%.+", ""):gsub("/", ".") + local base = "lua/" .. modname:gsub("%.", "/") + local candidates = { base .. ".lua", base .. "/init.lua" } local results = {} for _, directory in ipairs(vim.opt.runtimepath:get()) do for _, candidate in ipairs(candidates) do - local path = directory .. '/' .. candidate + local path = directory .. "/" .. candidate if exists(path) then table.insert(results, path) end @@ -21,14 +21,14 @@ local find_module_sources = function(modname) end M.execute_lines = function(first, last) - first = first or vim.fn.line('.') + first = first or vim.fn.line(".") last = last or first - local code = vim.fn.join(vim.fn.getline(first, last), '\n') + local code = vim.fn.join(vim.fn.getline(first, last), "\n") loadstring(code)() end M.execute_selection = function() - local selection = { vim.fn.line('v'), vim.fn.line('.') } + local selection = { vim.fn.line("v"), vim.fn.line(".") } table.sort(selection) M.execute_lines(unpack(selection)) end @@ -37,20 +37,20 @@ M.execute_file = function(path) if path then vim.cmd.luafile(path) else - M.execute_lines(1, vim.fn.line('$')) + M.execute_lines(1, vim.fn.line("$")) end end M.go_to_module = function(modname) - modname = modname or vim.fn.expand('') + modname = modname or vim.fn.expand("") local sources = find_module_sources(modname) if #sources == 0 then - vim.notify('Not found: ' .. modname, vim.log.levels.WARN) + vim.notify("Not found: " .. modname, vim.log.levels.WARN) elseif #sources == 1 then vim.cmd.edit(sources[1]) else - vim.ui.select(sources, { prompt = 'Which one?' }, function(choice) + vim.ui.select(sources, { prompt = "Which one?" }, function(choice) if choice then vim.cmd.edit(choice) end @@ -59,4 +59,3 @@ M.go_to_module = function(modname) end return M - diff --git a/config/nvim/lua/fschauen/util/options.lua b/config/nvim/lua/fschauen/util/options.lua index b78f657..2f117a8 100644 --- a/config/nvim/lua/fschauen/util/options.lua +++ b/config/nvim/lua/fschauen/util/options.lua @@ -12,18 +12,17 @@ end M.toggle_list = function() vim.wo.list = not vim.wo.list - vim.cmd [[set list?]] + vim.cmd([[set list?]]) end M.toggle_wrap = function() vim.wo.wrap = not vim.wo.wrap - vim.cmd [[set wrap?]] + vim.cmd([[set wrap?]]) end M.toggle_spell = function() vim.wo.spell = not vim.wo.spell - vim.cmd [[set spell?]] + vim.cmd([[set spell?]]) end return M -