fix: sioyek and neomutt integration to neovim
This commit is contained in:
parent
26386b2ea7
commit
937ab7e510
5 changed files with 51 additions and 20 deletions
11
bin/neomutt-open-message
Executable file
11
bin/neomutt-open-message
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# Open a specific message in neomutt by message ID
|
||||
# Usage: neomutt-open-message <message-id>
|
||||
|
||||
message_id="$1"
|
||||
if [[ -z $message_id ]]; then
|
||||
echo "Usage: neomutt-open-message <message-id>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec neomutt -e "push \"<vfolder-from-query>id:${message_id}<enter><display-message>\""
|
||||
|
|
@ -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" <<EOF
|
||||
#!/bin/bash
|
||||
export PATH="/etc/profiles/per-user/\$USER/bin:/run/current-system/sw/bin:\$PATH"
|
||||
export NOTMUCH_CONFIG="\$HOME/.config/notmuch/config"
|
||||
rm -f "$tmpscript"
|
||||
exec neomutt -f '$notmuch_url'
|
||||
EOF
|
||||
chmod +x "$tmpscript"
|
||||
|
||||
if [[ "$(uname)" == "Darwin" ]]; then
|
||||
aerospace workspace 8
|
||||
open -na Ghostty --args --title="Mail" -e "$tmpscript"
|
||||
open -na Ghostty --args -e "$SCRIPT_DIR/path-shim" "$SCRIPT_DIR/neomutt-open-message" "$message_id"
|
||||
else
|
||||
# Linux (i3/sway)
|
||||
if command -v swaymsg &>/dev/null; then
|
||||
swaymsg workspace 8
|
||||
ghostty --title="Mail" -e "$tmpscript" &
|
||||
ghostty -e neomutt -e "push \"<vfolder-from-query>id:${message_id}<enter><display-message>\"" &
|
||||
elif command -v i3-msg &>/dev/null; then
|
||||
i3-msg workspace 8
|
||||
ghostty --title="Mail" -e "$tmpscript" &
|
||||
ghostty -e neomutt -e "push \"<vfolder-from-query>id:${message_id}<enter><display-message>\"" &
|
||||
else
|
||||
rm -f "$tmpscript"
|
||||
exec neomutt -f "$notmuch_url"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -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 '<exit><quit>'" -e "macro index q '<quit>'" -e "push \"<vfolder-from-query>id:%s<enter><display-message>\""]],
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -12,7 +12,19 @@ next_page J
|
|||
previous_page K
|
||||
screen_down <C-d>
|
||||
screen_up <C-u>
|
||||
goto_page_with_page_number g
|
||||
screen_down <C-f>
|
||||
screen_up <C-b>
|
||||
goto_page_with_page_number <C-g>
|
||||
goto_beginning gg
|
||||
goto_end G
|
||||
|
||||
# Chapter navigation (like vim [[ ]])
|
||||
next_chapter ]]
|
||||
prev_chapter [[
|
||||
|
||||
# History navigation (like vim jumplist)
|
||||
prev_state <C-o>
|
||||
next_state <tab>
|
||||
|
||||
# Scroll
|
||||
screen_down <space>
|
||||
|
|
@ -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 <F7>
|
|||
|
||||
# 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 <F4>
|
||||
synctex_under_ruler <return>
|
||||
|
||||
# Color mode toggle
|
||||
toggle_dark_mode <C-i>
|
||||
|
|
@ -57,10 +78,17 @@ toggle_custom_color <C-r>
|
|||
|
||||
# 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 <tab>
|
||||
overview <S-tab>
|
||||
|
|
|
|||
Loading…
Reference in a new issue