feat(sioyek/nvim): synctex
This commit is contained in:
parent
26492351d5
commit
f969cacdff
3 changed files with 30 additions and 24 deletions
|
|
@ -300,6 +300,7 @@ return {
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
extension = { puml = 'plantuml', pu = 'plantuml' },
|
extension = { puml = 'plantuml', pu = 'plantuml' },
|
||||||
})
|
})
|
||||||
|
vim.fn.serverstart('/tmp/nvim-preview.sock')
|
||||||
vim.api.nvim_create_autocmd('User', {
|
vim.api.nvim_create_autocmd('User', {
|
||||||
pattern = 'PreviewCompileSuccess',
|
pattern = 'PreviewCompileSuccess',
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
|
|
@ -312,10 +313,7 @@ return {
|
||||||
plantuml = true,
|
plantuml = true,
|
||||||
mermaid = true,
|
mermaid = true,
|
||||||
latex = {
|
latex = {
|
||||||
open = {
|
open = { 'sioyek', '--instance-name', 'preview' },
|
||||||
'sioyek',
|
|
||||||
'--instance-name', 'preview',
|
|
||||||
},
|
|
||||||
output = function(ctx)
|
output = function(ctx)
|
||||||
return vim.fn.fnamemodify(ctx.file, ':h')
|
return vim.fn.fnamemodify(ctx.file, ':h')
|
||||||
.. '/build/'
|
.. '/build/'
|
||||||
|
|
@ -337,22 +335,24 @@ return {
|
||||||
end,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
{ '<leader>p', '<cmd>Preview toggle<cr>' },
|
{ '<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,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
after = function()
|
||||||
|
local function forward_search()
|
||||||
|
local pdf = synctex_pdf[vim.api.nvim_get_current_buf()]
|
||||||
|
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
|
||||||
|
vim.api.nvim_create_autocmd('CursorHold', {
|
||||||
|
pattern = '*.tex',
|
||||||
|
callback = forward_search,
|
||||||
|
})
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@
|
||||||
"rev": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519",
|
"rev": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519",
|
||||||
"src": "https://github.com/lewis6991/gitsigns.nvim"
|
"src": "https://github.com/lewis6991/gitsigns.nvim"
|
||||||
},
|
},
|
||||||
|
"gruvbox-material": {
|
||||||
|
"rev": "790afe9dd085aa04eccd1da3626c5fa05c620e53",
|
||||||
|
"src": "https://github.com/sainnhe/gruvbox-material"
|
||||||
|
},
|
||||||
"guard-collection": {
|
"guard-collection": {
|
||||||
"rev": "edf6c86c06badc972964dadb7fd469022690cbf0",
|
"rev": "edf6c86c06badc972964dadb7fd469022690cbf0",
|
||||||
"src": "https://github.com/nvimdev/guard-collection"
|
"src": "https://github.com/nvimdev/guard-collection"
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,9 @@ let
|
||||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
wrapProgram $out/bin/sioyek \
|
wrapProgram $out/bin/sioyek \
|
||||||
--set QT_QPA_PLATFORM xcb
|
--set QT_QPA_PLATFORM xcb \
|
||||||
|
--add-flags "--execute-command toggle_statusbar" \
|
||||||
|
--add-flags "--execute-command toggle_synctex"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
@ -145,14 +147,14 @@ in
|
||||||
toggle_statusbar b
|
toggle_statusbar b
|
||||||
|
|
||||||
close_window q
|
close_window q
|
||||||
|
|
||||||
|
synctex_under_cursor i
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
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;toggle_synctex
|
|
||||||
|
|
||||||
page_separator_width 10
|
page_separator_width 10
|
||||||
should_launch_new_window 1
|
should_launch_new_window 1
|
||||||
|
|
||||||
|
|
@ -161,7 +163,7 @@ 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>"'
|
inverse_search_command nvim --server /tmp/nvim-preview.sock --remote-expr "execute('b +%2 %1')"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue