feat(nvim): telescope style/autocmd
This commit is contained in:
parent
3c42ae4797
commit
7499e4b345
4 changed files with 72 additions and 69 deletions
|
@ -12,16 +12,44 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
|||
desc = "Highlight yanked text",
|
||||
})
|
||||
|
||||
local trnuGroup = vim.api.nvim_create_augroup("toggleRnu", {})
|
||||
vim.api.nvim_create_autocmd("InsertEnter,BufLeave,WinLeave,FocusLost", {
|
||||
callback = function()
|
||||
vim.opt_local.relativenumber = false
|
||||
local numbertoggle = vim.api.nvim_create_augroup("numbertoggle", {})
|
||||
local ignore_ft = { "alpha", "TelescopePrompt", "" }
|
||||
|
||||
---@param callback fun(): nil
|
||||
local ft_guard = function(callback)
|
||||
if not vim.tbl_contains(ignore_ft, vim.bo.filetype) then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "InsertEnter", "BufLeave", "WinLeave", "FocusLost" },
|
||||
{
|
||||
callback = function()
|
||||
ft_guard(function()
|
||||
vim.opt_local.rnu = false
|
||||
end)
|
||||
end,
|
||||
group = numbertoggle,
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "InsertLeave", "BufEnter", "WinEnter", "FocusGained" },
|
||||
{
|
||||
callback = function()
|
||||
ft_guard(function()
|
||||
vim.opt_local.rnu = true
|
||||
end)
|
||||
end,
|
||||
group = numbertoggle,
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd({ "CmdlineEnter", "CmdlineLeave" }, {
|
||||
callback = function(data)
|
||||
ft_guard(function()
|
||||
vim.opt.rnu = data.event == "CmdlineLeave"
|
||||
vim.cmd("redraw")
|
||||
end)
|
||||
end,
|
||||
group = trnuGroup,
|
||||
})
|
||||
vim.api.nvim_create_autocmd("InsertLeave,BufEnter,WinEnter,FocusGained", {
|
||||
callback = function()
|
||||
vim.opt_local.relativenumber = true
|
||||
end,
|
||||
group = trnuGroup,
|
||||
group = numbertoggle,
|
||||
})
|
||||
|
|
|
@ -37,63 +37,27 @@ vim.o.signcolumn = "yes:1"
|
|||
-- hide search notices, intro
|
||||
vim.opt.shortmess:append("sI")
|
||||
|
||||
-- stylua: ignore
|
||||
local borderchars = {
|
||||
single = {
|
||||
single = {
|
||||
style = "single",
|
||||
vert = "│",
|
||||
vertleft = "┤",
|
||||
vertright = "├",
|
||||
horiz = "─",
|
||||
horizup = "┴",
|
||||
horizdown = "┬",
|
||||
verthoriz = "┼",
|
||||
topleft = "┌",
|
||||
topright = "┐",
|
||||
botleft = "└",
|
||||
botright = "┘",
|
||||
vert = "│", vertleft = "┤", vertright = "├", horiz = "─", horizup = "┴", horizdown = "┬", verthoriz = "┼", topleft = "┌", topright = "┐", botleft = "└", botright = "┘"
|
||||
},
|
||||
double = {
|
||||
double = {
|
||||
style = "double",
|
||||
vert = "║",
|
||||
vertleft = "╣",
|
||||
vertright = "╠",
|
||||
horiz = "═",
|
||||
horizup = "╩",
|
||||
horizdown = "╦",
|
||||
verthoriz = "╬",
|
||||
topleft = "╔",
|
||||
topright = "╗",
|
||||
botleft = "╚",
|
||||
botright = "╝",
|
||||
vert = "║", vertleft = "╣", vertright = "╠", horiz = "═", horizup = "╩", horizdown = "╦", verthoriz = "╬", topleft = "╔", topright = "╗", botleft = "╚", botright = "╝"
|
||||
},
|
||||
rounded = {
|
||||
style = "rounded",
|
||||
vert = "│",
|
||||
vertleft = "┤",
|
||||
vertright = "├",
|
||||
horiz = "─",
|
||||
horizup = "┴",
|
||||
horizdown = "┬",
|
||||
verthoriz = "┼",
|
||||
topleft = "╭",
|
||||
topright = "╮",
|
||||
botleft = "╰",
|
||||
botright = "╯",
|
||||
vert = "│", vertleft = "┤", vertright = "├", horiz = "─", horizup = "┴", horizdown = "┬", verthoriz = "┼", topleft = "╭", topright = "╮", botleft = "╰", botright = "╯"
|
||||
},
|
||||
}
|
||||
|
||||
-- my custom borderchars
|
||||
vim.g.bc = borderchars.rounded
|
||||
-- drawing characters for splits
|
||||
vim.opt.fillchars:append({
|
||||
horiz = vim.g.bc.horiz,
|
||||
horizup = vim.g.bc.horizup,
|
||||
horizdown = vim.g.bc.horizdown,
|
||||
vert = vim.g.bc.vert,
|
||||
vertright = vim.g.bc.vertright,
|
||||
vertleft = vim.g.bc.vertleft,
|
||||
verthoriz = vim.g.bc.verthoriz,
|
||||
})
|
||||
|
||||
-- stylua: ignore
|
||||
vim.opt.fillchars:append({ horiz = vim.g.bc.horiz, horizup = vim.g.bc.horizup, horizdown = vim.g.bc.horizdown, vert = vim.g.bc.vert, vertright = vim.g.bc.vertright, vertleft = vim.g.bc.vertleft, verthoriz = vim.g.bc.verthoriz })
|
||||
|
||||
if vim.g.neovide then
|
||||
vim.g.neovide_refresh_rate = 60
|
||||
|
|
|
@ -2,11 +2,9 @@
|
|||
return {
|
||||
{
|
||||
"f-person/auto-dark-mode.nvim",
|
||||
cond = vim.fn.has("mac"),
|
||||
config = function()
|
||||
local autodm = require("auto-dark-mode")
|
||||
if vim.fn.has("mac") ~= 1 then
|
||||
return
|
||||
end
|
||||
|
||||
local update_neovide_background = function()
|
||||
if not vim.g.neovide then
|
||||
|
|
|
@ -1,3 +1,20 @@
|
|||
local bc = vim.g.bc
|
||||
|
||||
-- stylua: ignore
|
||||
local no_preview = function()
|
||||
return 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 },
|
||||
results = { bc.horiz, bc.vert, bc.horiz, bc.vert, bc.vertright, bc.vertleft, bc.botright, bc.botleft },
|
||||
preview = { bc.horiz, bc.vert, bc.horiz, bc.vert, bc.topleft, bc.topright, bc.botright, bc.botleft },
|
||||
},
|
||||
width = 0.8,
|
||||
previewer = false,
|
||||
prompt_title = false,
|
||||
})
|
||||
end
|
||||
|
||||
---@type LazySpec[]
|
||||
return {
|
||||
{
|
||||
|
@ -30,16 +47,12 @@ return {
|
|||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
multi_icon = "│",
|
||||
borderchars = {
|
||||
vim.g.bc.horiz,
|
||||
vim.g.bc.vert,
|
||||
vim.g.bc.horiz,
|
||||
vim.g.bc.vert,
|
||||
vim.g.bc.topleft,
|
||||
vim.g.bc.topright,
|
||||
vim.g.bc.botright,
|
||||
vim.g.bc.botleft,
|
||||
},
|
||||
-- stylua: ignore
|
||||
borderchars = { bc.horiz, bc.vert, bc.horiz, bc.vert, bc.topleft, bc.topright, bc.botright, bc.botleft },
|
||||
},
|
||||
pickers = {
|
||||
find_files = no_preview(),
|
||||
live_grep = no_preview(),
|
||||
},
|
||||
extensions = {
|
||||
file_browser = {
|
||||
|
|
Loading…
Reference in a new issue