diff options
author | Soispha <soispha@vhack.eu> | 2023-08-26 22:52:12 +0200 |
---|---|---|
committer | Soispha <soispha@vhack.eu> | 2023-08-26 22:56:09 +0200 |
commit | 4c743a2afb87994be4ff7c2dc76d21c70d31e4de (patch) | |
tree | 70922dd5db390641da012085bc674333b53d2ef1 | |
parent | Fix(hm/conf/neovim/plugins/colorscheme): Mk todo,fix,&c comments visible (diff) | |
download | nixos-config-4c743a2afb87994be4ff7c2dc76d21c70d31e4de.zip |
Style(treewide): Format all lua-files makes lua ➛ nix easier
The files were formatted according to the `.editorconfig` file and with the formatter from [this](1) repo, as it's the only one that fully understands all keys in the `.editorconfig` file. The formatting was chosen in this special (and honestly unconventional) way because moving code from lua to nix is now easier, as the syntax is nearly identical in some places.
14 files changed, 541 insertions, 663 deletions
diff --git a/home-manager/soispha/config/neovim/nixvim/files/ftplugin/tex.lua b/home-manager/soispha/config/neovim/nixvim/files/ftplugin/tex.lua index 6cc37c4c..8f39d7bb 100644 --- a/home-manager/soispha/config/neovim/nixvim/files/ftplugin/tex.lua +++ b/home-manager/soispha/config/neovim/nixvim/files/ftplugin/tex.lua @@ -18,70 +18,61 @@ -- ); -- -- - -- Set non-treesitter colorscheme require("gruvbox").setup({ - undercurl = true, - underline = true, - bold = true, - italic = { - strings = true, - comments = true, - operators = false, - folds = true, - }, - strikethrough = true, - invert_selection = false, - invert_signs = false, - invert_tabline = false, - invert_intend_guides = false, - inverse = true, -- invert background for search, diffs, statuslines and errors - contrast = "", -- can be "hard", "soft" or empty string - palette_overrides = {}, - overrides = {}, - dim_inactive = false, - transparent_mode = false, + undercurl = true; + underline = true; + bold = true; + italic = { strings = true; comments = true; operators = false; folds = true; }; + strikethrough = true; + invert_selection = false; + invert_signs = false; + invert_tabline = false; + invert_intend_guides = false; + inverse = true; -- invert background for search, diffs, statuslines and errors + contrast = ""; -- can be "hard", "soft" or empty string + palette_overrides = {}; + overrides = {}; + dim_inactive = false; + transparent_mode = false; }) vim.cmd("colorscheme gruvbox") -require('lualine').setup { - options = { - theme = 'gruvbox', - }, -} +require("lualine").setup({ options = { theme = "gruvbox"; }; }) -- Set tex specific telescope extension -require('telescope').setup { - extensions = { - bibtex = { - -- Depth for the *.bib file - depth = 1, - -- Path to global bibliographies (placed outside of the project) - global_files = {}, - -- Define the search keys to use in the picker - search_keys = { 'author', 'year', 'title' }, - -- Template for the formatted citation - citation_format = '{{author}} ({{year}}), {{title}}.', - -- Only use initials for the authors first name - 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, - -- Wrapping in the preview window is disabled by default - wrap = false, - -- Custom format for citation label - custom_formats = { - { id = 'tex_autocite', cite_marker = '\\autocite{%s}' } - }, - format = 'tex_autocite', - -- Use context awareness - context = true, - -- Fallback to global/directory .bib files if context not found - -- This setting has no effect if context = false - context_fallback = true, - }, - } -} -require('telescope').load_extension('bibtex') -vim.api.nvim_set_keymap("n", "<leader>ib", function() require('telescope').extensions.bibtex.bibtex() end, - { noremap = true, silent = true, desc = "list bibtex entries in telescope" }) +require("telescope").setup({ + extensions = { + bibtex = { + -- Depth for the *.bib file + depth = 1; + -- Path to global bibliographies (placed outside of the project) + global_files = {}; + -- Define the search keys to use in the picker + search_keys = { "author"; "year"; "title"; }; + -- Template for the formatted citation + citation_format = "{{author}} ({{year}}), {{title}}."; + -- Only use initials for the authors first name + 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; + -- Wrapping in the preview window is disabled by default + wrap = false; + -- Custom format for citation label + custom_formats = { + { id = "tex_autocite"; cite_marker = "\\autocite{%s}"; }; + }; + format = "tex_autocite"; + -- Use context awareness + context = true; + -- Fallback to global/directory .bib files if context not found + -- This setting has no effect if context = false + context_fallback = true; + }; + }; +}) +require("telescope").load_extension("bibtex") +vim.api.nvim_set_keymap("n", "<leader>ib", function() + require("telescope").extensions.bibtex.bibtex() + end, { noremap = true; silent = true; desc = "list bibtex entries in telescope"; }) diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/colorscheme/lua/mk_todos_readable.lua b/home-manager/soispha/config/neovim/nixvim/plugins/colorscheme/lua/mk_todos_readable.lua index 29f3004c..0145ec19 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/colorscheme/lua/mk_todos_readable.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/colorscheme/lua/mk_todos_readable.lua @@ -1,5 +1,5 @@ -local opts = { bg = 'NONE'; fg = 'fg' } -vim.api.nvim_set_hl(0, '@text.danger', opts) -vim.api.nvim_set_hl(0, '@text.note', opts) -vim.api.nvim_set_hl(0, '@text.todo', opts) -vim.api.nvim_set_hl(0, '@text.warning', opts) +local opts = { bg = "NONE"; fg = "fg"; } +vim.api.nvim_set_hl(0, "@text.danger", opts) +vim.api.nvim_set_hl(0, "@text.note", opts) +vim.api.nvim_set_hl(0, "@text.todo", opts) +vim.api.nvim_set_hl(0, "@text.warning", opts) diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/colorscheme/lua/nightfox.lua b/home-manager/soispha/config/neovim/nixvim/plugins/colorscheme/lua/nightfox.lua index b00626a2..025eb133 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/colorscheme/lua/nightfox.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/colorscheme/lua/nightfox.lua @@ -1,50 +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 - colorblind = { - 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", - }, - inverse = { -- Inverse highlight for different types - 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 = {}, +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 + colorblind = { + 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"; + }; + inverse = { -- Inverse highlight for different types + 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 = {}; }) diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/femaco/lua/femaco.lua b/home-manager/soispha/config/neovim/nixvim/plugins/femaco/lua/femaco.lua index 228b0aa6..12171793 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/femaco/lua/femaco.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/femaco/lua/femaco.lua @@ -1,4 +1,4 @@ -require('femaco').setup({ +require("femaco").setup({ -- should prepare a new buffer and return the winid -- by default opens a floating window -- provide a different callback to change this behaviour @@ -6,7 +6,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 @@ -14,30 +14,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, + vim.wo.signcolumn = "no" + 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 @@ -45,5 +45,5 @@ require('femaco').setup({ -- get it from vim.bo.filetyp). ensure_newline = function(base_filetype) return false - end, + end; }) diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/lua/goto-preview.lua b/home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/lua/goto-preview.lua index a3e55a5a..cde50d3e 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/goto-preview/lua/goto-preview.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/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. - references = { -- Configure the telescope UI for slowing the references cycling window. - 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 -} +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. + references = { -- Configure the telescope UI for slowing the references cycling window. + 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 +}) diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/lf-nvim/lua/lf-nvim.lua b/home-manager/soispha/config/neovim/nixvim/plugins/lf-nvim/lua/lf-nvim.lua index 60293b60..8a0cf817 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/lf-nvim/lua/lf-nvim.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/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 - -- 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_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"; + }; - 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 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; }; + }; }) diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/lsp-progress-nvim/lua/lsp-progress-nvim.lua b/home-manager/soispha/config/neovim/nixvim/plugins/lsp-progress-nvim/lua/lsp-progress-nvim.lua index 80c01e4a..4273085c 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/lsp-progress-nvim/lua/lsp-progress-nvim.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/lsp-progress-nvim/lua/lsp-progress-nvim.lua @@ -1,160 +1,150 @@ --- @type table<string, any> require("lsp-progress").setup({ - -- Spinning icons. - -- - --- @type string[] - spinner = { "⣾", "⣽", "⣻", "⢿", "⡿", "⣟", "⣯", "⣷" }, + -- Spinning icons. + -- + --- @type string[] + spinner = { "⣾"; "⣽"; "⣻"; "⢿"; "⡿"; "⣟"; "⣯"; "⣷"; }; - -- Spinning update time in milliseconds. - -- - --- @type integer - spin_update_time = 200, + -- Spinning update time in milliseconds. + -- + --- @type integer + spin_update_time = 200; - -- Last message cached decay time in milliseconds. - -- - -- Message could be really fast(appear and disappear in an - -- instant) that user cannot even see it, thus we cache the last message - -- for a while for user view. - -- - --- @type integer - decay = 700, + -- Last message cached decay time in milliseconds. + -- + -- Message could be really fast(appear and disappear in an + -- instant) that user cannot even see it, thus we cache the last message + -- for a while for user view. + -- + --- @type integer + decay = 700; - -- User event name. - -- - --- @type string - event = "LspProgressStatusUpdated", + -- User event name. + -- + --- @type string + event = "LspProgressStatusUpdated"; - -- Event update time limit in milliseconds. - -- - -- Sometimes progress handler could emit many events in an instant, while - -- refreshing statusline cause too heavy synchronized IO, so we limit the - -- event rate to reduce this cost. - -- - --- @type integer - event_update_time_limit = 100, + -- Event update time limit in milliseconds. + -- + -- Sometimes progress handler could emit many events in an instant, while + -- refreshing statusline cause too heavy synchronized IO, so we limit the + -- event rate to reduce this cost. + -- + --- @type integer + event_update_time_limit = 100; - -- Max progress string length, by default -1 is unlimited. - -- - --- @type integer - max_size = -1, + -- Max progress string length, by default -1 is unlimited. + -- + --- @type integer + max_size = -1; - -- Regular internal update time. - -- - -- Emit user event to update the lsp progress status, even there's no new - -- message. - -- - --- @type integer - regular_internal_update_time = 500, + -- Regular internal update time. + -- + -- Emit user event to update the lsp progress status, even there's no new + -- message. + -- + --- @type integer + 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. - -- See: - -- * https://github.com/linrongbin16/lsp-progress.nvim/issues/50 - -- * https://neovim.io/doc/user/builtin.html#mode() - -- - --- @type table[] - disable_events_opts = { - { - mode = "i", - filetype = "TelescopePrompt", - }, - }, + -- Disable emitting events on specific mode/filetype. + -- User events would interrupt insert mode, thus break which-key like plugins behaviour. + -- See: + -- * https://github.com/linrongbin16/lsp-progress.nvim/issues/50 + -- * https://neovim.io/doc/user/builtin.html#mode() + -- + --- @type table[] + disable_events_opts = { { mode = "i"; filetype = "TelescopePrompt"; }; }; - -- Format series message. - -- - -- By default it looks like: `formatting isort (100%) - done`. - -- - --- @param title string|nil - --- Message title. - --- @param message string|nil - --- Message body. - --- @param percentage number|nil - --- Progress in percentage numbers: 0-100. - --- @param done boolean - --- Indicate whether this series is the last one in progress. - --- @return string|nil messages - --- The returned value will be passed to function `client_format` as - --- one of the `series_messages` array, or ignored if return nil. - series_format = function(title, message, percentage, done) - local builder = {} - local has_title = false - local has_message = false - if title and title ~= "" then - table.insert(builder, title) - has_title = true - end - if message and message ~= "" then - table.insert(builder, message) - has_message = true - end - if percentage and (has_title or has_message) then - table.insert(builder, string.format("(%.0f%%%%)", percentage)) - end - if done and (has_title or has_message) then - table.insert(builder, "- done") - end - return table.concat(builder, " ") - end, + -- Format series message. + -- + -- By default it looks like: `formatting isort (100%) - done`. + -- + --- @param title string|nil + --- Message title. + --- @param message string|nil + --- Message body. + --- @param percentage number|nil + --- Progress in percentage numbers: 0-100. + --- @param done boolean + --- Indicate whether this series is the last one in progress. + --- @return string|nil messages + --- The returned value will be passed to function `client_format` as + --- one of the `series_messages` array, or ignored if return nil. + series_format = function(title, message, percentage, done) + local builder = {} + local has_title = false + local has_message = false + if title and title ~= "" then + table.insert(builder, title) + has_title = true + end + if message and message ~= "" then + table.insert(builder, message) + has_message = true + end + if percentage and (has_title or has_message) then + table.insert(builder, string.format("(%.0f%%%%)", percentage)) + end + if done and (has_title or has_message) then + table.insert(builder, "- done") + end + return table.concat(builder, " ") + end; - -- Format client message. - -- - -- By default it looks like: - -- `[null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)`. - -- - --- @param client_name string - --- Client name. - --- @param spinner string - --- Spinner icon. - --- @param series_messages string[]|table[] - --- Messages array. - --- @return string|nil messages - --- The returned value will be passed to function `format` as one of the - --- `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, - ", " - )) - or nil - end, + -- Format client message. + -- + -- By default it looks like: + -- `[null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)`. + -- + --- @param client_name string + --- Client name. + --- @param spinner string + --- Spinner icon. + --- @param series_messages string[]|table[] + --- Messages array. + --- @return string|nil messages + --- The returned value will be passed to function `format` as one of the + --- `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, ", ")) + or nil + end; - -- Format (final) message. - -- - -- By default it looks like: - -- ` LSP [null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)` - -- - --- @param client_messages string[]|table[] - --- Client messages array. - --- @return nil|string message - --- The returned value will be returned from `progress` API. - format = function(client_messages) - local sign = " LSP" -- nf-fa-gear \uf013 - return #client_messages > 0 - and (sign .. " " .. table.concat(client_messages, " ")) - or sign - end, + -- Format (final) message. + -- + -- By default it looks like: + -- ` LSP [null-ls] ⣷ formatting isort (100%) - done, formatting black (50%)` + -- + --- @param client_messages string[]|table[] + --- Client messages array. + --- @return nil|string message + --- The returned value will be returned from `progress` API. + format = function(client_messages) + local sign = " LSP" -- nf-fa-gear \uf013 + return #client_messages > 0 and (sign .. " " .. table.concat(client_messages, " ")) or sign + end; - -- Enable debug. - -- - --- @type boolean - debug = false, + -- Enable debug. + -- + --- @type boolean + debug = false; - -- Print log to console(command line). - -- - --- @type boolean - console_log = false, + -- Print log to console(command line). + -- + --- @type boolean + console_log = false; - -- Print log to file. - -- - --- @type boolean - file_log = true, + -- Print log to file. + -- + --- @type boolean + file_log = true; - -- Log file to write, work with `file_log=true`. - -- - -- For Windows: `$env:USERPROFILE\AppData\Local\nvim-data\lsp-progress.log`. - -- For *NIX: `~/.local/share/nvim/lsp-progress.log`. - -- - --- @type string - file_log_name = "lsp-progress.log", + -- Log file to write, work with `file_log=true`. + -- + -- For Windows: `$env:USERPROFILE\AppData\Local\nvim-data\lsp-progress.log`. + -- For *NIX: `~/.local/share/nvim/lsp-progress.log`. + -- + --- @type string + file_log_name = "lsp-progress.log"; }) diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/luasnip.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/luasnip.lua index c7707c69..0a603692 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/luasnip.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/luasnip.lua @@ -1,9 +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/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/all.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/all.lua index cfb75a68..5ce91a87 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/all.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/all.lua @@ -1,57 +1,59 @@ local get_visual = function(args, parent) - if (#parent.snippet.env.SELECT_RAW > 0) then - return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) - else - return sn(nil, i(1, '')) - end + if #parent.snippet.env.SELECT_RAW > 0 then + return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) + else + return sn(nil, i(1, "")) + end end local function char_count_same(c1, c2) - local line = vim.api.nvim_get_current_line() - -- '%'-escape chars to force explicit match (gsub accepts patterns). - -- second return value is number of substitutions. - local _, ct1 = string.gsub(line, '%' .. c1, '') - local _, ct2 = string.gsub(line, '%' .. c2, '') - return ct1 == ct2 + local line = vim.api.nvim_get_current_line() + -- '%'-escape chars to force explicit match (gsub accepts patterns). + -- second return value is number of substitutions. + local _, ct1 = string.gsub(line, "%" .. c1, "") + local _, ct2 = string.gsub(line, "%" .. c2, "") + return ct1 == ct2 end local function even_count(c) - local line = vim.api.nvim_get_current_line() - local _, ct = string.gsub(line, c, '') - return ct % 2 == 0 + local line = vim.api.nvim_get_current_line() + local _, ct = string.gsub(line, c, "") + return ct % 2 == 0 end local function neg(fn, ...) - return not fn(...) + return not fn(...) end local function part(fn, ...) - local args = { ... } - return function() return fn(unpack(args)) end + local args = { ...; } + return function() + return fn(unpack(args)) + end end -- This makes creation of pair-type snippets easier. local function pair(pair_begin, pair_end, expand_func, ...) - -- triggerd by opening part of pair, wordTrig=false to trigger anywhere. - -- ... is used to pass any args following the expand_func to it. - return s({ trig = pair_begin, wordTrig = false, snippetType = "autosnippet" }, { - t({ pair_begin }), d(1, get_visual), t({ pair_end }) - }, { - condition = part(expand_func, part(..., pair_begin, pair_end)) - }) + -- triggerd by opening part of pair, wordTrig=false to trigger anywhere. + -- ... is used to pass any args following the expand_func to it. + return s( + { trig = pair_begin; wordTrig = false; snippetType = "autosnippet"; }, + { t({ pair_begin; }); d(1, get_visual); t({ pair_end; }); }, + { condition = part(expand_func, part(..., pair_begin, pair_end)); } + ) end -local maybe = { pair = nil }; +local maybe = { pair = nil; } if vim.bo.filetype == "tex" then - maybe.pair = pair("<", ">", neg, char_count_same) + maybe.pair = pair("<", ">", neg, char_count_same) end local output_table = { - pair("(", ")", neg, char_count_same), - pair("{", "}", neg, char_count_same), - pair("[", "]", neg, char_count_same), - pair("'", "'", neg, even_count), - pair('"', '"', neg, even_count), - pair("`", "`", neg, even_count), + pair("(", ")", neg, char_count_same); + pair("{", "}", neg, char_count_same); + pair("[", "]", neg, char_count_same); + pair("'", "'", neg, even_count); + pair('"', '"', neg, even_count); + pair("`", "`", neg, even_count); } output_table[#output_table + 1] = maybe.pair diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/html/html.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/html/html.lua index df42314b..c467dd68 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/html/html.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/html/html.lua @@ -1,5 +1,5 @@ local get_visual = function(args, parent) - if (#parent.snippet.env.SELECT_RAW > 0) then + if #parent.snippet.env.SELECT_RAW > 0 then return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) else return sn(nil, i(1)) @@ -8,65 +8,68 @@ end local line_begin = require("luasnip.extras.expand_conditions").line_begin -return - { - -- HEADER - s({trig="h([123456])", regTrig=true, wordTrig=false, snippetType="autosnippet"}, - fmt( - [[ +return { + -- HEADER + s( + { + trig = "h([123456])"; + regTrig = true; + wordTrig = false; + snippetType = "autosnippet"; + }, + fmt( + [[ <h{}>{}</h{}> ]], - { - f( function(_, snip) return snip.captures[1] end ), - d(1, get_visual), - f( function(_, snip) return snip.captures[1] end ), - } - ), - {condition = line_begin} + { + f(function(_, snip) + return snip.captures[1] + end); + d(1, get_visual); + f(function(_, snip) + return snip.captures[1] + end); + } ), - -- PARAGRAPH - s({trig="pp", snippetType="autosnippet"}, - fmt( - [[ + { condition = line_begin; } + ); -- PARAGRAPH + s( + { trig = "pp"; snippetType = "autosnippet"; }, + fmt( + [[ <p>{}</p> ]], - { - d(1, get_visual), - } - ), - {condition = line_begin} + { d(1, get_visual); } ), - -- UNORDERED LIST - s({trig="itt", snippetType="autosnippet"}, - fmt( - [[ + { condition = line_begin; } + ); -- UNORDERED LIST + s( + { trig = "itt"; snippetType = "autosnippet"; }, + fmt( + [[ <ul> <li>{}</li>{} </ul> ]], - { - i(1), - i(0) - } - ), - {condition = line_begin} + { i(1); i(0); } ), - -- LIST ITEM - s({trig="ii", snippetType="autosnippet"}, - fmt( - [[ + { condition = line_begin; } + ); -- LIST ITEM + s( + { trig = "ii"; snippetType = "autosnippet"; }, + fmt( + [[ <li>{}</li> ]], - { - d(1, get_visual), - } - ), - {condition = line_begin} + { d(1, get_visual); } ), - -- DOCUMENT TEMPLATE - s({trig="base"}, - fmt( - [[ + { condition = line_begin; } + ); + -- DOCUMENT TEMPLATE + s( + { trig = "base"; }, + fmt( + [[ <!doctype HTML> <html lang="en"> <head> @@ -78,28 +81,28 @@ return </body> </html> ]], - { - i(1, "FooBar"), - i(0) - } - ), - {condition = line_begin} + { i(1, "FooBar"); i(0); } ), - -- ANCHOR TAG - s({trig = "([^%l])aa", regTrig = true, wordTrig = false, snippetType="autosnippet"}, - fmt( - [[ + { condition = line_begin; } + ); -- ANCHOR TAG + s( + { + trig = "([^%l])aa"; + regTrig = true; + wordTrig = false; + snippetType = "autosnippet"; + }, + fmt( + [[ {}<a href="{}">{}</a> ]], - { - f( function(_, snip) return snip.captures[1] end ), - i(1), - d(2, get_visual), - } - ) - ), - } - - - - + { + f(function(_, snip) + return snip.captures[1] + end); + i(1); + d(2, get_visual); + } + ) + ); +} diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/delimiter.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/delimiter.lua index 2e11d43d..e50898fc 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/delimiter.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/delimiter.lua @@ -1,31 +1,34 @@ local get_visual = function(args, parent) - if (#parent.snippet.env.SELECT_RAW > 0) then + if #parent.snippet.env.SELECT_RAW > 0 then return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) else - return sn(nil, i(1, '')) + return sn(nil, i(1, "")) 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"}, - fmta( - "<>\\left<><>\\right<>", - { - f( function(_, snip) return snip.captures[1] end ), - f( function(_, snip) return snip.captures[2] end ), - d(1, get_visual), - f( function(_, snip) return translation_table[snip.captures[2]] end ), - } - ) - ), +return { + -- LEFT/RIGHT ALL BRACES + s( + { + trig = "([^%a])l([%(%[%{])"; + regTrig = true; + wordTrig = false; + snippetType = "autosnippet"; + }, + fmta("<>\\left<><>\\right<>", { + f(function(_, snip) + return snip.captures[1] + end); + f(function(_, snip) + return snip.captures[2] + end); + d(1, get_visual); + f(function(_, snip) + return translation_table[snip.captures[2]] + end); + }) + ); } - diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/greek.lua b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/greek.lua index 419e47ef..19989093 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/greek.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/luasnip/lua/snippets/tex/greek.lua @@ -1,140 +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"), - }), +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"); }); } diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/nvim-lint/lua/nvim-lint.lua b/home-manager/soispha/config/neovim/nixvim/plugins/nvim-lint/lua/nvim-lint.lua index 812d4827..582da638 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/nvim-lint/lua/nvim-lint.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/nvim-lint/lua/nvim-lint.lua @@ -1,20 +1,20 @@ -require('lint').linters_by_ft = { - -- text - markdown = {}, - -- tex = {'chktex'}, -- maybe add some text linters ? +require("lint").linters_by_ft = { + -- text + markdown = {}; + -- tex = {'chktex'}, -- maybe add some text linters ? - -- shell - sh = {'shellcheck',}, - bash = {'shellcheck'}, - zsh = {'shellcheck'}, - dash = {'shellcheck'}, + -- shell + sh = { "shellcheck"; }; + bash = { "shellcheck"; }; + zsh = { "shellcheck"; }; + dash = { "shellcheck"; }; - yaml = {'yamllint'}, - nix = {'nix', 'statix'}, + yaml = { "yamllint"; }; + nix = { "nix"; "statix"; }; } -vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, { - callback = function() - require("lint").try_lint() - end, +vim.api.nvim_create_autocmd({ "BufEnter"; "BufWritePost"; }, { + callback = function() + require("lint").try_lint() + end; }) diff --git a/home-manager/soispha/config/neovim/nixvim/plugins/telescope/extensions/rooter/lua/rooter.lua b/home-manager/soispha/config/neovim/nixvim/plugins/telescope/extensions/rooter/lua/rooter.lua index 1d66931b..eaf68ecf 100644 --- a/home-manager/soispha/config/neovim/nixvim/plugins/telescope/extensions/rooter/lua/rooter.lua +++ b/home-manager/soispha/config/neovim/nixvim/plugins/telescope/extensions/rooter/lua/rooter.lua @@ -1,84 +1,84 @@ -- Taken from: https://github.com/desdic/telescope-rooter.nvim/blob/69423216c75a5f1f1477bbf8faf6b0dc8af04099/lua/telescope/_extensions/rooter.lua - local has_telescope, telescope = pcall(require, "telescope") if not has_telescope then - error("This extension requires telescope.nvim") - return + error("This extension requires telescope.nvim") + return end local has_plenary, plenary = pcall(require, "plenary") if not has_plenary then - error("This extension requires plenary") - return + error("This extension requires plenary") + 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(_) - vim.g["Telescope#rooter#enabled"] = not vim.g["Telescope#rooter#enabled"] - print("Telescope#rooter#enabled=" .. - vim.inspect(vim.g["Telescope#rooter#enabled"])) + vim.g["Telescope#rooter#enabled"] = not vim.g["Telescope#rooter#enabled"] + 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" }, { - callback = function() - if vim.g["Telescope#rooter#enabled"] ~= true then return end +vim.api.nvim_create_autocmd({ "DirChangedPre"; }, { + callback = function() + if vim.g["Telescope#rooter#enabled"] ~= true then + return + end - if vim.g["Telescope#rooter#oldpwd"] == nil then - vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd() - log.debug("before " .. vim.inspect(vim.loop.cwd())) - end - end, - group = group + if vim.g["Telescope#rooter#oldpwd"] == nil then + vim.g["Telescope#rooter#oldpwd"] = vim.loop.cwd() + log.debug("before " .. vim.inspect(vim.loop.cwd())) + end + end; + group = group; }) -vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { - callback = function() - if vim.g["Telescope#rooter#enabled"] ~= true then return end +vim.api.nvim_create_autocmd({ "BufEnter"; "BufWinEnter"; }, { + callback = function() + if vim.g["Telescope#rooter#enabled"] ~= true then + return + end - vim.schedule(function() - if vim.bo.filetype == "TelescopePrompt" then - 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 + vim.schedule(function() + if vim.bo.filetype == "TelescopePrompt" then + 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; }) -vim.api.nvim_create_autocmd({ "BufWinLeave" }, { - callback = function() - if vim.g["Telescope#rooter#enabled"] ~= true then return end +vim.api.nvim_create_autocmd({ "BufWinLeave"; }, { + callback = function() + if vim.g["Telescope#rooter#enabled"] ~= true then + return + end - vim.schedule(function() - if vim.bo.filetype ~= "TelescopePrompt" then - if vim.g["Telescope#rooter#oldpwd"] ~= nil then - log.debug("restoring " .. - vim.g["Telescope#rooter#oldpwd"]) - vim.api.nvim_set_current_dir( - vim.g["Telescope#rooter#oldpwd"]) - vim.g["Telescope#rooter#oldpwd"] = nil - end - end - end) - end, - group = group + vim.schedule(function() + if vim.bo.filetype ~= "TelescopePrompt" then + if vim.g["Telescope#rooter#oldpwd"] ~= nil then + log.debug("restoring " .. vim.g["Telescope#rooter#oldpwd"]) + vim.api.nvim_set_current_dir(vim.g["Telescope#rooter#oldpwd"]) + vim.g["Telescope#rooter#oldpwd"] = nil + end + end + end) + end; + group = group; }) |