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 end
local git_status = new_git_status() local git_status = new_git_status()
local synctex_pdf = {}
return { return {
{ {
@ -80,13 +81,13 @@ return {
'barrettruth/canola.nvim', 'barrettruth/canola.nvim',
enabled = true, enabled = true,
after = function() after = function()
require('oil').setup({ require('canola').setup({
skip_confirm_for_simple_edits = true, skip_confirm_for_simple_edits = true,
prompt_save_on_select_new_entry = false, prompt_save_on_select_new_entry = false,
float = { border = 'single' }, float = { border = 'single' },
view_options = { view_options = {
is_hidden_file = function(name, bufnr) 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, '.') local is_dotfile = vim.startswith(name, '.')
and name ~= '..' and name ~= '..'
if not dir then if not dir then
@ -120,7 +121,7 @@ return {
}, },
}) })
-- TODO: better way to do this allowing vim.g.canola as that's it -- 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 local orig_refresh = refresh.callback
refresh.callback = function(...) refresh.callback = function(...)
git_status = new_git_status() git_status = new_git_status()
@ -132,24 +133,25 @@ return {
if ft == '' then if ft == '' then
local path = vim.fn.expand('%:p') local path = vim.fn.expand('%:p')
if vim.fn.isdirectory(path) == 1 then if vim.fn.isdirectory(path) == 1 then
vim.cmd('Oil ' .. path) vim.cmd('Canola ' .. path)
end end
end end
end, end,
group = vim.api.nvim_create_augroup('AOil', { clear = true }), group = vim.api.nvim_create_augroup('ACanola', { clear = true }),
}) })
end, end,
event = 'DeferredUIEnter', event = 'DeferredUIEnter',
keys = { keys = {
{ '-', '<cmd>e .<cr>' }, { '-', '<cmd>e .<cr>' },
{ '_', '<cmd>Oil<cr>' }, { '_', '<cmd>Canola<cr>' },
}, },
}, },
{ {
'barrettruth/pending.nvim', 'barrettruth/pending.nvim',
before = function() before = function()
vim.g.pending = { debug = false } vim.g.pending = { debug = true }
end, end,
cmd = 'Pending',
keys = { { '<leader>P', '<cmd>Pending<cr>' } }, keys = { { '<leader>P', '<cmd>Pending<cr>' } },
}, },
{ {
@ -298,17 +300,27 @@ return {
vim.filetype.add({ vim.filetype.add({
extension = { puml = 'plantuml', pu = 'plantuml' }, 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 = { vim.g.preview = {
github = true, github = true,
typst = { open = { 'sioyek', '--new-instance' } }, typst = { open = { 'sioyek', '--new-instance' } },
plantuml = true, plantuml = true,
mermaid = true, mermaid = true,
latex = { latex = {
open = { 'sioyek', '--new-instance' }, open = {
'sioyek',
'--instance-name', 'preview',
},
output = function(ctx) output = function(ctx)
return ('build/%s.pdf'):format( return vim.fn.fnamemodify(ctx.file, ':h')
vim.fn.fnamemodify(ctx.file, ':t:r') .. '/build/'
) .. vim.fn.fnamemodify(ctx.file, ':t:r')
.. '.pdf'
end, end,
args = function(ctx) args = function(ctx)
return { return {
@ -323,6 +335,24 @@ return {
}, },
} }
end, 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", "rev": "b650e976a927be6b46487a0a610b75af111376c5",
"src": "https://github.com/saghen/blink.cmp" "src": "https://github.com/saghen/blink.cmp"
}, },
"cp.nvim": {
"rev": "24b088e8e9e71a484c0a9f36226e76471966d1e9",
"src": "https://github.com/barrettruth/cp.nvim"
},
"dial.nvim": { "dial.nvim": {
"rev": "f2634758455cfa52a8acea6f142dcd6271a1bf57", "rev": "f2634758455cfa52a8acea6f142dcd6271a1bf57",
"src": "https://github.com/monaqa/dial.nvim" "src": "https://github.com/monaqa/dial.nvim"
@ -133,4 +129,4 @@
"src": "https://github.com/lervag/vimtex" "src": "https://github.com/lervag/vimtex"
} }
} }
} }

File diff suppressed because one or more lines are too long

View file

@ -151,7 +151,7 @@ in
xdg.configFile."sioyek/prefs_user.config" = lib.mkIf sioyek { xdg.configFile."sioyek/prefs_user.config" = lib.mkIf sioyek {
text = '' text = ''
wheel_zoom_on_cursor 1 wheel_zoom_on_cursor 1
startup_commands show_statusbar 0 startup_commands show_statusbar 0;toggle_synctex_on
page_separator_width 10 page_separator_width 10
should_launch_new_window 1 should_launch_new_window 1
@ -160,6 +160,8 @@ in
font_size 18 font_size 18
status_bar_font_size 18 status_bar_font_size 18
inverse_search_command sh -c 'nvim --server "$NVIM" --remote-send ":e +%2 %1<CR>"'
''; '';
}; };