feat(nvim): various tweaks

This commit is contained in:
winston 2023-06-17 22:09:36 +02:00
parent 7499e4b345
commit 52fbb29575
Signed by: winston
GPG key ID: 3786770EDBC2B481
8 changed files with 64 additions and 35 deletions

View file

@ -1,10 +0,0 @@
#!/bin/sh
# Helps open a file with xdg-open from mutt in a external program without weird side effects.
tempdir="${XDG_CACHE_HOME}/neomutt/files"
file="$tempdir/${1##*/}"
[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open"
mkdir -p "$tempdir"
cp -f "$1" "$file"
$opener "$file" >/dev/null 2>&1
find "${tempdir:?}" -mtime +1 -type f -delete

View file

@ -67,6 +67,7 @@
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
"telescope.nvim": { "branch": "master", "commit": "00cf15074a2997487813672a75f946d2ead95eb0" }, "telescope.nvim": { "branch": "master", "commit": "00cf15074a2997487813672a75f946d2ead95eb0" },
"todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" }, "todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" },
"toggleterm.nvim": { "branch": "main", "commit": "95204ece0f2a54c89c4395295432f9aeedca7b5f" },
"trouble.nvim": { "branch": "main", "commit": "2af0dd9767526410c88c628f1cbfcb6cf22dd683" }, "trouble.nvim": { "branch": "main", "commit": "2af0dd9767526410c88c628f1cbfcb6cf22dd683" },
"true-zen.nvim": { "branch": "main", "commit": "2b9e210e0d1a735e1fa85ec22190115dffd963aa" }, "true-zen.nvim": { "branch": "main", "commit": "2b9e210e0d1a735e1fa85ec22190115dffd963aa" },
"vim-astro": { "branch": "main", "commit": "34732be5e9a5c28c2409f4490edf92d46d8b55a9" }, "vim-astro": { "branch": "main", "commit": "34732be5e9a5c28c2409f4490edf92d46d8b55a9" },

View file

@ -12,9 +12,30 @@ vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight yanked text", desc = "Highlight yanked text",
}) })
local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", {}) vim.api.nvim_create_autocmd({ "RecordingEnter", "RecordingLeave" }, {
local ignore_ft = { "alpha", "TelescopePrompt", "" } callback = function(data)
local msg = data.event == "RecordingEnter" and "Recording macro..."
or "Macro recorded"
vim.notify(msg, vim.log.levels.INFO, { title = "Macro" })
end,
desc = "Notify when recording macro",
})
local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", {})
local ignore_ft = {
"",
"alpha",
"fugitive",
"help",
"lazy",
"NeogitCommitView",
"NeogitConsole",
"NeogitStatus",
"NvimTree",
"TelescopePrompt",
"toggleterm",
"Trouble",
}
---@param callback fun(): nil ---@param callback fun(): nil
local ft_guard = function(callback) local ft_guard = function(callback)
if not vim.tbl_contains(ignore_ft, vim.bo.filetype) then if not vim.tbl_contains(ignore_ft, vim.bo.filetype) then

View file

@ -15,6 +15,7 @@ return {
comments = { "italic" }, comments = { "italic" },
conditionals = { "italic" }, conditionals = { "italic" },
}, },
term_colors = true,
integrations = { integrations = {
treesitter = true, treesitter = true,
native_lsp = { native_lsp = {
@ -75,6 +76,11 @@ return {
-- --
FidgetTitle = { fg = colors.subtext1 }, FidgetTitle = { fg = colors.subtext1 },
FidgetTask = { fg = colors.subtext0 }, FidgetTask = { fg = colors.subtext0 },
NotifyBackground = { bg = colors.base },
NotifyINFOBorder = { link = "NotifyInfoTitle" },
NotifyINFOIcon = { link = "NotifyINFOTitle" },
NotifyINFOTitle = { fg = colors.pink },
} }
end, end,
}, },

View file

@ -7,12 +7,15 @@ return {
space_char_blankline = " ", space_char_blankline = " ",
}) })
vim.g.indent_blankline_filetype_exclude = { vim.g.indent_blankline_filetype_exclude = {
"dashboard", "alpha",
"fugitive", "fugitive",
"help", "help",
"lazy", "lazy",
"NeogitCommitView",
"NeogitConsole",
"NeogitStatus",
"NvimTree", "NvimTree",
"neogitstatus", "TelescopePrompt",
"Trouble", "Trouble",
} }
end, end,

