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.nvim": { "branch": "master", "commit": "00cf15074a2997487813672a75f946d2ead95eb0" },
"todo-comments.nvim": { "branch": "main", "commit": "09b0b17d824d2d56f02ff15967e8a2499a89c731" },
"toggleterm.nvim": { "branch": "main", "commit": "95204ece0f2a54c89c4395295432f9aeedca7b5f" },
"trouble.nvim": { "branch": "main", "commit": "2af0dd9767526410c88c628f1cbfcb6cf22dd683" },
"true-zen.nvim": { "branch": "main", "commit": "2b9e210e0d1a735e1fa85ec22190115dffd963aa" },
"vim-astro": { "branch": "main", "commit": "34732be5e9a5c28c2409f4490edf92d46d8b55a9" },

View file

@ -12,9 +12,30 @@ vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight yanked text",
})
local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", {})
local ignore_ft = { "alpha", "TelescopePrompt", "" }
vim.api.nvim_create_autocmd({ "RecordingEnter", "RecordingLeave" }, {
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
local ft_guard = function(callback)
if not vim.tbl_contains(ignore_ft, vim.bo.filetype) then

View file

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

View file

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

View file

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

View file

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