From 937ab7e51078d7918d12418e82a93cba4b04ced1 Mon Sep 17 00:00:00 2001 From: Ray Andrew Date: Fri, 12 Dec 2025 13:22:35 -0600 Subject: [PATCH] fix: sioyek and neomutt integration to neovim --- bin/neomutt-open-message | 11 +++++++++++ bin/open-message-link | 18 +++--------------- config/nvim/init.lua | 8 ++++++-- config/nvim/lua/vimtex.lua | 2 +- config/sioyek/keys_user.config | 32 ++++++++++++++++++++++++++++++-- 5 files changed, 51 insertions(+), 20 deletions(-) create mode 100755 bin/neomutt-open-message diff --git a/bin/neomutt-open-message b/bin/neomutt-open-message new file mode 100755 index 0000000..610f1e9 --- /dev/null +++ b/bin/neomutt-open-message @@ -0,0 +1,11 @@ +#!/bin/bash +# Open a specific message in neomutt by message ID +# Usage: neomutt-open-message + +message_id="$1" +if [[ -z $message_id ]]; then + echo "Usage: neomutt-open-message " >&2 + exit 1 +fi + +exec neomutt -e "push \"id:${message_id}\"" diff --git a/bin/open-message-link b/bin/open-message-link index e2aa6d3..51d53a4 100755 --- a/bin/open-message-link +++ b/bin/open-message-link @@ -26,30 +26,18 @@ notmuch_url="notmuch://?query=id:${message_id}" if $open_in_current; then exec neomutt -f "$notmuch_url" else - # Create a temp script with PATH setup embedded - tmpscript=$(mktemp /tmp/open-mail-XXXXXX.sh) - cat >"$tmpscript" </dev/null; then swaymsg workspace 8 - ghostty --title="Mail" -e "$tmpscript" & + ghostty -e neomutt -e "push \"id:${message_id}\"" & elif command -v i3-msg &>/dev/null; then i3-msg workspace 8 - ghostty --title="Mail" -e "$tmpscript" & + ghostty -e neomutt -e "push \"id:${message_id}\"" & else - rm -f "$tmpscript" exec neomutt -f "$notmuch_url" fi fi diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 918313f..c7a9185 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -72,16 +72,20 @@ now(function() require('vimtex').setup() end) now(function() local function open_neomutt_link(url) local message_id = url:gsub('^neomutt://', '') - vim.notify('Opening: ' .. message_id, vim.log.levels.INFO) + -- vim.notify('Opening: ' .. message_id, vim.log.levels.INFO) -- Use vfolder-from-query then display the message (hide sidebar and index, q quits directly) -- Note: nvim terminal doesn't support neomutt's directcolor, so we disable colors for clean display local search_cmd = string.format( [[neomutt -e "set color_directcolor=no sidebar_visible=no pager_index_lines=0" -e "color normal default default" -e "color hdrdefault default default" -e "color quoted default default" -e "color signature default default" -e "color attachment default default" -e "color header default default '.*'" -e "color body default default '.*'" -e "macro pager q ''" -e "macro index q ''" -e "push \"id:%s\""]], message_id ) + require('snacks').terminal(search_cmd, { win = { position = 'bottom', height = 0.4 }, }) + + -- local script = vim.env.HOME .. '/dotfiles/bin/open-message-link' + -- vim.fn.jobstart({ script, url }, { detach = true }) end vim.api.nvim_create_user_command( @@ -95,7 +99,7 @@ now(function() vim.api.nvim_create_autocmd('BufEnter', { pattern = '*.md', callback = function() - vim.keymap.set('n', 'gl', function() + vim.keymap.set('n', 'gx', function() local line = vim.api.nvim_get_current_line() local url = line:match 'neomutt://[^%)%s>]+' if url then diff --git a/config/nvim/lua/vimtex.lua b/config/nvim/lua/vimtex.lua index 853ae5b..8cebe23 100644 --- a/config/nvim/lua/vimtex.lua +++ b/config/nvim/lua/vimtex.lua @@ -13,7 +13,7 @@ function M.setup() -- Compiler settings vim.g.vimtex_compiler_method = 'latexmk' vim.g.vimtex_compiler_latexmk = { - build_dir = '', + build_dir = 'build', callback = 1, continuous = 1, executable = 'latexmk', diff --git a/config/sioyek/keys_user.config b/config/sioyek/keys_user.config index e30f0ab..17c3dba 100644 --- a/config/sioyek/keys_user.config +++ b/config/sioyek/keys_user.config @@ -12,7 +12,19 @@ next_page J previous_page K screen_down screen_up -goto_page_with_page_number g +screen_down +screen_up +goto_page_with_page_number +goto_beginning gg +goto_end G + +# Chapter navigation (like vim [[ ]]) +next_chapter ]] +prev_chapter [[ + +# History navigation (like vim jumplist) +prev_state +next_state # Scroll screen_down @@ -23,6 +35,12 @@ search / next_item n prev_item N +# Copy +copy y + +# Command mode +command : + # Zoom zoom_in + zoom_in = @@ -33,6 +51,7 @@ fit_to_page_width_smart e # Bookmarks add_bookmark m goto_bookmark ' +delete_bookmark dm # Highlights - mouse select text, then h + letter for color add_highlight H @@ -49,7 +68,9 @@ toggle_visual_scroll # Synctex (for LaTeX integration) # F4 toggles synctex mode, then right-click on text jumps to source +# Use v to start visual mark, then Enter to jump to source in editor toggle_synctex +synctex_under_ruler # Color mode toggle toggle_dark_mode @@ -57,10 +78,17 @@ toggle_custom_color # Open/close quit q +quit ZZ +quit ZQ open_document o +# View +rotate_clockwise r +rotate_counterclockwise R +toggle_fullscreen F + # Portal (linked view) portal p # Overview (thumbnail view) -overview +overview