View file

@ -4,19 +4,10 @@ return {
"rcarriga/nvim-notify", "rcarriga/nvim-notify",
config = function() config = function()
local notify = require("notify") local notify = require("notify")
local stages = require("notify.stages.static")("top_down")
notify.setup({ notify.setup({
delay = 5000, timeout = 1000,
stages = { render = "compact",
function(...) stages = "fade",
local opts = stages[1](...)
if opts then
opts.border = vim.g.bc.style
end
return opts
end,
unpack(stages, 2),
},
}) })
vim.notify = notify vim.notify = notify
end, end,

View file

@ -1,8 +1,8 @@
local bc = vim.g.bc local bc = vim.g.bc
-- stylua: ignore -- stylua: ignore
local no_preview = function() local no_preview = function(opts)
return require("telescope.themes").get_dropdown({ local defaults = require("telescope.themes").get_dropdown({
borderchars = { borderchars = {
{ bc.horiz, bc.vert, bc.horiz, bc.vert, bc.topleft, bc.topright, bc.botright, bc.botleft }, { bc.horiz, bc.vert, bc.horiz, bc.vert, bc.topleft, bc.topright, bc.botright, bc.botleft },
prompt = { bc.horiz, bc.vert, " ", bc.vert, bc.topleft, bc.topright, bc.vert, bc.vert }, prompt = { bc.horiz, bc.vert, " ", bc.vert, bc.topleft, bc.topright, bc.vert, bc.vert },
@ -12,7 +12,9 @@ local no_preview = function()
width = 0.8, width = 0.8,
previewer = false, previewer = false,
prompt_title = false, prompt_title = false,
results_title = false,
}) })
return vim.tbl_deep_extend("force", defaults, opts or {})
end end
---@type LazySpec[] ---@type LazySpec[]
@ -21,14 +23,14 @@ return {
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", { "nvim-lua/plenary.nvim" },
"nvim-tree/nvim-web-devicons", { "nvim-tree/nvim-web-devicons" },
"GustavoKatel/telescope-asynctasks.nvim", { "GustavoKatel/telescope-asynctasks.nvim" },
"nvim-telescope/telescope-file-browser.nvim", { "nvim-telescope/telescope-file-browser.nvim" },
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, { "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
"nvim-telescope/telescope-project.nvim", { "nvim-telescope/telescope-project.nvim" },
"nvim-telescope/telescope-ui-select.nvim", { "nvim-telescope/telescope-ui-select.nvim" },
{ "pwntester/octo.nvim", opts = {} }, { "pwntester/octo.nvim", opts = {} },
}, },
@ -52,7 +54,10 @@ return {
}, },
pickers = { pickers = {
find_files = no_preview(), find_files = no_preview(),
live_grep = no_preview(), live_grep = no_preview({
previewer = true,
}),
load_session = no_preview(),
}, },
extensions = { extensions = {
file_browser = { file_browser = {
@ -65,6 +70,7 @@ return {
override_file_sorter = true, override_file_sorter = true,
case_mode = "smart_case", case_mode = "smart_case",
}, },
["ui-select"] = no_preview(),
}, },
}) })

View file

@ -0,0 +1,11 @@
---@type LazyPluginSpec[]
return {
{
"akinsho/toggleterm.nvim",
version = "*",
config = {
open_mapping = "<C-t>",
shade_terminals = false,
},
},
}