feat: add sioyek config

This commit is contained in:
Ray Andrew 2025-12-11 19:25:01 -06:00
parent 380fa002c2
commit a23a3f8a50
Signed by: rayandrew
SSH key fingerprint: SHA256:XYrYrxF0Z3A72n8P/p6mqPRNQZT22F88XcLsG+kX4xw
12 changed files with 359 additions and 0 deletions

43
bin/nvim-vimtex-callback Executable file
View file

@ -0,0 +1,43 @@
#!/bin/bash
# VimTeX inverse search callback wrapper
# This script is called by sioyek for inverse search
# It uses nvr to connect to the running Neovim instance
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SERVERNAME_FILE="/tmp/vimtex-servername"
# VimTeX calls: nvim --headless -c "VimtexInverseSearch LINE 'FILE'"
# Parse the VimtexInverseSearch command to extract LINE and FILE
# Then use nvr --remote +LINE FILE which is more reliable
CMD=""
while [[ $# -gt 0 ]]; do
case $1 in
--headless)
shift
;;
-c)
shift
CMD="$1"
shift
;;
*)
shift
;;
esac
done
if [[ -n $CMD ]]; then
# Extract line number and file from: VimtexInverseSearch LINE 'FILE'
if [[ $CMD =~ VimtexInverseSearch\ ([0-9]+)\ \'(.+)\' ]]; then
LINE="${BASH_REMATCH[1]}"
FILE="${BASH_REMATCH[2]}"
if [[ -f $SERVERNAME_FILE ]]; then
SERVERNAME=$(cat "$SERVERNAME_FILE")
exec "$SCRIPT_DIR/path-shim" nvr --servername "$SERVERNAME" --remote-silent +"$LINE" "$FILE"
else
exec "$SCRIPT_DIR/path-shim" nvr --remote-silent +"$LINE" "$FILE"
fi
fi
fi

View file

@ -61,10 +61,13 @@ add { source = 'R-nvim/R.nvim', depends = { 'nvim-treesitter/nvim-treesitter' }
add 'nvim-treesitter/nvim-treesitter' add 'nvim-treesitter/nvim-treesitter'
add 'nvim-treesitter/nvim-treesitter-textobjects' add 'nvim-treesitter/nvim-treesitter-textobjects'
add { source = 'nvim-pack/nvim-spectre', depends = { 'nvim-lua/plenary.nvim' } } add { source = 'nvim-pack/nvim-spectre', depends = { 'nvim-lua/plenary.nvim' } }
add 'lervag/vimtex'
-- color themes -- color themes
add 'EdenEast/nightfox.nvim' add 'EdenEast/nightfox.nvim'
now(function() require('vimtex').setup() end)
now(function() now(function()
require('mail-count').setup { require('mail-count').setup {
accounts = { accounts = {
@ -311,6 +314,8 @@ later(function()
'diff', 'diff',
'git_rebase', 'git_rebase',
'gitcommit', 'gitcommit',
'latex',
'bibtex',
}, },
auto_install = true, auto_install = true,
highlight = { enable = true }, highlight = { enable = true },

View file

@ -0,0 +1,85 @@
-- VimTeX configuration with Sioyek as PDF viewer
local M = {}
function M.setup()
-- Use Sioyek as the PDF viewer
vim.g.vimtex_view_method = 'sioyek'
-- Sioyek executable (use 'sioyek' if in PATH)
vim.g.vimtex_view_sioyek_exe = 'sioyek'
-- Enable synctex for forward/inverse search
vim.g.vimtex_view_sioyek_sync = 1
-- Use custom wrapper script for inverse search (uses nvr instead of --headless)
vim.g.vimtex_callback_progpath = vim.fn.expand '~/dotfiles/bin/nvim-vimtex-callback'
-- Compiler settings
vim.g.vimtex_compiler_method = 'latexmk'
vim.g.vimtex_compiler_latexmk = {
build_dir = '',
callback = 1,
continuous = 1,
executable = 'latexmk',
options = {
'-verbose',
'-file-line-error',
'-synctex=1',
'-interaction=nonstopmode',
},
}
-- Quickfix settings
vim.g.vimtex_quickfix_mode = 0 -- Don't open quickfix automatically
-- Disable default mappings, we'll set our own
vim.g.vimtex_mappings_enabled = 1
-- TOC settings
vim.g.vimtex_toc_config = {
split_pos = 'vert leftabove',
split_width = 40,
show_help = 0,
}
-- Fold settings
vim.g.vimtex_fold_enabled = 0
-- Set up filetype-specific keymaps
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'tex', 'latex' },
callback = function()
local opts = { buffer = true, silent = true }
-- Compilation
vim.keymap.set('n', '<localleader>ll', '<cmd>VimtexCompile<cr>', vim.tbl_extend('force', opts, { desc = 'Compile LaTeX' }))
vim.keymap.set('n', '<localleader>lk', '<cmd>VimtexStop<cr>', vim.tbl_extend('force', opts, { desc = 'Stop compilation' }))
vim.keymap.set('n', '<localleader>lc', '<cmd>VimtexClean<cr>', vim.tbl_extend('force', opts, { desc = 'Clean aux files' }))
vim.keymap.set('n', '<localleader>lC', '<cmd>VimtexClean!<cr>', vim.tbl_extend('force', opts, { desc = 'Clean all files' }))
-- View PDF (forward search) - save servername first for inverse search
vim.keymap.set('n', '<localleader>lv', function()
-- Save servername to file for inverse search callback
local servername = vim.v.servername
local f = io.open('/tmp/vimtex-servername', 'w')
if f then
f:write(servername)
f:close()
end
vim.cmd 'VimtexView'
end, vim.tbl_extend('force', opts, { desc = 'View PDF (forward search)' }))
-- TOC
vim.keymap.set('n', '<localleader>lt', '<cmd>VimtexTocToggle<cr>', vim.tbl_extend('force', opts, { desc = 'Toggle TOC' }))
-- Errors
vim.keymap.set('n', '<localleader>le', '<cmd>VimtexErrors<cr>', vim.tbl_extend('force', opts, { desc = 'Show errors' }))
-- Info
vim.keymap.set('n', '<localleader>li', '<cmd>VimtexInfo<cr>', vim.tbl_extend('force', opts, { desc = 'VimTeX info' }))
vim.keymap.set('n', '<localleader>ls', '<cmd>VimtexStatus<cr>', vim.tbl_extend('force', opts, { desc = 'Compilation status' }))
end,
})
end
return M

3
config/sioyek/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
*.db
auto.config
*.txt

View file

@ -0,0 +1,65 @@
# Sioyek user keybindings
# Vim-like keybindings
# Navigation - use visual mark commands (works as scroll when no mark exists)
move_visual_mark_down j
move_visual_mark_up k
move_left h
move_right l
# Page navigation
next_page J
previous_page K
screen_down <C-d>
screen_up <C-u>
goto_page_with_page_number g
# Scroll
screen_down <space>
screen_up <S-space>
# Search
search /
next_item n
prev_item N
# Zoom
zoom_in +
zoom_in =
zoom_out -
fit_to_page_width w
fit_to_page_width_smart e
# Bookmarks
add_bookmark m
goto_bookmark '
# Highlights - mouse select text, then h + letter for color
add_highlight H
goto_next_highlight ]h
goto_prev_highlight [h
delete_highlight dh
# Table of contents
goto_toc t
# Visual mark - right-click or v to create, then j/k to move
visual_mark_under_cursor v
toggle_visual_scroll <F7>
# Synctex (for LaTeX integration)
synctex_under_cursor <C-click>
# Color mode toggle
toggle_dark_mode <C-i>
toggle_custom_color <C-r>
# Open/close
quit q
open_document o
# Portal (linked view)
portal p
# Overview (thumbnail view)
overview <tab>

View file

@ -0,0 +1,52 @@
# Sioyek user preferences
# Noctis Azureus Ghostty theme
# Precise hex to RGB (0.0-1.0) conversions:
# #051b29 -> 5/255=0.0196, 27/255=0.1059, 41/255=0.1608
# #041520 -> 4/255=0.0157, 21/255=0.0824, 32/255=0.1255
# #becfda -> 190/255=0.7451, 207/255=0.8118, 218/255=0.8549
# #49e9a6 -> 73/255=0.2863, 233/255=0.9137, 166/255=0.6510
# #e4b781 -> 228/255=0.8941, 183/255=0.7176, 129/255=0.5059
# #49ace9 -> 73/255=0.2863, 172/255=0.6745, 233/255=0.9137
# Background - deep blue #051b29
background_color 0.0196 0.1059 0.1608
dark_mode_background_color 0.0196 0.1059 0.1608
dark_mode_contrast 1.0
# Custom color mode (toggle with Ctrl+r)
custom_background_color 0.0196 0.1059 0.1608
custom_text_color 0.7451 0.8118 0.8549
# Search highlight (green #49e9a6)
search_highlight_color 0.2863 0.9137 0.6510
# Link color (blue #49ace9)
link_highlight_color 0.2863 0.6745 0.9137
# Text selection/highlight (yellow #e4b781)
text_highlight_color 0.8941 0.7176 0.5059
# Page separator
page_separator_width 2
page_separator_color 0.1569 0.2078 0.2431
# Status bar - darker blue #041520
ui_background_color 0.0157 0.0824 0.1255
ui_text_color 0.7451 0.8118 0.8549
# Startup - use custom color mode by default
should_launch_new_window 0
startup_commands toggle_custom_color
# Smooth scrolling
smooth_scroll_speed 3.0
smooth_scroll_drag 2500
# Zoom
default_zoom_level 1.0
zoom_inc_factor 1.2
# Inverse search - click PDF to jump to Neovim source
# VimTeX passes --inverse-search with servername, this is fallback
inverse_search_command nvr --remote-silent +%2 %1

45
config/zathura/zathurarc Normal file
View file

@ -0,0 +1,45 @@
# Noctis Azureus Ghostty theme for Zathura
set default-bg "#051b29"
set default-fg "#becfda"
set statusbar-bg "#041520"
set statusbar-fg "#becfda"
set inputbar-bg "#051b29"
set inputbar-fg "#becfda"
set notification-bg "#051b29"
set notification-fg "#49e9a6"
set notification-error-bg "#051b29"
set notification-error-fg "#e66533"
set notification-warning-bg "#051b29"
set notification-warning-fg "#e4b781"
set highlight-color "#e4b781"
set highlight-active-color "#49e9a6"
set completion-bg "#041520"
set completion-fg "#becfda"
set completion-highlight-bg "#0c3f5f"
set completion-highlight-fg "#becfda"
set index-bg "#051b29"
set index-fg "#becfda"
set index-active-bg "#0c3f5f"
set index-active-fg "#becfda"
set render-loading-bg "#051b29"
set render-loading-fg "#becfda"
# Recolor settings (inverts PDF colors to match theme)
set recolor "true"
# set recolor-reverse-video "true"
set recolor-keephue "true"
set recolor-lightcolor "#051b29"
set recolor-darkcolor "#becfda"
# set recolor-keephue "false"
# Selection settings
set selection-clipboard clipboard
set selection-notification true

View file

@ -12,6 +12,8 @@
./hammerspoon.nix ./hammerspoon.nix
./kitty.nix ./kitty.nix
./ghostty.nix ./ghostty.nix
./zathura.nix
./sioyek.nix
]; ];
options.custom.gui = with lib; { options.custom.gui = with lib; {

View file

@ -16,6 +16,7 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
(neovim.override { withNodeJs = true; }) (neovim.override { withNodeJs = true; })
tree-sitter tree-sitter
neovim-remote
]; ];
xdg.configFile."nvim".source = config.lib.file.mkOutOfStoreSymlink "${dots}/config/nvim"; xdg.configFile."nvim".source = config.lib.file.mkOutOfStoreSymlink "${dots}/config/nvim";

34
home/sioyek.nix Normal file
View file

@ -0,0 +1,34 @@
{
config,
pkgs,
lib,
dots,
...
}:
{
options.custom.gui = with lib; {
sioyek = {
enable = mkEnableOption "Enable sioyek";
};
};
config = lib.mkIf config.custom.gui.sioyek.enable (
lib.mkMerge [
{
home.packages = with pkgs; [
sioyek
];
}
# Linux uses ~/.config/sioyek
(lib.mkIf pkgs.stdenv.isLinux {
xdg.configFile."sioyek".source = config.lib.file.mkOutOfStoreSymlink "${dots}/config/sioyek";
})
# macOS uses ~/Library/Application Support/sioyek
(lib.mkIf pkgs.stdenv.isDarwin {
home.file."Library/Application Support/sioyek".source =
config.lib.file.mkOutOfStoreSymlink "${dots}/config/sioyek";
})
]
);
}

22
home/zathura.nix Normal file
View file

@ -0,0 +1,22 @@
{
config,
pkgs,
lib,
dots,
...
}:
{
options.custom.gui = with lib; {
zathura = {
enable = mkEnableOption "Enable zathura";
};
};
config = lib.mkIf config.custom.gui.zathura.enable {
home.packages = with pkgs; [
zathura
];
xdg.configFile."zathura".source = config.lib.file.mkOutOfStoreSymlink "${dots}/config/zathura";
};
}

View file

@ -99,6 +99,8 @@
ghostty.enable = true; ghostty.enable = true;
hammerspoon.enable = true; hammerspoon.enable = true;
kitty.enable = true; kitty.enable = true;
zathura.enable = true;
sioyek.enable = true;
}; };
email = { email = {
enable = true; enable = true;