style(nvim): format with stylua

This commit is contained in:
Price Hiller 2023-09-13 16:32:27 -05:00
parent ec4f0146ad
commit b8765d1df6
No known key found for this signature in database
18 changed files with 160 additions and 153 deletions

View File

@ -23,7 +23,7 @@ vim.keymap.set("n", "<leader>fr", function()
"-o", "-o",
executable_path, executable_path,
"&& \n", "&& \n",
executable_path executable_path,
} }
require("toggleterm").exec(table.concat(cmd, " ")) require("toggleterm").exec(table.concat(cmd, " "))
end, { end, {

View File

@ -10,12 +10,12 @@ vim.keymap.set("n", "<leader>fr", function()
"nix-instantiate", "nix-instantiate",
"--eval", "--eval",
"--strict", "--strict",
vim.api.nvim_buf_get_name(0) vim.api.nvim_buf_get_name(0),
} }
require("toggleterm").exec(table.concat(cmd, " ")) require("toggleterm").exec(table.concat(cmd, " "))
end, { end, {
buffer = true, buffer = true,
desc = "Nix: Run with default output" desc = "Nix: Run with default output",
}) })
vim.keymap.set("n", "<leader>fj", function() vim.keymap.set("n", "<leader>fj", function()
@ -26,10 +26,10 @@ vim.keymap.set("n", "<leader>fj", function()
"--json", "--json",
vim.api.nvim_buf_get_name(0), vim.api.nvim_buf_get_name(0),
"|", "|",
"jq" "jq",
} }
require("toggleterm").exec(table.concat(cmd, " ")) require("toggleterm").exec(table.concat(cmd, " "))
end, { end, {
buffer = true, buffer = true,
desc = "Nix: Run with json output" desc = "Nix: Run with json output",
}) })

View File

@ -7,14 +7,22 @@ vim.api.nvim_create_autocmd("InsertCharPre", {
--- @return nil --- @return nil
callback = function(opts) callback = function(opts)
-- Only run if f-string escape character is typed -- Only run if f-string escape character is typed
if vim.v.char ~= "{" then return end if vim.v.char ~= "{" then
return
end
-- Get node and return early if not in a string -- Get node and return early if not in a string
local node = vim.treesitter.get_node() local node = vim.treesitter.get_node()
if not node then return end if not node then
if node:type() ~= "string" then node = node:parent() end return
if not node or node:type() ~= "string" then return end end
if node:type() ~= "string" then
node = node:parent()
end
if not node or node:type() ~= "string" then
return
end
vim.print(node:type()) vim.print(node:type())
local row, col, _, _ = vim.treesitter.get_node_range(node) local row, col, _, _ = vim.treesitter.get_node_range(node)
@ -23,7 +31,9 @@ vim.api.nvim_create_autocmd("InsertCharPre", {
local first_char = vim.api.nvim_buf_get_text(opts.buf, row, col, row, col + 1, {})[1] local first_char = vim.api.nvim_buf_get_text(opts.buf, row, col, row, col + 1, {})[1]
vim.print("row " .. row .. " col " .. col) vim.print("row " .. row .. " col " .. col)
vim.print("char: '" .. first_char .. "'") vim.print("char: '" .. first_char .. "'")
if first_char == "f" then return end if first_char == "f" then
return
end
-- Otherwise, make the string a format string -- Otherwise, make the string a format string
vim.api.nvim_input("<Esc>m'" .. row + 1 .. "gg" .. col + 1 .. "|if<Esc>`'la") vim.api.nvim_input("<Esc>m'" .. row + 1 .. "gg" .. col + 1 .. "|if<Esc>`'la")

View File

@ -17,18 +17,13 @@ M.setup = function()
if not strip_trail_space then if not strip_trail_space then
intercept_state = "`Disabled`" intercept_state = "`Disabled`"
end end
vim.notify("Strip Trail Space set to " .. intercept_state, vim.log.levels.INFO, vim.notify("Strip Trail Space set to " .. intercept_state, vim.log.levels.INFO, {
{ title = "Strip Trail Space",
title = "Strip Trail Space", ---@param win integer The window handle
---@param win integer The window handle on_open = function(win)
on_open = function(win) vim.api.nvim_buf_set_option(vim.api.nvim_win_get_buf(win), "filetype", "markdown")
vim.api.nvim_buf_set_option( end,
vim.api.nvim_win_get_buf(win), })
"filetype",
"markdown"
)
end
})
end, { desc = "Toggles intercepting BufWritePre to strip trail space" }) end, { desc = "Toggles intercepting BufWritePre to strip trail space" })
-- NOTE: Remove trailing whitespace on save -- NOTE: Remove trailing whitespace on save
@ -38,7 +33,7 @@ M.setup = function()
if strip_trail_space then if strip_trail_space then
vim.cmd.StripTrailSpace() vim.cmd.StripTrailSpace()
end end
end end,
}) })
-- NOTE: Disables status column elements in Terminal buffer -- NOTE: Disables status column elements in Terminal buffer
@ -60,7 +55,9 @@ M.setup = function()
desc = "Delete [No Name] buffers", desc = "Delete [No Name] buffers",
callback = function(event) callback = function(event)
if event.file == "" and vim.bo[event.buf].buftype == "" and not vim.bo[event.buf].modified then if event.file == "" and vim.bo[event.buf].buftype == "" and not vim.bo[event.buf].modified then
vim.schedule(function() pcall(vim.api.nvim_buf_delete, event.buf, {}) end) vim.schedule(function()
pcall(vim.api.nvim_buf_delete, event.buf, {})
end)
end end
end, end,
}) })
@ -72,18 +69,13 @@ M.setup = function()
if not intercept_file_open then if not intercept_file_open then
intercept_state = "`Disabled`" intercept_state = "`Disabled`"
end end
vim.notify("Intercept file open set to " .. intercept_state, vim.log.levels.INFO, vim.notify("Intercept file open set to " .. intercept_state, vim.log.levels.INFO, {
{ title = "Intercept File Open",
title = "Intercept File Open", ---@param win integer The window handle
---@param win integer The window handle on_open = function(win)
on_open = function(win) vim.api.nvim_buf_set_option(vim.api.nvim_win_get_buf(win), "filetype", "markdown")
vim.api.nvim_buf_set_option( end,
vim.api.nvim_win_get_buf(win), })
"filetype",
"markdown"
)
end
})
end, { desc = "Toggles intercepting BufNew to open files in custom programs" }) end, { desc = "Toggles intercepting BufNew to open files in custom programs" })
-- NOTE: Add "BufReadPre" to the autocmd events to also intercept files given on the command line, e.g. -- NOTE: Add "BufReadPre" to the autocmd events to also intercept files given on the command line, e.g.
@ -106,21 +98,13 @@ M.setup = function()
---@param fpath string The file path given to the program ---@param fpath string The file path given to the program
---@param fname string The file name used in notifications ---@param fname string The file name used in notifications
local function open_mime(buf, fpath, fname) local function open_mime(buf, fpath, fname)
vim.notify( vim.notify(string.format("Opening `%s` in external program", fname), vim.log.levels.INFO, {
string.format("Opening `%s` in external program", fname), title = "Open File in External Program",
vim.log.levels.INFO, ---@param win integer The window handle
{ on_open = function(win)
title = "Open File in External Program", vim.api.nvim_buf_set_option(vim.api.nvim_win_get_buf(win), "filetype", "markdown")
---@param win integer The window handle end,
on_open = function(win) })
vim.api.nvim_buf_set_option(
vim.api.nvim_win_get_buf(win),
"filetype",
"markdown"
)
end
}
)
vim.system({ "xdg-open", fpath }, { detach = true }) vim.system({ "xdg-open", fpath }, { detach = true })
vim.api.nvim_buf_delete(buf, { force = true }) vim.api.nvim_buf_delete(buf, { force = true })
end end
@ -136,7 +120,7 @@ M.setup = function()
["mp4"] = function(buf, fpath, fname) ["mp4"] = function(buf, fpath, fname)
open_mime(buf, fpath, fname) open_mime(buf, fpath, fname)
end, end,
["gif"] = "mp4" ["gif"] = "mp4",
} }
---Get the extension callback for a given extension. Will do a recursive lookup if an extension callback is actually ---Get the extension callback for a given extension. Will do a recursive lookup if an extension callback is actually
@ -157,7 +141,7 @@ M.setup = function()
callback(bufnr, path, filename) callback(bufnr, path, filename)
end end
end end
end end,
}) })
end end

