aboutsummaryrefslogtreecommitdiffstats
path: root/modules/home.legacy/conf
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-02 18:51:14 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-11-02 18:53:06 +0100
commit5d95ae4d2c4a47589412fafd1572eaaaff15622d (patch)
tree6e95a463c0830602933aee3dee61370150c176b0 /modules/home.legacy/conf
parentfeat(flake/treefmt.nix): Specify lua formatter settings (diff)
downloadnixos-config-5d95ae4d2c4a47589412fafd1572eaaaff15622d.zip
style(modules/legacy/conf/nvim): Format
Diffstat (limited to 'modules/home.legacy/conf')
-rw-r--r--modules/home.legacy/conf/nvim/files/ftplugin/tex.lua9
-rw-r--r--modules/home.legacy/conf/nvim/options/default.nix1
-rw-r--r--modules/home.legacy/conf/nvim/plgs/femaco/lua/femaco.lua16
-rw-r--r--modules/home.legacy/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua4
-rw-r--r--modules/home.legacy/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua8
-rw-r--r--modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/all.lua73
-rw-r--r--modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua12
-rw-r--r--modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua12
-rw-r--r--modules/home.legacy/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua4
-rw-r--r--modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua16
10 files changed, 52 insertions, 103 deletions
diff --git a/modules/home.legacy/conf/nvim/files/ftplugin/tex.lua b/modules/home.legacy/conf/nvim/files/ftplugin/tex.lua
index f3fffa86..4107a7c5 100644
--- a/modules/home.legacy/conf/nvim/files/ftplugin/tex.lua
+++ b/modules/home.legacy/conf/nvim/files/ftplugin/tex.lua
@@ -52,6 +52,9 @@ require("telescope").setup({
},
})
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" })
+vim.keymap.set(
+ "n",
+ "<leader>ib",
+ function() require("telescope").extensions.bibtex.bibtex() end,
+ { noremap = true, silent = true, desc = "list bibtex entries in telescope" }
+)
diff --git a/modules/home.legacy/conf/nvim/options/default.nix b/modules/home.legacy/conf/nvim/options/default.nix
index d22bdd8f..f66b2181 100644
--- a/modules/home.legacy/conf/nvim/options/default.nix
+++ b/modules/home.legacy/conf/nvim/options/default.nix
@@ -20,7 +20,6 @@
completeopt = ["menuone" "noselect"]; # have a better completion experience
# https://www.compart.com/en/unicode/U+XXXX (unicode character code)
- # stylua: ignore
fillchars = {
fold = "·"; # MIDDLE DOT (U+00B7, UTF-8: C2 B7)
horiz = "━"; # BOX DRAWINGS HEAVY HORIZONTAL (U+2501, UTF-8: E2 94 81)
diff --git a/modules/home.legacy/conf/nvim/plgs/femaco/lua/femaco.lua b/modules/home.legacy/conf/nvim/plgs/femaco/lua/femaco.lua
index da3be8e1..443f1913 100644
--- a/modules/home.legacy/conf/nvim/plgs/femaco/lua/femaco.lua
+++ b/modules/home.legacy/conf/nvim/plgs/femaco/lua/femaco.lua
@@ -28,23 +28,15 @@ require("femaco").setup({
end,
-- return filetype to use for a given lang
-- lang can be nil
- ft_from_lang = function(lang)
- return lang
- end,
+ ft_from_lang = function(lang) return lang end,
-- what to do after opening the float
- post_open_float = function(winnr)
- vim.wo.signcolumn = "no"
- end,
+ post_open_float = function(winnr) vim.wo.signcolumn = "no" end,
-- create the path to a temporary file
- create_tmp_filepath = function(filetype)
- return os.tmpname()
- end,
+ create_tmp_filepath = function(filetype) return os.tmpname() 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
-- filetype of the injected language (this is the current buffer so you can
-- get it from vim.bo.filetyp).
- ensure_newline = function(base_filetype)
- return false
- end,
+ ensure_newline = function(base_filetype) return false end,
})
diff --git a/modules/home.legacy/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua b/modules/home.legacy/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua
index 42ea1eb6..2cdbcdde 100644
--- a/modules/home.legacy/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua
+++ b/modules/home.legacy/conf/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua
@@ -44,9 +44,7 @@ require("flatten").setup({
vim.api.nvim_create_autocmd("BufWritePost", {
buffer = bufnr,
once = true,
- callback = vim.schedule_wrap(function()
- vim.api.nvim_buf_delete(bufnr, {})
- end),
+ callback = vim.schedule_wrap(function() vim.api.nvim_buf_delete(bufnr, {}) end),
})
end
end,
diff --git a/modules/home.legacy/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua b/modules/home.legacy/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua
index efb15720..5a2cff26 100644
--- a/modules/home.legacy/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua
+++ b/modules/home.legacy/conf/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua
@@ -82,12 +82,8 @@ require("lsp-progress").setup({
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
+ 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,
diff --git a/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/all.lua b/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/all.lua
index f6cb09b0..2b923f20 100644
--- a/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/all.lua
+++ b/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/all.lua
@@ -34,9 +34,7 @@ local function pair(pair_begin, pair_end, file_types, condition_function)
{
condition = function()
local filetype_check = true
- if file_types ~= nil then
- filetype_check = file_types[vim.bo.filetype] or false
- end
+ if file_types ~= nil then filetype_check = file_types[vim.bo.filetype] or false end
return (not condition_function(pair_begin, pair_end)) and filetype_check
end,
}
@@ -49,7 +47,7 @@ local auto_pairs = {
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, even_count),
}
@@ -61,15 +59,13 @@ local calculate_comment_string = require("Comment.ft").calculate
local utils = require("Comment.utils")
local read_git_config = function(config_value)
- local command = string.format('git config "%s"', config_value)
+ local command = string.format("git config \"%s\"", config_value)
local handle = io.popen(command)
- if handle == nil then
- return error(string.format("Failed to call `%s`.", command))
- end
+ if handle == nil then return error(string.format("Failed to call `%s`.", command)) end
local result = handle:read("*a")
handle:close()
-- stripped = string.gsub(str, '%s+', '')
- return string.gsub(result, '\n', '')
+ return string.gsub(result, "\n", "")
end
local name_to_handle = function(name)
@@ -121,18 +117,10 @@ end
--- 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,
- date_signature = function()
- return t("<" .. os.date("%Y-%m-%d") .. ">"), t("(" .. _G.luasnip.vars:username() .. ")")
- end,
- date = function()
- return t("<" .. os.date("%Y-%m-%d") .. ">"), t("")
- end,
- empty = function()
- return t(""), t("")
- end,
+ signature = function() return t("(" .. _G.luasnip.vars:username() .. ")"), t("") end,
+ date_signature = function() return t("<" .. os.date("%Y-%m-%d") .. ">"), t("(" .. _G.luasnip.vars:username() .. ")") end,
+ date = function() return t("<" .. os.date("%Y-%m-%d") .. ">"), t("") end,
+ empty = function() return t(""), t("") end,
}
---@param alias string
@@ -146,9 +134,9 @@ local todo_snippet_nodes = function(alias, opts, mark_function)
f(function()
return get_cstring(opts.ctype)[1] -- get <comment-string[1]>
end),
- t(alias), -- [name-of-comment]
+ t(alias), -- [name-of-comment]
signature_node,
- i(0), -- {comment-text}
+ i(0), -- {comment-text}
date_node,
f(function()
return get_cstring(opts.ctype)[2] -- get <comment-string[2]>
@@ -168,18 +156,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
@@ -199,20 +182,20 @@ local process_marks = function(context, aliases, opts, marks)
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 = "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 = "noteb" }, { "NOTE", "INFO" }, { ctype = 2 } },
}
local todo_comment_snippets = {}
diff --git a/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua b/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua
index 17e1e7fb..568c97ec 100644
--- a/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua
+++ b/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/html/html.lua
@@ -22,13 +22,9 @@ return {
<h{}>{}</h{}>
]],
{
- f(function(_, snip)
- return snip.captures[1]
- end),
+ f(function(_, snip) return snip.captures[1] end),
d(1, get_visual),
- f(function(_, snip)
- return snip.captures[1]
- end),
+ f(function(_, snip) return snip.captures[1] end),
}
),
{ condition = line_begin }
@@ -97,9 +93,7 @@ return {
{}<a href="{}">{}</a>
]],
{
- f(function(_, snip)
- return snip.captures[1]
- end),
+ f(function(_, snip) return snip.captures[1] end),
i(1),
d(2, get_visual),
}
diff --git a/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua b/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua
index 22434aa3..ef453973 100644
--- a/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua
+++ b/modules/home.legacy/conf/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua
@@ -19,16 +19,10 @@ return {
snippetType = "autosnippet",
},
fmta("<>\\left<><>\\right<>", {
- f(function(_, snip)
- return snip.captures[1]
- end),
- f(function(_, snip)
- return snip.captures[2]
- end),
+ 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),
+ f(function(_, snip) return translation_table[snip.captures[2]] end),
})
),
}
diff --git a/modules/home.legacy/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua b/modules/home.legacy/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua
index 4ed49f7b..770c3bb5 100644
--- a/modules/home.legacy/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua
+++ b/modules/home.legacy/conf/nvim/plgs/nvim-lint/lua/nvim-lint.lua
@@ -14,7 +14,5 @@ require("lint").linters_by_ft = {
}
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost" }, {
- callback = function()
- require("lint").try_lint()
- end,
+ callback = function() require("lint").try_lint() end,
})
diff --git a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua b/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua
index 7235c5a3..48a8588d 100644
--- a/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua
+++ b/modules/home.legacy/conf/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua
@@ -25,17 +25,13 @@ local config = { patterns = { ".git" }, enable = true, debug = false }
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" })
-end
+if vim.F.if_nil(config.debug, false) then log = plenary.log.new({ plugin = "telescope_rooter", level = "debug" }) end
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
+ 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()
@@ -47,9 +43,7 @@ vim.api.nvim_create_autocmd({ "DirChangedPre" }, {
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
callback = function()
- if vim.g["Telescope#rooter#enabled"] ~= true then
- return
- end
+ if vim.g["Telescope#rooter#enabled"] ~= true then return end
vim.schedule(function()
if vim.bo.filetype == "TelescopePrompt" then
@@ -66,9 +60,7 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
vim.api.nvim_create_autocmd({ "BufWinLeave" }, {
callback = function()
- if vim.g["Telescope#rooter#enabled"] ~= true then
- return
- end
+ if vim.g["Telescope#rooter#enabled"] ~= true then return end
vim.schedule(function()
if vim.bo.filetype ~= "TelescopePrompt" then