feat(nvim) plugin peek

This commit is contained in:
thek4n 2023-12-30 00:00:35 +03:00
parent 92a1f63c9e
commit f34fdaf984
4 changed files with 28 additions and 5 deletions

View File

@ -26,7 +26,7 @@
addEmptyPathspec = false addEmptyPathspec = false
[alias] [alias]
a = "!git ls-files --exclude-standard -m --others -t | fzf | cut -d' ' -f2 | xargs git add" a = "!git ls-files --exclude-standard -m --others -t | fzf -m --bind ctrl-a:toggle-all | cut -d' ' -f2 | xargs git add"
d = diff d = diff
ds = diff --staged ds = diff --staged
dno = diff --name-only dno = diff --name-only

View File

@ -1,13 +1,16 @@
return { return {
'toppair/peek.nvim', 'toppair/peek.nvim',
enabled = vim.fn.executable "deno" == 1, event = { "VeryLazy" },
enabled = vim.fn.executable("deno") == 1,
ft = {'markdown'}, ft = {'markdown'},
keys = { keys = {
{ '<Leader>rr', "<cmd>lua require('peek').open()<CR>" } { '<Leader>rr', "<cmd>PeekOpen<CR>" }
}, },
build = 'deno task --quiet build:fast', build = 'deno task --quiet build:fast',
config = function() config = function()
require('peek').setup({ local peek = require('peek')
peek.setup({
auto_load = true, auto_load = true,
close_on_bdelete = true, close_on_bdelete = true,
syntax = true, syntax = true,
@ -18,5 +21,24 @@ return {
throttle_at = 200000, throttle_at = 200000,
throttle_time = 'auto', throttle_time = 'auto',
}) })
if vim.fn.executable("i3-msg") then
vim.api.nvim_create_user_command('PeekOpen', function()
if not peek.is_open() and vim.bo[vim.api.nvim_get_current_buf()].filetype == 'markdown' then
vim.fn.system('i3-msg split horizontal')
peek.open()
end
end, {})
vim.api.nvim_create_user_command('PeekClose', function()
if peek.is_open() then
peek.close()
vim.fn.system('i3-msg move left')
end
end, {})
else
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
vim.api.nvim_create_user_command("PeekClose", require("peek").close, {})
end
end, end,
} }

View File

@ -124,6 +124,7 @@ inactive-dim = 0.15
# focus-exclude = [] # focus-exclude = []
focus-exclude = [ focus-exclude = [
"class_g = 'firefox'", "class_g = 'firefox'",
"class_g = 'webview'",
"class_g = 'Cairo-clock'", "class_g = 'Cairo-clock'",
"class_g = 'Conky'" "class_g = 'Conky'"
]; ];