View File

@ -5,7 +5,7 @@ local M = {}
---Traverse to indent >= or > current indent ---Traverse to indent >= or > current indent
---@param direction integer 1 - forwards | -1 - backwards ---@param direction integer 1 - forwards | -1 - backwards
---@param equal boolean include lines equal to current indent in search? ---@param equal boolean include lines equal to current indent in search?
local function indent_traverse(direction, equal) -- {{{ local function indent_traverse(direction, equal) -- {{{
return function() return function()
-- Get the current cursor position -- Get the current cursor position
local current_line, column = unpack(vim.api.nvim_win_get_cursor(0)) local current_line, column = unpack(vim.api.nvim_win_get_cursor(0))
@ -17,14 +17,11 @@ local function indent_traverse(direction, equal) -- {{{
-- Look for a line of appropriate indent -- Look for a line of appropriate indent
-- level without going out of the buffer -- level without going out of the buffer
while (not match) while (not match) and (match_line ~= buf_length) and (match_line ~= 1) do
and (match_line ~= buf_length)
and (match_line ~= 1)
do
match_line = match_line + direction match_line = match_line + direction
local match_line_str = vim.api.nvim_buf_get_lines(0, match_line - 1, match_line, false)[1] local match_line_str = vim.api.nvim_buf_get_lines(0, match_line - 1, match_line, false)[1]
-- local match_line_is_whitespace = match_line_str and match_line_str:match('^%s*$') -- local match_line_is_whitespace = match_line_str and match_line_str:match('^%s*$')
local match_line_is_whitespace = match_line_str:match('^%s*$') local match_line_is_whitespace = match_line_str:match("^%s*$")
if equal then if equal then
match_indent = vim.fn.indent(match_line) <= vim.fn.indent(current_line) match_indent = vim.fn.indent(match_line) <= vim.fn.indent(current_line)
@ -112,8 +109,8 @@ M.setup = function()
-- Binding to keep S-Space in terminals from not sending <Space> -- Binding to keep S-Space in terminals from not sending <Space>
vim.keymap.set("t", "<S-Space>", "<Space>", { silent = true, desc = "Terminal: Hack S-Space to Space" }) vim.keymap.set("t", "<S-Space>", "<Space>", { silent = true, desc = "Terminal: Hack S-Space to Space" })
vim.keymap.set("n", "<C-j>", indent_traverse(1, true), { silent = true, desc = "Move: To next equal indent"}) vim.keymap.set("n", "<C-j>", indent_traverse(1, true), { silent = true, desc = "Move: To next equal indent" })
vim.keymap.set("n", "<C-k>", indent_traverse(-1, true), { silent = true, desc = "Move: To previous equal indent"}) vim.keymap.set("n", "<C-k>", indent_traverse(-1, true), { silent = true, desc = "Move: To previous equal indent" })
end end
return M return M

View File

@ -66,25 +66,35 @@ return {
s = s / 100 s = s / 100
l = l / 100 l = l / 100
local r, g, b; local r, g, b
if s == 0 then if s == 0 then
r, g, b = l, l, l; -- achromatic r, g, b = l, l, l -- achromatic
else else
local function hue2rgb(p, q, t) local function hue2rgb(p, q, t)
if t < 0 then t = t + 1 end if t < 0 then
if t > 1 then t = t - 1 end t = t + 1
if t < 1 / 6 then return p + (q - p) * 6 * t end end
if t < 1 / 2 then return q end if t > 1 then
if t < 2 / 3 then return p + (q - p) * (2 / 3 - t) * 6 end t = t - 1
return p; end
if t < 1 / 6 then
return p + (q - p) * 6 * t
end
if t < 1 / 2 then
return q
end
if t < 2 / 3 then
return p + (q - p) * (2 / 3 - t) * 6
end
return p
end end
local q = l < 0.5 and l * (1 + s) or l + s - l * s; local q = l < 0.5 and l * (1 + s) or l + s - l * s
local p = 2 * l - q; local p = 2 * l - q
r = hue2rgb(p, q, h + 1 / 3); r = hue2rgb(p, q, h + 1 / 3)
g = hue2rgb(p, q, h); g = hue2rgb(p, q, h)
b = hue2rgb(p, q, h - 1 / 3); b = hue2rgb(p, q, h - 1 / 3)
end end
local function round(num) local function round(num)
@ -93,7 +103,6 @@ return {
return round(r * 255), round(g * 255), round(b * 255) return round(r * 255), round(g * 255), round(b * 255)
end end
---@param sources table? ---@param sources table?
local standard_sources = function(sources) local standard_sources = function(sources)
sources = sources or {} sources = sources or {}
@ -170,8 +179,12 @@ return {
return conversion return conversion
end end
end end
return string.format("#%s%s%s", convertNumHex(red), convertNumHex(green), return string.format(
convertNumHex(blue)) "#%s%s%s",
convertNumHex(red),
convertNumHex(green),
convertNumHex(blue)
)
end end
if type(hl) == string then if type(hl) == string then
@ -180,11 +193,11 @@ return {
hl = rgbToHex(red, green, blue) hl = rgbToHex(red, green, blue)
end end
local start, _, hue, saturation, lightness = hl:find( local start, _, hue, saturation, lightness =
"hsl.*%((%d+), (%d+)%%, (%d+)%%.*%)") hl:find("hsl.*%((%d+), (%d+)%%, (%d+)%%.*%)")
if start ~= nil then if start ~= nil then
red, green, blue = hslToRgb(tonumber(hue), tonumber(saturation), red, green, blue =
tonumber(lightness)) hslToRgb(tonumber(hue), tonumber(saturation), tonumber(lightness))
hl = rgbToHex(red, green, blue) hl = rgbToHex(red, green, blue)
end end

View File

@ -8,11 +8,11 @@ return {
return { return {
window = { window = {
open = "alternate" open = "alternate",
}, },
one_per = { one_per = {
wezterm = false, wezterm = false,
kitty = false kitty = false,
}, },
callbacks = { callbacks = {
should_block = function(argv) should_block = function(argv)
@ -49,7 +49,7 @@ return {
once = true, once = true,
callback = vim.schedule_wrap(function() callback = vim.schedule_wrap(function()
vim.api.nvim_buf_delete(bufnr, {}) vim.api.nvim_buf_delete(bufnr, {})
end) end),
}) })
end end
end, end,
@ -61,9 +61,9 @@ return {
saved_terminal = nil saved_terminal = nil
end end
end) end)
end end,
} },
} }
end end,
} },
} }

View File

@ -28,9 +28,9 @@ return {
asm = function() asm = function()
return { return {
exe = "asmfmt", exe = "asmfmt",
stdin = true stdin = true,
} }
end end,
}, },
} }
end, end,

View File

@ -1,12 +1,12 @@
return { return {
{ {
'pwntester/octo.nvim', "pwntester/octo.nvim",
cmd = "Octo", cmd = "Octo",
dependencies = { dependencies = {
'nvim-lua/plenary.nvim', "nvim-lua/plenary.nvim",
'nvim-telescope/telescope.nvim', "nvim-telescope/telescope.nvim",
'nvim-tree/nvim-web-devicons', "nvim-tree/nvim-web-devicons",
}, },
config = true config = true,
} },
} }

View File

@ -142,11 +142,11 @@ return {
local filename = self.filename local filename = self.filename
local extension = vim.fn.fnamemodify(filename, ":e") local extension = vim.fn.fnamemodify(filename, ":e")
local buftype = vim.api.nvim_get_option_value("buftype", { local buftype = vim.api.nvim_get_option_value("buftype", {
buf = self.bufnr buf = self.bufnr,
}) })
local filetype = vim.api.nvim_get_option_value("filetype", { local filetype = vim.api.nvim_get_option_value("filetype", {
buf = self.bufnr buf = self.bufnr,
}) })
self.icon, self.icon_color = self.icon, self.icon_color =
require("nvim-web-devicons").get_icon_color(filename, extension, { default = true }) require("nvim-web-devicons").get_icon_color(filename, extension, { default = true })
@ -155,11 +155,11 @@ return {
["rust"] = { icon = "", icon_color = self.icon_color }, ["rust"] = { icon = "", icon_color = self.icon_color },
["sshconfig"] = { icon = "󰴳", icon_color = colors.carpYellow }, ["sshconfig"] = { icon = "󰴳", icon_color = colors.carpYellow },
["sshdconfig"] = "sshconfig", ["sshdconfig"] = "sshconfig",
["help"] = { icon = "󰋗", icon_color = colors.springGreen } ["help"] = { icon = "󰋗", icon_color = colors.springGreen },
} }
local buftype_overrides = { local buftype_overrides = {
["terminal"] = { icon = "", icon_color = colors.roninYellow } ["terminal"] = { icon = "", icon_color = colors.roninYellow },
} }
local function get_override(name, overrides) local function get_override(name, overrides)
@ -194,7 +194,7 @@ return {
provider = function(self) provider = function(self)
local filename = "" local filename = ""
local buftype = vim.api.nvim_get_option_value("buftype", { local buftype = vim.api.nvim_get_option_value("buftype", {
buf = self.bufnr buf = self.bufnr,
}) })
if buftype == "terminal" then if buftype == "terminal" then
local subs = 0 local subs = 0
@ -455,7 +455,7 @@ return {
StatusLineBufferBlock, StatusLineBufferBlock,
{ provider = "", hl = { fg = colors.katanaGray } }, -- left truncation, optional (defaults to "<") { provider = "", hl = { fg = colors.katanaGray } }, -- left truncation, optional (defaults to "<")
{ provider = "", hl = { fg = colors.katanaGray } } -- right trunctation, also optional (defaults to ...... yep, ">") { provider = "", hl = { fg = colors.katanaGray } } -- right trunctation, also optional (defaults to ...... yep, ">")
-- by the way, open a lot of buffers and try clicking them ;) -- by the way, open a lot of buffers and try clicking them ;)
) )
local Tabpage = { local Tabpage = {
@ -562,7 +562,7 @@ return {
end end
return { fg = colors.oniViolet, bg = bg } return { fg = colors.oniViolet, bg = bg }
end end,
}, },
}, },
{ {
@ -589,7 +589,7 @@ return {
return { fg = colors.oniViolet2, bg = bg } return { fg = colors.oniViolet2, bg = bg }
end, end,
}, },
} },
}, },
{ {
condition = conditions.has_diagnostics, condition = conditions.has_diagnostics,
@ -676,7 +676,7 @@ return {
}, },
{ {
FileIcon, FileIcon,
hl = { bg = colors.sumiInk4 } hl = { bg = colors.sumiInk4 },
}, },
{ {
provider = seps.full.right, provider = seps.full.right,

View File

@ -1,9 +1,9 @@
return { return {
{ {
'tzachar/highlight-undo.nvim', "tzachar/highlight-undo.nvim",
keys = { keys = {
{"u"}, { "u" },
{"<C-r>"} { "<C-r>" },
}, },
opts = {}, opts = {},
}, },

View File

@ -9,7 +9,7 @@ return {
}, },
keys = { keys = {
{ "<leader>h", desc = "> Hydra" }, { "<leader>h", desc = "> Hydra" },
{ "<C-w>" } { "<C-w>" },
}, },
event = { "BufReadPre", "BufNewFile" }, event = { "BufReadPre", "BufNewFile" },
config = function() config = function()

View File

@ -212,9 +212,9 @@ return {
vim.cmd.colorscheme("kanagawa") vim.cmd.colorscheme("kanagawa")
local colors = require("kanagawa.colors").setup().palette local colors = require("kanagawa.colors").setup().palette
vim.api.nvim_set_hl(0, "StatusLine", { bg = colors.sumiInk0 }) vim.api.nvim_set_hl(0, "StatusLine", { bg = colors.sumiInk0 })
vim.api.nvim_set_hl(0, "WinBar", { bg = nil }) vim.api.nvim_set_hl(0, "WinBar", { bg = nil })
vim.api.nvim_set_hl(0, "StatusLineNC", { bg = nil }) vim.api.nvim_set_hl(0, "StatusLineNC", { bg = nil })
vim.api.nvim_set_hl(0, "WinBarNC", { bg = nil }) vim.api.nvim_set_hl(0, "WinBarNC", { bg = nil })
end, end,
}, },
} }

View File

@ -462,16 +462,17 @@ return {
require("typescript-tools").setup({ require("typescript-tools").setup({
on_attach = on_attach, on_attach = on_attach,
settings = { settings = {
tsserver_path = vim.fn.stdpath("data") .. "/mason/packages/typescript-language-server/node_modules/typescript/lib/tsserver.js", tsserver_path = vim.fn.stdpath("data")
.. "/mason/packages/typescript-language-server/node_modules/typescript/lib/tsserver.js",
expose_as_code_action = { expose_as_code_action = {
"fix_all", "fix_all",
"add_missing_imports", "add_missing_imports",
"remove_unused", "remove_unused",
"remove_unused_imports", "remove_unused_imports",
"organize_imports" "organize_imports",
}, },
tsserver_plugins = { tsserver_plugins = {
"@styled/typescript-styled-plugin" "@styled/typescript-styled-plugin",
}, },
tsserver_file_preferences = { tsserver_file_preferences = {
includeInlayParameterNameHints = "all", includeInlayParameterNameHints = "all",
@ -497,11 +498,10 @@ return {
functionTypeParameters = true, functionTypeParameters = true,
parameterNames = true, parameterNames = true,
rangeVariableTypes = true, rangeVariableTypes = true,
} },
} },
} },
} })
)
-- NOTE: GENERIC LSP SERVERS -- NOTE: GENERIC LSP SERVERS
for _, server in ipairs({ for _, server in ipairs({

View File

@ -11,30 +11,30 @@ return {
":Telescope diagnostics bufnr=0<CR>", ":Telescope diagnostics bufnr=0<CR>",
desc = "LSP: Telescope Diagnostics", desc = "LSP: Telescope Diagnostics",
}, },
{ "<leader>t", desc = "> Telescope" }, { "<leader>t", desc = "> Telescope" },
{ "<leader>tg", desc = "> Telescope: Git" }, { "<leader>tg", desc = "> Telescope: Git" },
{ "<leader>tw", ":Telescope live_grep<CR>", desc = "Telescope: Grep for Word" }, { "<leader>tw", ":Telescope live_grep<CR>", desc = "Telescope: Grep for Word" },
{ "<leader>tgs", ":Telescope git_status<CR>", desc = "Telescope: Git Status" }, { "<leader>tgs", ":Telescope git_status<CR>", desc = "Telescope: Git Status" },
{ "<leader>tgc", ":Telescope git_commits<CR>", desc = "Telescope: Git Commits" }, { "<leader>tgc", ":Telescope git_commits<CR>", desc = "Telescope: Git Commits" },
{ "<leader>tgb", ":Telescope git_branches<CR>", desc = "Telescope: Git Branches" }, { "<leader>tgb", ":Telescope git_branches<CR>", desc = "Telescope: Git Branches" },
{ "<leader>tf", ":Telescope find_files<CR>", desc = "Telescope: Find Files" }, { "<leader>tf", ":Telescope find_files<CR>", desc = "Telescope: Find Files" },
{ "<leader>td", ":Telescope find_directories<CR>", desc = "Telescope: Find Directories" }, { "<leader>td", ":Telescope find_directories<CR>", desc = "Telescope: Find Directories" },
{ "<leader>tb", ":Telescope buffers<CR>", desc = "Telescope: Buffers" }, { "<leader>tb", ":Telescope buffers<CR>", desc = "Telescope: Buffers" },
{ "<leader>th", ":Telescope help_tags<CR>", desc = "Telescope: Help Tags" }, { "<leader>th", ":Telescope help_tags<CR>", desc = "Telescope: Help Tags" },
{ "<leader>to", ":Telescope oldfiles<CR>", desc = "Telescope: Recent Files" }, { "<leader>to", ":Telescope oldfiles<CR>", desc = "Telescope: Recent Files" },
{ "<leader>tn", ":Telescope neoclip default<CR>", desc = "Telescope: Neoclip Buffer" }, { "<leader>tn", ":Telescope neoclip default<CR>", desc = "Telescope: Neoclip Buffer" },
{ "<leader>tr", ":Telescope resume<CR>", desc = "Telescope: Resume" }, { "<leader>tr", ":Telescope resume<CR>", desc = "Telescope: Resume" },
{ "<leader>tR", ":Telescope registers<CR>", desc = "Telescope: Registers" }, { "<leader>tR", ":Telescope registers<CR>", desc = "Telescope: Registers" },
{ "<leader>tt", ":Telescope file_browser<CR>", desc = "Telescope: File Tree" }, { "<leader>tt", ":Telescope file_browser<CR>", desc = "Telescope: File Tree" },
{ "<leader>ts", ":Telescope spell_suggest<CR>", desc = "Telescope: Spell Suggest" }, { "<leader>ts", ":Telescope spell_suggest<CR>", desc = "Telescope: Spell Suggest" },
{ "<leader>tl", ":Telescope resume<CR>", desc = "Telescope: Previous State" }, { "<leader>tl", ":Telescope resume<CR>", desc = "Telescope: Previous State" },
{ "<leader>tT", ":TodoTelescope<CR>", desc = "Telescope: Todo Items" }, { "<leader>tT", ":TodoTelescope<CR>", desc = "Telescope: Todo Items" },
{ "<leader>tk", ":Telescope keymaps<CR>", desc = "Telescope: Keymaps" }, { "<leader>tk", ":Telescope keymaps<CR>", desc = "Telescope: Keymaps" },
{ "<leader>tc", ":Telescope commands<CR>", desc = "Telescope: Commands" }, { "<leader>tc", ":Telescope commands<CR>", desc = "Telescope: Commands" },
{ "<leader>tu", ":Telescope undo<CR>", desc = "Telescope: Undo History" }, { "<leader>tu", ":Telescope undo<CR>", desc = "Telescope: Undo History" },
{ "<leader>tm", ":Telescope man_pages<CR>", desc = "Telescope: Man Pages" }, { "<leader>tm", ":Telescope man_pages<CR>", desc = "Telescope: Man Pages" },
{ "<leader>lq", ":Telescope diagnostics bufnr=0<CR>", desc = "LSP: Telescope Diagnostics" }, { "<leader>lq", ":Telescope diagnostics bufnr=0<CR>", desc = "LSP: Telescope Diagnostics" },
{ "<leader>nv", ":Telescope notify<CR>", desc = "Notifications: Search" }, { "<leader>nv", ":Telescope notify<CR>", desc = "Notifications: Search" },
}, },
dependencies = { dependencies = {
"nvim-telescope/telescope-file-browser.nvim", "nvim-telescope/telescope-file-browser.nvim",
@ -43,7 +43,7 @@ return {
"debugloop/telescope-undo.nvim", "debugloop/telescope-undo.nvim",
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
{ "nvim-telescope/telescope-smart-history.nvim", dependencies = "tami5/sqlite.lua" }, { "nvim-telescope/telescope-smart-history.nvim", dependencies = "tami5/sqlite.lua" },
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, { "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
}, },
config = function() config = function()
local telescope = require("telescope") local telescope = require("telescope")
@ -179,7 +179,7 @@ return {
"Wikipedia", "Wikipedia",
("https://en.wikipedia.org/w/index.php?search=" .. search:gsub(" ", "+")), ("https://en.wikipedia.org/w/index.php?search=" .. search:gsub(" ", "+")),
}, },
{ "Github", ("https://github.com/search?q=" .. search:gsub(" ", "+")) }, { "Github", ("https://github.com/search?q=" .. search:gsub(" ", "+")) },
}, },
entry_maker = function(entry) entry_maker = function(entry)
return { value = entry, display = entry[1], ordinal = entry[1] } return { value = entry, display = entry[1], ordinal = entry[1] }
@ -193,9 +193,14 @@ return {
---@param obj vim.SystemCompleted ---@param obj vim.SystemCompleted
vim.system({ "xdg-open", selection["value"][2] }, { text = true }, function(obj) vim.system({ "xdg-open", selection["value"][2] }, { text = true }, function(obj)
if obj.code ~= 0 then if obj.code ~= 0 then
vim.notify(string.format( vim.notify(
"Failed to open selection, exit code: %s!\n---Stdout---\n%s\n---Stderr---\n%s", string.format(
obj.code, obj.stdout, obj.stderr)) "Failed to open selection, exit code: %s!\n---Stdout---\n%s\n---Stderr---\n%s",
obj.code,
obj.stdout,
obj.stderr
)
)
end end
end) end)
end) end)

