This commit is contained in:
Barrett Ruth 2026-03-05 19:18:58 -05:00
parent feba4f72e1
commit 9552374f45
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
4 changed files with 47 additions and 2204 deletions

View file

@ -57,6 +57,7 @@ local function new_git_status()
end
local git_status = new_git_status()
local synctex_pdf = {}
return {
{
@ -80,13 +81,13 @@ return {
'barrettruth/canola.nvim',
enabled = true,
after = function()
require('oil').setup({
require('canola').setup({
skip_confirm_for_simple_edits = true,
prompt_save_on_select_new_entry = false,
float = { border = 'single' },
view_options = {
is_hidden_file = function(name, bufnr)
local dir = require('oil').get_current_dir(bufnr)
local dir = require('canola').get_current_dir(bufnr)
local is_dotfile = vim.startswith(name, '.')
and name ~= '..'
if not dir then
@ -120,7 +121,7 @@ return {
},
})
-- TODO: better way to do this allowing vim.g.canola as that's it
local refresh = require('oil.actions').refresh
local refresh = require('canola.actions').refresh
local orig_refresh = refresh.callback
refresh.callback = function(...)
git_status = new_git_status()
@ -132,24 +133,25 @@ return {
if ft == '' then
local path = vim.fn.expand('%:p')
if vim.fn.isdirectory(path) == 1 then
vim.cmd('Oil ' .. path)
vim.cmd('Canola ' .. path)
end
end
end,
group = vim.api.nvim_create_augroup('AOil', { clear = true }),
group = vim.api.nvim_create_augroup('ACanola', { clear = true }),
})
end,
event = 'DeferredUIEnter',
keys = {
{ '-', '<cmd>e .<cr>' },
{ '_', '<cmd>Oil<cr>' },
{ '_', '<cmd>Canola<cr>' },
},
},
{
'barrettruth/pending.nvim',
before = function()
vim.g.pending = { debug = false }
vim.g.pending = { debug = true }
end,
cmd = 'Pending',
keys = { { '<leader>P', '<cmd>Pending<cr>' } },
},
{
@ -298,17 +300,27 @@ return {
vim.filetype.add({
extension = { puml = 'plantuml', pu = 'plantuml' },
})
vim.api.nvim_create_autocmd('User', {
pattern = 'PreviewCompileSuccess',
callback = function(args)
synctex_pdf[args.data.bufnr] = args.data.output
end,
})
vim.g.preview = {
github = true,
typst = { open = { 'sioyek', '--new-instance' } },
plantuml = true,
mermaid = true,
latex = {
open = { 'sioyek', '--new-instance' },
open = {
'sioyek',
'--instance-name', 'preview',
},
output = function(ctx)
return ('build/%s.pdf'):format(
vim.fn.fnamemodify(ctx.file, ':t:r')
)
return vim.fn.fnamemodify(ctx.file, ':h')
.. '/build/'
.. vim.fn.fnamemodify(ctx.file, ':t:r')
.. '.pdf'
end,
args = function(ctx)
return {
@ -323,6 +335,24 @@ return {
},
}
end,
keys = { { '<leader>p', '<cmd>Preview toggle<cr>' } },
keys = {
{ '<leader>p', '<cmd>Preview toggle<cr>' },
{
'<leader>s',
function()
local bufnr = vim.api.nvim_get_current_buf()
local pdf = synctex_pdf[bufnr]
if pdf then
vim.fn.jobstart({
'sioyek',
'--instance-name', 'preview',
'--forward-search-file', vim.fn.expand('%:p'),
'--forward-search-line', tostring(vim.fn.line('.')),
pdf,
})
end
end,
},
},
},
}

View file

@ -24,10 +24,6 @@
"rev": "b650e976a927be6b46487a0a610b75af111376c5",
"src": "https://github.com/saghen/blink.cmp"
},
"cp.nvim": {
"rev": "24b088e8e9e71a484c0a9f36226e76471966d1e9",
"src": "https://github.com/barrettruth/cp.nvim"
},
"dial.nvim": {
"rev": "f2634758455cfa52a8acea6f142dcd6271a1bf57",
"src": "https://github.com/monaqa/dial.nvim"
@ -133,4 +129,4 @@
"src": "https://github.com/lervag/vimtex"
}
}
}
}

File diff suppressed because one or more lines are too long