diff options
author | Soispha <soispha@vhack.eu> | 2024-02-20 17:21:42 +0100 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2024-02-20 17:21:42 +0100 |
commit | f2bdeaed0bcf97a880fe36cfc8a050d1643120b8 (patch) | |
tree | ba4fe9c3ddf076529701c0e776ffef2104ac23d5 /hm/soispha/conf/nvim | |
parent | refactor(treewide): Add a `.sh` extension to shell scripts (diff) | |
download | nixos-config-f2bdeaed0bcf97a880fe36cfc8a050d1643120b8.zip |
refactor(treewide): Reformat all files with treefmt
This includes getting all shellscripts to pass shellcheck. To accomplish this, some old scripts were removed
Diffstat (limited to '')
17 files changed, 327 insertions, 333 deletions
diff --git a/hm/soispha/conf/nvim/files/ftplugin/tex.lua b/hm/soispha/conf/nvim/files/ftplugin/tex.lua index 05a2c593..f3fffa86 100644 --- a/hm/soispha/conf/nvim/files/ftplugin/tex.lua +++ b/hm/soispha/conf/nvim/files/ftplugin/tex.lua @@ -19,40 +19,39 @@ -- -- - -- Set tex specific telescope extension require("telescope").setup({ extensions = { bibtex = { -- Depth for the *.bib file - depth = 1; + depth = 1, -- Path to global bibliographies (placed outside of the project) - global_files = {}; + global_files = {}, -- Define the search keys to use in the picker - search_keys = { "author"; "year"; "title"; }; + search_keys = { "author", "year", "title" }, -- Template for the formatted citation - citation_format = "{{author}} ({{year}}), {{title}}."; + citation_format = "{{author}} ({{year}}), {{title}}.", -- Only use initials for the authors first name - citation_trim_firstname = true; + citation_trim_firstname = true, -- Max number of authors to write in the formatted citation -- following authors will be replaced by "et al." - citation_max_auth = 2; + citation_max_auth = 2, -- Wrapping in the preview window is disabled by default - wrap = false; + wrap = false, -- Custom format for citation label custom_formats = { - { id = "tex_autocite"; cite_marker = "\\autocite{%s}"; }; - }; - format = "tex_autocite"; + { id = "tex_autocite", cite_marker = "\\autocite{%s}" }, + }, + format = "tex_autocite", -- Use context awareness - context = true; + context = true, -- Fallback to global/directory .bib files if context not found -- This setting has no effect if context = false - context_fallback = true; - }; - }; + context_fallback = true, + }, + }, }) require("telescope").load_extension("bibtex") vim.keymap.set("n", "<leader>ib", function() - require("telescope").extensions.bibtex.bibtex() - end, { noremap = true; silent = true; desc = "list bibtex entries in telescope"; }) + require("telescope").extensions.bibtex.bibtex() +end, { noremap = true, silent = true, desc = "list bibtex entries in telescope" }) diff --git a/hm/soispha/conf/nvim/plgs/colorscheme/lua/mk_todos_readable.lua b/hm/soispha/conf/nvim/plgs/colorscheme/lua/mk_todos_readable.lua index ee28151c..d02171b5 100644 --- a/hm/soispha/conf/nvim/plgs/colorscheme/lua/mk_todos_readable.lua +++ b/hm/soispha/conf/nvim/plgs/colorscheme/lua/mk_todos_readable.lua @@ -1,17 +1,16 @@ -local opts = { bg = "NONE"; bold = true; } - +local opts = { bg = "NONE", bold = true } ---@param hl_group string: The name of the hl group ---@param extra_opts table: Extra options to pass to nvim_set_hl local set_hl = function(hl_group, extra_opts) - local local_opts = vim.deepcopy(opts); + local local_opts = vim.deepcopy(opts) for k, v in ipairs(extra_opts) do - local_opts[k] = v; + local_opts[k] = v end vim.api.nvim_set_hl(0, hl_group, local_opts) end -set_hl("@text.danger", { fg = "red"; }) -set_hl("@text.note", { fg = "blue"; }) -set_hl("@text.todo", { fg = "green"; }) -set_hl("@text.warning", { fg = "yellow"; }) +set_hl("@text.danger", { fg = "red" }) +set_hl("@text.note", { fg = "blue" }) +set_hl("@text.todo", { fg = "green" }) +set_hl("@text.warning", { fg = "yellow" }) diff --git a/hm/soispha/conf/nvim/plgs/colorscheme/lua/nightfox.lua b/hm/soispha/conf/nvim/plgs/colorscheme/lua/nightfox.lua index 025eb133..4c502153 100644 --- a/hm/soispha/conf/nvim/plgs/colorscheme/lua/nightfox.lua +++ b/hm/soispha/conf/nvim/plgs/colorscheme/lua/nightfox.lua @@ -1,44 +1,44 @@ require("nightfox").setup({ options = { -- Compiled file's destination location - compile_path = vim.fn.stdpath("cache") .. "/nightfox"; - compile_file_suffix = "_compiled"; -- Compiled file suffix - transparent = true; -- Disable setting background - terminal_colors = true; -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` - dim_inactive = true; -- Non focused panes set to alternative background - module_default = true; -- Default enable value for modules + compile_path = vim.fn.stdpath("cache") .. "/nightfox", + compile_file_suffix = "_compiled", -- Compiled file suffix + transparent = true, -- Disable setting background + terminal_colors = true, -- Set terminal colors (vim.g.terminal_color_*) used in `:terminal` + dim_inactive = true, -- Non focused panes set to alternative background + module_default = true, -- Default enable value for modules colorblind = { - enable = true; -- Enable colorblind support - simulate_only = false; -- Only show simulated colorblind colors and not diff shifted + enable = true, -- Enable colorblind support + simulate_only = false, -- Only show simulated colorblind colors and not diff shifted severity = { - protan = 0.3; -- Severity [0,1] for protan (red) - deutan = 0.9; -- Severity [0,1] for deutan (green) - tritan = 0; -- Severity [0,1] for tritan (blue) - }; - }; - styles = { -- Style to be applied to different syntax groups - comments = "italic"; -- Value is any valid attr-list value `:help attr-list` - conditionals = "NONE"; - constants = "NONE"; - functions = "bold"; - keywords = "bold"; - numbers = "NONE"; - operators = "NONE"; - strings = "NONE"; - types = "NONE"; - variables = "NONE"; - }; + protan = 0.3, -- Severity [0,1] for protan (red) + deutan = 0.9, -- Severity [0,1] for deutan (green) + tritan = 0, -- Severity [0,1] for tritan (blue) + }, + }, + styles = { -- Style to be applied to different syntax groups + comments = "italic", -- Value is any valid attr-list value `:help attr-list` + conditionals = "NONE", + constants = "NONE", + functions = "bold", + keywords = "bold", + numbers = "NONE", + operators = "NONE", + strings = "NONE", + types = "NONE", + variables = "NONE", + }, inverse = { -- Inverse highlight for different types - match_paren = false; - visual = false; - search = false; - }; + match_paren = false, + visual = false, + search = false, + }, modules = { -- List of various plugins and additional options - diagnostic = { enable = true; background = false; }; - native_lsp = { enable = true; background = false; }; - }; - }; - palettes = {}; - specs = {}; - groups = {}; + diagnostic = { enable = true, background = false }, + native_lsp = { enable = true, background = false }, + }, + }, + palettes = {}, + specs = {}, + groups = {}, }) diff --git a/hm/soispha/conf/nvim/plgs/debugprint/lua/debugprint.lua b/hm/soispha/conf/nvim/plgs/debugprint/lua/debugprint.lua index 2ea38df4..da7e1735 100644 --- a/hm/soispha/conf/nvim/plgs/debugprint/lua/debugprint.lua +++ b/hm/soispha/conf/nvim/plgs/debugprint/lua/debugprint.lua @@ -1,4 +1,3 @@ require("debugprint").setup({ - create_keymaps = false; + create_keymaps = false, }) - diff --git a/hm/soispha/conf/nvim/plgs/femaco/lua/femaco.lua b/hm/soispha/conf/nvim/plgs/femaco/lua/femaco.lua index 10064b5e..da3be8e1 100644 --- a/hm/soispha/conf/nvim/plgs/femaco/lua/femaco.lua +++ b/hm/soispha/conf/nvim/plgs/femaco/lua/femaco.lua @@ -1,4 +1,4 @@ -local clip_val = require('femaco.utils').clip_val +local clip_val = require("femaco.utils").clip_val require("femaco").setup({ -- should prepare a new buffer and return the winid -- by default opens a floating window @@ -7,7 +7,7 @@ require("femaco").setup({ prepare_buffer = function(opts) local buf = vim.api.nvim_create_buf(false, false) return vim.api.nvim_open_win(buf, true, opts) - end; + end, -- should return options passed to nvim_open_win -- @param code_block: data about the code-block with the keys -- * range @@ -15,30 +15,30 @@ require("femaco").setup({ -- * lang float_opts = function(code_block) return { - relative = "cursor"; - width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10); -- TODO: how to offset sign column etc? - height = clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6); - anchor = "NW"; - row = 0; - col = 0; - style = "minimal"; - border = "rounded"; - zindex = 1; + relative = "cursor", + width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10), -- TODO: how to offset sign column etc? + height = clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6), + anchor = "NW", + row = 0, + col = 0, + style = "minimal", + border = "rounded", + zindex = 1, } - end; + end, -- return filetype to use for a given lang -- lang can be nil ft_from_lang = function(lang) return lang - end; + end, -- what to do after opening the float post_open_float = function(winnr) vim.wo.signcolumn = "no" - end; + end, -- create the path to a temporary file create_tmp_filepath = function(filetype) return os.tmpname() - end; + end, -- if a newline should always be used, useful for multiline injections -- which separators needs to be on separate lines such as markdown, neorg etc -- @param base_filetype: The filetype which FeMaco is called from, not the @@ -46,5 +46,5 @@ require("femaco").setup({ -- get it from vim.bo.filetyp). ensure_newline = function(base_filetype) return false - end; + end, }) diff --git a/hm/soispha/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua b/hm/soispha/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua index 8db7d293..42ea1eb6 100644 --- a/hm/soispha/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua +++ b/hm/soispha/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua @@ -21,16 +21,16 @@ require("flatten").setup({ ---Called to determine if a nested session should wait for the host to close the file. ---param argv: a list of all the arguments in the nested session ---@type fun(argv: table): boolean - should_block = require("flatten").default_should_block; + should_block = require("flatten").default_should_block, ---If this returns true, the nested session will be opened. ---If false, default behavior is used, and ---config.nest_if_no_args is respected. ---@type fun(host: channel):boolean - should_nest = require("flatten").default_should_nest; + should_nest = require("flatten").default_should_nest, ---Called before a nested session is opened. - pre_open = function() end; + pre_open = function() end, ---Called after a nested session is opened. ---@param bufnr buffer @@ -42,27 +42,27 @@ require("flatten").setup({ -- If the file is a git commit, create one-shot autocmd to delete its buffer on write if filetype == "gitcommit" or filetype == "gitrebase" then vim.api.nvim_create_autocmd("BufWritePost", { - buffer = bufnr; - once = true; + buffer = bufnr, + once = true, callback = vim.schedule_wrap(function() vim.api.nvim_buf_delete(bufnr, {}) - end); + end), }) end - end; + end, ---Called when a nested session is done waiting for the host. ---@param filetype string - block_end = function(filetype) end; - }; + block_end = function(filetype) end, + }, -- <String, Bool> dictionary of filetypes that should be blocking block_for = { - gitcommit = true; - }; + gitcommit = true, + }, -- Command passthrough - allow_cmd_passthrough = true; + allow_cmd_passthrough = true, -- Allow a nested session to open if Neovim is opened without arguments - nest_if_no_args = false; + nest_if_no_args = false, -- Window options window = { -- Options: @@ -75,7 +75,7 @@ require("flatten").setup({ -- OpenHandler -> allows you to handle file opening yourself (see Types) -- -- TODO: Open gitcommit filetypes in the current buffer, everything else in a new tab <2023-08-29> - open = "split"; + open = "split", -- Options: -- vsplit -> opens files in diff vsplits @@ -83,24 +83,24 @@ require("flatten").setup({ -- tab_vsplit -> creates a new tabpage, and opens diff vsplits -- tab_split -> creates a new tabpage, and opens diff splits -- OpenHandler -> allows you to handle file opening yourself (see Types) - diff = "tab_vsplit"; + diff = "tab_vsplit", -- Affects which file gets focused when opening multiple at once -- Options: -- "first" -> open first file of new files (default) -- "last" -> open last file of new files - focus = "first"; - }; + focus = "first", + }, -- Override this function to use a different socket to connect to the host -- On the host side this can return nil or the socket address. -- On the guest side this should return the socket address -- or a non-zero channel id from `sockconnect` -- flatten.nvim will detect if the address refers to this instance of nvim, to determine if this is a host or a guest - pipe_path = require"flatten".default_pipe_path; + pipe_path = require("flatten").default_pipe_path, -- The `default_pipe_path` will treat the first nvim instance within a single kitty/wezterm session as the host -- You can configure this behaviour using the following: one_per = { - kitty = true; -- Flatten all instance in the current Kitty session - wezterm = true; -- Flatten all instance in the current Wezterm session - }; + kitty = true, -- Flatten all instance in the current Kitty session + wezterm = true, -- Flatten all instance in the current Wezterm session + }, }) diff --git a/hm/soispha/conf/nvim/plgs/goto-preview/lua/goto-preview.lua b/hm/soispha/conf/nvim/plgs/goto-preview/lua/goto-preview.lua index cde50d3e..9687a5a0 100644 --- a/hm/soispha/conf/nvim/plgs/goto-preview/lua/goto-preview.lua +++ b/hm/soispha/conf/nvim/plgs/goto-preview/lua/goto-preview.lua @@ -1,21 +1,21 @@ require("goto-preview").setup({ - width = 120; -- Width of the floating window - height = 15; -- Height of the floating window - border = { "↖"; "─"; "┐"; "│"; "┘"; "─"; "└"; "│"; }; -- Border characters of the floating window - default_mappings = false; -- Bind default mappings - debug = false; -- Print debug information - opacity = nil; -- 0-100 opacity level of the floating window where 100 is fully transparent. - resizing_mappings = false; -- Binds arrow keys to resizing the floating window. - post_open_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook. - post_close_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook. + width = 120, -- Width of the floating window + height = 15, -- Height of the floating window + border = { "↖", "─", "┐", "│", "┘", "─", "└", "│" }, -- Border characters of the floating window + default_mappings = false, -- Bind default mappings + debug = false, -- Print debug information + opacity = nil, -- 0-100 opacity level of the floating window where 100 is fully transparent. + resizing_mappings = false, -- Binds arrow keys to resizing the floating window. + post_open_hook = nil, -- A function taking two arguments, a buffer and a window to be ran as a hook. + post_close_hook = nil, -- A function taking two arguments, a buffer and a window to be ran as a hook. references = { -- Configure the telescope UI for slowing the references cycling window. - telescope = {}; -- require("telescope.themes").get_dropdown({ hide_preview = false }) - }; + telescope = {}, -- require("telescope.themes").get_dropdown({ hide_preview = false }) + }, -- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality. - focus_on_open = true; -- Focus the floating window when opening it. - dismiss_on_move = false; -- Dismiss the floating window when moving the cursor. - force_close = true; -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close - bufhidden = "wipe"; -- the bufhidden option to set on the floating window. See :h bufhidden - stack_floating_preview_windows = true; -- Whether to nest floating windows - preview_window_title = { enable = true; position = "left"; }; -- Whether to set the preview window title as the filename + focus_on_open = true, -- Focus the floating window when opening it. + dismiss_on_move = false, -- Dismiss the floating window when moving the cursor. + force_close = true, -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close + bufhidden = "wipe", -- the bufhidden option to set on the floating window. See :h bufhidden + stack_floating_preview_windows = true, -- Whether to nest floating windows + preview_window_title = { enable = true, position = "left" }, -- Whether to set the preview window title as the filename }) diff --git a/hm/soispha/conf/nvim/plgs/lf-nvim/lua/lf-nvim.lua b/hm/soispha/conf/nvim/plgs/lf-nvim/lua/lf-nvim.lua index 8a0cf817..1eadf375 100644 --- a/hm/soispha/conf/nvim/plgs/lf-nvim/lua/lf-nvim.lua +++ b/hm/soispha/conf/nvim/plgs/lf-nvim/lua/lf-nvim.lua @@ -2,42 +2,42 @@ local fn = vim.fn -- Defaults require("lf").setup({ - default_action = "drop"; -- default action when `Lf` opens a file + default_action = "drop", -- default action when `Lf` opens a file -- TODO: what do these mappings do? - default_actions = { -- default action keybindings - ["<C-t>"] = "tabedit"; - ["<C-x>"] = "split"; - ["<C-v>"] = "vsplit"; - ["<C-o>"] = "tab drop"; - }; + default_actions = { -- default action keybindings + ["<C-t>"] = "tabedit", + ["<C-x>"] = "split", + ["<C-v>"] = "vsplit", + ["<C-o>"] = "tab drop", + }, - winblend = 10; -- psuedotransparency level - dir = ""; -- directory where `lf` starts ('gwd' is git-working-directory, ""/nil is CWD) - direction = "float"; -- window type: float horizontal vertical - border = "rounded"; -- border kind: single double shadow curved - height = fn.float2nr(fn.round(0.75 * vim.o.lines)); -- height of the *floating* window - width = fn.float2nr(fn.round(0.75 * vim.o.columns)); -- width of the *floating* window - escape_quit = true; -- map escape to the quit command (so it doesn't go into a meta normal mode) - focus_on_open = true; -- focus the current file when opening Lf (experimental) - mappings = true; -- whether terminal buffer mapping is enabled - tmux = false; -- tmux statusline can be disabled on opening of Lf - default_file_manager = true; -- make lf default file manager - disable_netrw_warning = true; -- don't display a message when opening a directory with `default_file_manager` as true - highlights = { -- highlights passed to toggleterm - Normal = { link = "Normal"; }; - NormalFloat = { link = "Normal"; }; - FloatBorder = { guifg = "#cdcbe0"; guibg = "#191726"; }; - }; + winblend = 10, -- psuedotransparency level + dir = "", -- directory where `lf` starts ('gwd' is git-working-directory, ""/nil is CWD) + direction = "float", -- window type: float horizontal vertical + border = "rounded", -- border kind: single double shadow curved + height = fn.float2nr(fn.round(0.75 * vim.o.lines)), -- height of the *floating* window + width = fn.float2nr(fn.round(0.75 * vim.o.columns)), -- width of the *floating* window + escape_quit = true, -- map escape to the quit command (so it doesn't go into a meta normal mode) + focus_on_open = true, -- focus the current file when opening Lf (experimental) + mappings = true, -- whether terminal buffer mapping is enabled + tmux = false, -- tmux statusline can be disabled on opening of Lf + default_file_manager = true, -- make lf default file manager + disable_netrw_warning = true, -- don't display a message when opening a directory with `default_file_manager` as true + highlights = { -- highlights passed to toggleterm + Normal = { link = "Normal" }, + NormalFloat = { link = "Normal" }, + FloatBorder = { guifg = "#cdcbe0", guibg = "#191726" }, + }, -- Layout configurations - layout_mapping = "<M-u>"; -- resize window with this key - views = { -- window dimensions to rotate through - { width = 0.800; height = 0.800; }; - { width = 0.600; height = 0.600; }; - { width = 0.950; height = 0.950; }; - { width = 0.500; height = 0.500; col = 0; row = 0; }; - { width = 0.500; height = 0.500; col = 0; row = 0.5; }; - { width = 0.500; height = 0.500; col = 0.5; row = 0; }; - { width = 0.500; height = 0.500; col = 0.5; row = 0.5; }; - }; + layout_mapping = "<M-u>", -- resize window with this key + views = { -- window dimensions to rotate through + { width = 0.800, height = 0.800 }, + { width = 0.600, height = 0.600 }, + { width = 0.950, height = 0.950 }, + { width = 0.500, height = 0.500, col = 0, row = 0 }, + { width = 0.500, height = 0.500, col = 0, row = 0.5 }, + { width = 0.500, height = 0.500, col = 0.5, row = 0 }, + { width = 0.500, height = 0.500, col = 0.5, row = 0.5 }, + }, }) diff --git a/hm/soispha/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua b/hm/soispha/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua index 4273085c..efb15720 100644 --- a/hm/soispha/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua +++ b/hm/soispha/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua @@ -3,12 +3,12 @@ require("lsp-progress").setup({ -- Spinning icons. -- --- @type string[] - spinner = { "⣾"; "⣽"; "⣻"; "⢿"; "⡿"; "⣟"; "⣯"; "⣷"; }; + spinner = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }, -- Spinning update time in milliseconds. -- --- @type integer - spin_update_time = 200; + spin_update_time = 200, -- Last message cached decay time in milliseconds. -- @@ -17,12 +17,12 @@ require("lsp-progress").setup({ -- for a while for user view. -- --- @type integer - decay = 700; + decay = 700, -- User event name. -- --- @type string - event = "LspProgressStatusUpdated"; + event = "LspProgressStatusUpdated", -- Event update time limit in milliseconds. -- @@ -31,12 +31,12 @@ require("lsp-progress").setup({ -- event rate to reduce this cost. -- --- @type integer - event_update_time_limit = 100; + event_update_time_limit = 100, -- Max progress string length, by default -1 is unlimited. -- --- @type integer - max_size = -1; + max_size = -1, -- Regular internal update time. -- @@ -44,7 +44,7 @@ require("lsp-progress").setup({ -- message. -- --- @type integer - regular_internal_update_time = 500; + regular_internal_update_time = 500, -- Disable emitting events on specific mode/filetype. -- User events would interrupt insert mode, thus break which-key like plugins behaviour. @@ -53,7 +53,7 @@ require("lsp-progress").setup({ -- * https://neovim.io/doc/user/builtin.html#mode() -- --- @type table[] - disable_events_opts = { { mode = "i"; filetype = "TelescopePrompt"; }; }; + disable_events_opts = { { mode = "i", filetype = "TelescopePrompt" } }, -- Format series message. -- @@ -89,7 +89,7 @@ require("lsp-progress").setup({ table.insert(builder, "- done") end return table.concat(builder, " ") - end; + end, -- Format client message. -- @@ -107,9 +107,9 @@ require("lsp-progress").setup({ --- `client_messages` array, or ignored if return nil. client_format = function(client_name, spinner, series_messages) return #series_messages > 0 - and ("[" .. client_name .. "] " .. spinner .. " " .. table.concat(series_messages, ", ")) + and ("[" .. client_name .. "] " .. spinner .. " " .. table.concat(series_messages, ", ")) or nil - end; + end, -- Format (final) message. -- @@ -123,22 +123,22 @@ require("lsp-progress").setup({ format = function(client_messages) local sign = " LSP" -- nf-fa-gear \uf013 return #client_messages > 0 and (sign .. " " .. table.concat(client_messages, " ")) or sign - end; + end, -- Enable debug. -- --- @type boolean - debug = false; + debug = false, -- Print log to console(command line). -- --- @type boolean - console_log = false; + console_log = false, -- Print log to file. -- --- @type boolean - file_log = true; + file_log = true, -- Log file to write, work with `file_log=true`. -- @@ -146,5 +146,5 @@ require("lsp-progress").setup({ -- For *NIX: `~/.local/share/nvim/lsp-progress.log`. -- --- @type string - file_log_name = "lsp-progress.log"; + file_log_name = "lsp-progress.log", }) diff --git a/hm/soispha/conf/nvim/plgs/ltex_extra/lua/ltex_extra.lua b/hm/soispha/conf/nvim/plgs/ltex_extra/lua/ltex_extra.lua index 9bcfd33c..f55a9ba7 100644 --- a/hm/soispha/conf/nvim/plgs/ltex_extra/lua/ltex_extra.lua +++ b/hm/soispha/conf/nvim/plgs/ltex_extra/lua/ltex_extra.lua @@ -1,16 +1,16 @@ require("ltex_extra").setup({ -- table <string> : languages for witch dictionaries will be loaded, e.g. { "es-AR", "en-US" } -- https://valentjn.github.io/ltex/supported-languages.html#natural-languages - load_langs = {"en-CA", "de-DE"}; -- en-US as default + load_langs = { "en-CA", "de-DE" }, -- en-US as default -- boolean : whether to load dictionaries on startup - init_check = true; + init_check = true, -- string : relative or absolute path to store dictionaries -- e.g. subfolder in the project root or the current working directory: ".ltex" -- e.g. shared files for all projects: vim.fn.expand("~") .. "/.local/share/ltex" - path = vim.fn.expand("~") .. "/.local/state/nvim/ltex"; -- project root or current working directory + path = vim.fn.expand("~") .. "/.local/state/nvim/ltex", -- project root or current working directory -- string : "none", "trace", "debug", "info", "warn", "error", "fatal" - log_level = "warn"; + log_level = "warn", -- table : configurations of the ltex language server. -- Only if you are calling the server from ltex_extra - server_opts = nil; + server_opts = nil, }) diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/luasnip.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/luasnip.lua index 0a603692..a05fa57f 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/luasnip.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/luasnip.lua @@ -1,7 +1,7 @@ require("luasnip").config.set_config({ -- Enable auto triggered snippets - enable_autosnippets = true; + enable_autosnippets = true, -- Use Tab (or some other key if you prefer) to trigger visual selection - store_selection_keys = "<Tab>"; + store_selection_keys = "<Tab>", }) diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/all.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/all.lua index c98ee7d2..c3f75058 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/all.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/all.lua @@ -1,4 +1,4 @@ -local ls = require("luasnip"); +local ls = require("luasnip") -- auto_pairs {{{ local get_visual = function(args, parent) if #parent.snippet.env.SELECT_RAW > 0 then @@ -29,31 +29,31 @@ local function pair(pair_begin, pair_end, file_types, condition_function) -- file_types = file_types or {}; return s( - { trig = pair_begin; wordTrig = false; snippetType = "autosnippet"; }, - { t({ pair_begin; }); d(1, get_visual); t({ pair_end; }); }, + { trig = pair_begin, wordTrig = false, snippetType = "autosnippet" }, + { t({ pair_begin }), d(1, get_visual), t({ pair_end }) }, { condition = function() - local filetype_check = true; + local filetype_check = true if file_types ~= nil then - filetype_check = file_types[vim.bo.filetype] or false; - end; + filetype_check = file_types[vim.bo.filetype] or false + end return (not condition_function(pair_begin, pair_end)) and filetype_check - end; + end, } ) end local auto_pairs = { - pair("(", ")", nil, char_count_same); - pair("{", "}", nil, char_count_same); - pair("[", "]", nil, char_count_same); - pair("<", ">", { ["rust"] = true; ["tex"] = true; }, char_count_same); - pair("'", "'", nil, even_count); - pair('"', '"', nil, even_count); - pair("`", "`", nil, even_count); + pair("(", ")", nil, char_count_same), + pair("{", "}", nil, char_count_same), + pair("[", "]", nil, char_count_same), + pair("<", ">", { ["rust"] = true, ["tex"] = true }, char_count_same), + pair("'", "'", nil, even_count), + pair('"', '"', nil, even_count), + pair("`", "`", nil, even_count), } -ls.add_snippets("all", auto_pairs, { type = "snippets"; key = "auto_pairs"; }) +ls.add_snippets("all", auto_pairs, { type = "snippets", key = "auto_pairs" }) -- }}} -- todo_comments {{{ @@ -65,34 +65,33 @@ local utils = require("Comment.utils") ---@return table comment_strings {begcstring, endcstring} local get_cstring = function(ctype) -- use the `Comments.nvim` API to fetch the comment string for the region (eq. '--%s' or '--[[%s]]' for `lua`) - local cstring = calculate_comment_string{ ctype = ctype; range = utils.get_region(); } or vim.bo.commentstring + local cstring = calculate_comment_string({ ctype = ctype, range = utils.get_region() }) or vim.bo.commentstring -- as we want only the strings themselves and not strings ready for using `format` we want to split the left and right side local left, right = utils.unwrap_cstr(cstring) -- create a `{left, right}` table for it - return { left; right; } + return { left, right } end _G.luasnip = {} _G.luasnip.vars = { - username = "@soispha"; - email = "soispha@vhack.eu"; + username = "@soispha", + email = "soispha@vhack.eu", } - --- Options for marks to be used in a TODO comment ---@return table,table: The first table contains a node for the date, the second for the signature local marks = { signature = function() return t("(" .. _G.luasnip.vars.username .. ")"), t("") - end; + end, date_signature = function() - return t("<" .. os.date"%Y-%m-%d" .. ">"), t("(" .. _G.luasnip.vars.username .. ")") - end; + return t("<" .. os.date("%Y-%m-%d") .. ">"), t("(" .. _G.luasnip.vars.username .. ")") + end, date = function() - return t("<" .. os.date"%Y-%m-%d" .. ">"), t("") - end; + return t("<" .. os.date("%Y-%m-%d") .. ">"), t("") + end, empty = function() return t(""), t("") - end; + end, } ---@param alias string @@ -100,19 +99,19 @@ local marks = { ---@param mark_function function: This function should return two nodes ---@return table: Returns the comment node local todo_snippet_nodes = function(alias, opts, mark_function) - local date_node, signature_node = mark_function(); + local date_node, signature_node = mark_function() -- format them into the actual snippet local comment_node = fmta("<> <><>: <> <> <>", { f(function() return get_cstring(opts.ctype)[1] -- get <comment-string[1]> - end); - t(alias); -- [name-of-comment] - signature_node; - i(0); -- {comment-text} - date_node; + end), + t(alias), -- [name-of-comment] + signature_node, + i(0), -- {comment-text} + date_node, f(function() return get_cstring(opts.ctype)[2] -- get <comment-string[2]> - end); + end), }) return comment_node end @@ -128,17 +127,13 @@ local todo_snippet = function(context, alias, opts, mark_function) if not context.trig then return error("context doesn't include a `trig` key which is mandatory", 2) -- all we need from the context is the trigger end - opts.ctype = opts.ctype or - 1 -- comment type can be passed in the `opts` table, but if it is not, we have to ensure, it is defined - local alias_string = alias -- `choice_node` documentation - context.name = context.name or - (alias_string .. " comment") -- generate the `name` of the snippet if not defined - context.dscr = context.dscr or - (alias_string .. " comment with a signature-mark") -- generate the `dscr` if not defined - context.docstring = context.docstring or - (" {1:" .. alias_string .. "}: {3} <{2:mark}>{0} ") -- generate the `docstring` if not defined + opts.ctype = opts.ctype or 1 -- comment type can be passed in the `opts` table, but if it is not, we have to ensure, it is defined + local alias_string = alias -- `choice_node` documentation + context.name = context.name or (alias_string .. " comment") -- generate the `name` of the snippet if not defined + context.dscr = context.dscr or (alias_string .. " comment with a signature-mark") -- generate the `dscr` if not defined + context.docstring = context.docstring or (" {1:" .. alias_string .. "}: {3} <{2:mark}>{0} ") -- generate the `docstring` if not defined local comment_node = todo_snippet_nodes(alias, opts, mark_function) - return s(context, comment_node, opts) -- the final todo-snippet constructed from our parameters + return s(context, comment_node, opts) -- the final todo-snippet constructed from our parameters end ---@param context table: The luasnip context @@ -147,39 +142,41 @@ end ---@param marks table: Possible marks to account in snipped generation ---@return table: All possible snippets build from the marks local process_marks = function(context, aliases, opts, marks) - local output = {}; + local output = {} for mark_name, mark_function in pairs(marks) do - local contex_trig_local = context.trig; - context.trig = context.trig .. "-" .. mark_name; - output[#output + 1] = todo_snippet(context, aliases, opts, mark_function); - context.trig = contex_trig_local; + local contex_trig_local = context.trig + context.trig = context.trig .. "-" .. mark_name + output[#output + 1] = todo_snippet(context, aliases, opts, mark_function) + context.trig = contex_trig_local end - return output; + return output end local todo_snippet_specs = { - { { trig = "todo"; }; { "TODO"; }; { ctype = 1; }; }; - { { trig = "fix"; }; { "FIXME"; "ISSUE"; }; { ctype = 1; }; }; - { { trig = "hack"; }; { "HACK"; }; { ctype = 1; }; }; - { { trig = "warn"; }; { "WARNING"; }; { ctype = 1; }; }; - { { trig = "perf"; }; { "PERFORMANCE"; "OPTIMIZE"; }; { ctype = 1; }; }; - { { trig = "note"; }; { "NOTE"; "INFO"; }; { ctype = 1; }; }; + { { trig = "todo" }, { "TODO" }, { ctype = 1 } }, + { { trig = "fix" }, { "FIXME", "ISSUE" }, { ctype = 1 } }, + { { trig = "hack" }, { "HACK" }, { ctype = 1 } }, + { { trig = "warn" }, { "WARNING" }, { ctype = 1 } }, + { { trig = "perf" }, { "PERFORMANCE", "OPTIMIZE" }, { ctype = 1 } }, + { { trig = "note" }, { "NOTE", "INFO" }, { ctype = 1 } }, -- NOTE: Block commented todo-comments - { { trig = "todob"; }; { "TODO"; }; { ctype = 2; }; }; - { { trig = "fixb"; }; { "FIXME"; "ISSUE"; }; { ctype = 2; }; }; - { { trig = "hackb"; }; { "HACK"; }; { ctype = 2; }; }; - { { trig = "warnb"; }; { "WARNING"; }; { ctype = 2; }; }; - { { trig = "perfb"; }; { "PERF"; "PERFORMANCE"; "OPTIM"; "OPTIMIZE"; }; { ctype = 2; }; }; - { { trig = "noteb"; }; { "NOTE"; "INFO"; }; { ctype = 2; }; }; + { { trig = "todob" }, { "TODO" }, { ctype = 2 } }, + { { trig = "fixb" }, { "FIXME", "ISSUE" }, { ctype = 2 } }, + { { trig = "hackb" }, { "HACK" }, { ctype = 2 } }, + { { trig = "warnb" }, { "WARNING" }, { ctype = 2 } }, + { { trig = "perfb" }, { "PERF", "PERFORMANCE", "OPTIM", "OPTIMIZE" }, { ctype = 2 } }, + { { trig = "noteb" }, { "NOTE", "INFO" }, { ctype = 2 } }, } local todo_comment_snippets = {} for _, v in ipairs(todo_snippet_specs) do local snippets = process_marks(v[1], v[2][1], v[3], marks) - for _, value in pairs(snippets) do table.insert(todo_comment_snippets, value) end + for _, value in pairs(snippets) do + table.insert(todo_comment_snippets, value) + end end -ls.add_snippets("all", todo_comment_snippets, { type = "snippets"; key = "todo_comments"; }) +ls.add_snippets("all", todo_comment_snippets, { type = "snippets", key = "todo_comments" }) -- }}} diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua index c467dd68..17e1e7fb 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua @@ -12,10 +12,10 @@ return { -- HEADER s( { - trig = "h([123456])"; - regTrig = true; - wordTrig = false; - snippetType = "autosnippet"; + trig = "h([123456])", + regTrig = true, + wordTrig = false, + snippetType = "autosnippet", }, fmt( [[ @@ -24,50 +24,50 @@ return { { f(function(_, snip) return snip.captures[1] - end); - d(1, get_visual); + end), + d(1, get_visual), f(function(_, snip) return snip.captures[1] - end); + end), } ), - { condition = line_begin; } - ); -- PARAGRAPH + { condition = line_begin } + ), -- PARAGRAPH s( - { trig = "pp"; snippetType = "autosnippet"; }, + { trig = "pp", snippetType = "autosnippet" }, fmt( [[ <p>{}</p> ]], - { d(1, get_visual); } + { d(1, get_visual) } ), - { condition = line_begin; } - ); -- UNORDERED LIST + { condition = line_begin } + ), -- UNORDERED LIST s( - { trig = "itt"; snippetType = "autosnippet"; }, + { trig = "itt", snippetType = "autosnippet" }, fmt( [[ <ul> <li>{}</li>{} </ul> ]], - { i(1); i(0); } + { i(1), i(0) } ), - { condition = line_begin; } - ); -- LIST ITEM + { condition = line_begin } + ), -- LIST ITEM s( - { trig = "ii"; snippetType = "autosnippet"; }, + { trig = "ii", snippetType = "autosnippet" }, fmt( [[ <li>{}</li> ]], - { d(1, get_visual); } + { d(1, get_visual) } ), - { condition = line_begin; } - ); + { condition = line_begin } + ), -- DOCUMENT TEMPLATE s( - { trig = "base"; }, + { trig = "base" }, fmt( [[ <!doctype HTML> @@ -81,16 +81,16 @@ return { </body> </html> ]], - { i(1, "FooBar"); i(0); } + { i(1, "FooBar"), i(0) } ), - { condition = line_begin; } - ); -- ANCHOR TAG + { condition = line_begin } + ), -- ANCHOR TAG s( { - trig = "([^%l])aa"; - regTrig = true; - wordTrig = false; - snippetType = "autosnippet"; + trig = "([^%l])aa", + regTrig = true, + wordTrig = false, + snippetType = "autosnippet", }, fmt( [[ @@ -99,10 +99,10 @@ return { { f(function(_, snip) return snip.captures[1] - end); - i(1); - d(2, get_visual); + end), + i(1), + d(2, get_visual), } ) - ); + ), } diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua index e50898fc..22434aa3 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua @@ -6,29 +6,29 @@ local get_visual = function(args, parent) end end -local translation_table = { ["("] = ")"; ["{"] = "}"; ["["] = "]"; } +local translation_table = { ["("] = ")", ["{"] = "}", ["["] = "]" } -- Return snippet tables return { -- LEFT/RIGHT ALL BRACES s( { - trig = "([^%a])l([%(%[%{])"; - regTrig = true; - wordTrig = false; - snippetType = "autosnippet"; + trig = "([^%a])l([%(%[%{])", + regTrig = true, + wordTrig = false, + snippetType = "autosnippet", }, fmta("<>\\left<><>\\right<>", { f(function(_, snip) return snip.captures[1] - end); + end), f(function(_, snip) return snip.captures[2] - end); - d(1, get_visual); + end), + d(1, get_visual), f(function(_, snip) return translation_table[snip.captures[2]] - end); + end), }) - ); + ), } diff --git a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/greek.lua b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/greek.lua index 19989093..ebf4f9d7 100644 --- a/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/greek.lua +++ b/hm/soispha/conf/nvim/plgs/luasnip/lua/snippets/tex/greek.lua @@ -1,37 +1,37 @@ -- Return snippet tables return { - s({ trig = ";a"; snippetType = "autosnippet"; }, { t("\\alpha"); }); - s({ trig = ";b"; snippetType = "autosnippet"; }, { t("\\beta"); }); - s({ trig = ";g"; snippetType = "autosnippet"; }, { t("\\gamma"); }); - s({ trig = ";G"; snippetType = "autosnippet"; }, { t("\\Gamma"); }); - s({ trig = ";d"; snippetType = "autosnippet"; }, { t("\\delta"); }); - s({ trig = ";D"; snippetType = "autosnippet"; }, { t("\\Delta"); }); - s({ trig = ";e"; snippetType = "autosnippet"; }, { t("\\epsilon"); }); - s({ trig = ";ve"; snippetType = "autosnippet"; }, { t("\\varepsilon"); }); - s({ trig = ";z"; snippetType = "autosnippet"; }, { t("\\zeta"); }); - s({ trig = ";h"; snippetType = "autosnippet"; }, { t("\\eta"); }); - s({ trig = ";o"; snippetType = "autosnippet"; }, { t("\\theta"); }); - s({ trig = ";vo"; snippetType = "autosnippet"; }, { t("\\vartheta"); }); - s({ trig = ";O"; snippetType = "autosnippet"; }, { t("\\Theta"); }); - s({ trig = ";k"; snippetType = "autosnippet"; }, { t("\\kappa"); }); - s({ trig = ";l"; snippetType = "autosnippet"; }, { t("\\lambda"); }); - s({ trig = ";L"; snippetType = "autosnippet"; }, { t("\\Lambda"); }); - s({ trig = ";m"; snippetType = "autosnippet"; }, { t("\\mu"); }); - s({ trig = ";n"; snippetType = "autosnippet"; }, { t("\\nu"); }); - s({ trig = ";x"; snippetType = "autosnippet"; }, { t("\\xi"); }); - s({ trig = ";X"; snippetType = "autosnippet"; }, { t("\\Xi"); }); - s({ trig = ";i"; snippetType = "autosnippet"; }, { t("\\pi"); }); - s({ trig = ";I"; snippetType = "autosnippet"; }, { t("\\Pi"); }); - s({ trig = ";r"; snippetType = "autosnippet"; }, { t("\\rho"); }); - s({ trig = ";s"; snippetType = "autosnippet"; }, { t("\\sigma"); }); - s({ trig = ";S"; snippetType = "autosnippet"; }, { t("\\Sigma"); }); - s({ trig = ";t"; snippetType = "autosnippet"; }, { t("\\tau"); }); - s({ trig = ";f"; snippetType = "autosnippet"; }, { t("\\phi"); }); - s({ trig = ";vf"; snippetType = "autosnippet"; }, { t("\\varphi"); }); - s({ trig = ";F"; snippetType = "autosnippet"; }, { t("\\Phi"); }); - s({ trig = ";c"; snippetType = "autosnippet"; }, { t("\\chi"); }); - s({ trig = ";p"; snippetType = "autosnippet"; }, { t("\\psi"); }); - s({ trig = ";P"; snippetType = "autosnippet"; }, { t("\\Psi"); }); - s({ trig = ";w"; snippetType = "autosnippet"; }, { t("\\omega"); }); - s({ trig = ";W"; snippetType = "autosnippet"; }, { t("\\Omega"); }); + s({ trig = ";a", snippetType = "autosnippet" }, { t("\\alpha") }), + s({ trig = ";b", snippetType = "autosnippet" }, { t("\\beta") }), + s({ trig = ";g", snippetType = "autosnippet" }, { t("\\gamma") }), + s({ trig = ";G", snippetType = "autosnippet" }, { t("\\Gamma") }), + s({ trig = ";d", snippetType = "autosnippet" }, { t("\\delta") }), + s({ trig = ";D", snippetType = "autosnippet" }, { t("\\Delta") }), + s({ trig = ";e", snippetType = "autosnippet" }, { t("\\epsilon") }), + s({ trig = ";ve", snippetType = "autosnippet" }, { t("\\varepsilon") }), + s({ trig = ";z", snippetType = "autosnippet" }, { t("\\zeta") }), + s({ trig = ";h", snippetType = "autosnippet" }, { t("\\eta") }), + s({ trig = ";o", snippetType = "autosnippet" }, { t("\\theta") }), + s({ trig = ";vo", snippetType = "autosnippet" }, { t("\\vartheta") }), + s({ trig = ";O", snippetType = "autosnippet" }, { t("\\Theta") }), + s({ trig = ";k", snippetType = "autosnippet" }, { t("\\kappa") }), + s({ trig = ";l", snippetType = "autosnippet" }, { t("\\lambda") }), + s({ trig = ";L", snippetType = "autosnippet" }, { t("\\Lambda") }), + s({ trig = ";m", snippetType = "autosnippet" }, { t("\\mu") }), + s({ trig = ";n", snippetType = "autosnippet" }, { t("\\nu") }), + s({ trig = ";x", snippetType = "autosnippet" }, { t("\\xi") }), + s({ trig = ";X", snippetType = "autosnippet" }, { t("\\Xi") }), + s({ trig = ";i", snippetType = "autosnippet" }, { t("\\pi") }), + s({ trig = ";I", snippetType = "autosnippet" }, { t("\\Pi") }), + s({ trig = ";r", snippetType = "autosnippet" }, { t("\\rho") }), + s({ trig = ";s", snippetType = "autosnippet" }, { t("\\sigma") }), + s({ trig = ";S", snippetType = "autosnippet" }, { t("\\Sigma") }), + s({ trig = ";t", snippetType = "autosnippet" }, { t("\\tau") }), + s({ trig = ";f", snippetType = "autosnippet" }, { t("\\phi") }), + s({ trig = ";vf", snippetType = "autosnippet" }, { t("\\varphi") }), + s({ trig = ";F", snippetType = "autosnippet" }, { t("\\Phi") }), + s({ trig = ";c", snippetType = "autosnippet" }, { t("\\chi") }), + s({ trig = ";p", snippetType = "autosnippet" }, { t("\\psi") }), + s({ trig = ";P", snippetType = "autosnippet" }, { t("\\Psi") }), + s({ trig = ";w", snippetType = "autosnippet" }, { t("\\omega") }), + s({ trig = ";W", snippetType = "autosnippet" }, { t("\\Omega") }), } diff --git a/hm/soispha/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua b/hm/soispha/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua index c6cd1420..4ed49f7b 100644 --- a/hm/soispha/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua +++ b/hm/soispha/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua @@ -1,6 +1,6 @@ require("lint").linters_by_ft = { -- text - markdown = {}; + markdown = {}, -- tex = {'chktex'}, -- maybe add some text linters ? -- shell (already covered by the bash language sever) @@ -9,12 +9,12 @@ require("lint").linters_by_ft = { -- zsh = { "shellcheck"; }; -- dash = { "shellcheck"; }; - yaml = { "yamllint"; }; - nix = { "nix"; "statix"; }; + yaml = { "yamllint" }, + nix = { "nix", "statix" }, } -vim.api.nvim_create_autocmd({ "BufEnter"; "BufWritePost"; }, { +vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, { callback = function() require("lint").try_lint() - end; + end, }) diff --git a/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua b/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua index eaf68ecf..7235c5a3 100644 --- a/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua +++ b/hm/soispha/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua @@ -11,7 +11,7 @@ if not has_plenary then return end -local log = plenary.log.new({ plugin = "telescope_rooter"; level = "info"; }) +local log = plenary.log.new({ plugin = "telescope_rooter", level = "info" }) -- TODO: expose this function local toggle = function(_) @@ -19,19 +19,19 @@ local toggle = function(_) print("Telescope#rooter#enabled=" .. vim.inspect(vim.g["Telescope#rooter#enabled"])) end -local config = { patterns = { ".git"; }; enable = true; debug = false; } +local config = { patterns = { ".git" }, enable = true, debug = false } -- default enabled vim.g["Telescope#rooter#enabled"] = vim.F.if_nil(config.enable, true) -- redefine log if debug enabled if vim.F.if_nil(config.debug, false) then - log = plenary.log.new({ plugin = "telescope_rooter"; level = "debug"; }) + log = plenary.log.new({ plugin = "telescope_rooter", level = "debug" }) end -local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true; }) +local group = vim.api.nvim_create_augroup("TelescopeRooter", { clear = true }) -vim.api.nvim_create_autocmd({ "DirChangedPre"; }, { +vim.api.nvim_create_autocmd({ "DirChangedPre" }, { callback = function() if vim.g["Telescope#rooter#enabled"] ~= true then return @@ -41,11 +41,11 @@ vim.api.nvim_create_autocmd({ "DirChangedPre"; }, { vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd() log.debug("before " .. vim.inspect(vim.loop.cwd())) end - end; - group = group; + end, + group = group, }) -vim.api.nvim_create_autocmd({ "BufEnter"; "BufWinEnter"; }, { +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { callback = function() if vim.g["Telescope#rooter#enabled"] ~= true then return @@ -53,18 +53,18 @@ vim.api.nvim_create_autocmd({ "BufEnter"; "BufWinEnter"; }, { vim.schedule(function() if vim.bo.filetype == "TelescopePrompt" then - local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true; })[1]) + local rootdir = vim.fs.dirname(vim.fs.find(config.patterns, { upward = true })[1]) if rootdir ~= nil then vim.api.nvim_set_current_dir(rootdir) log.debug("changing dir to " .. rootdir) end end end) - end; - group = group; + end, + group = group, }) -vim.api.nvim_create_autocmd({ "BufWinLeave"; }, { +vim.api.nvim_create_autocmd({ "BufWinLeave" }, { callback = function() if vim.g["Telescope#rooter#enabled"] ~= true then return @@ -79,6 +79,6 @@ vim.api.nvim_create_autocmd({ "BufWinLeave"; }, { end end end) - end; - group = group; + end, + group = group, }) |