View File

@ -22,7 +22,7 @@ return {
vim.cmd.ToggleTerm() vim.cmd.ToggleTerm()
end end
end, end,
desc = "ToggleTerm: Toggle" desc = "ToggleTerm: Toggle",
}, },
}, },
opts = { opts = {

View File

@ -122,7 +122,7 @@ return {
}, },
"JoosepAlviste/nvim-ts-context-commentstring", "JoosepAlviste/nvim-ts-context-commentstring",
"nvim-treesitter/nvim-treesitter-textobjects", "nvim-treesitter/nvim-treesitter-textobjects",
"RRethy/nvim-treesitter-endwise" "RRethy/nvim-treesitter-endwise",
}, },
config = function() config = function()
local treesitter_dir = vim.fn.stdpath("data") .. "/treesitter" local treesitter_dir = vim.fn.stdpath("data") .. "/treesitter"
@ -180,7 +180,7 @@ return {
enable = true, enable = true,
}, },
endwise = { endwise = {
enable = true enable = true,
}, },
textobjects = { textobjects = {
select = { select = {
@ -234,7 +234,6 @@ return {
}, },
include_surrounding_whitespace = true, include_surrounding_whitespace = true,
}, },
}) })
end, end,
}, },

View File

@ -51,5 +51,4 @@ U.title_case = function(str)
return string.gsub(str, "(%a)([%w_']*)", inner) return string.gsub(str, "(%a)([%w_']*)", inner)
end end
return U return U