From hable at hs-bit.de Thu Mar 13 14:25:26 2025 From: hable at hs-bit.de (hable at hs-bit.de) Date: Thu, 13 Mar 2025 15:25:26 +0100 Subject: vim as editor Message-ID: Hello, I am working with mutt since 3 month and for 97.4% I am realy happy with it ? But there are the other 2.6% ? I am using tmux to observe several accounts ... very good solution. As editor I set a script that calls the vim-editor in a new tmux-window, so I can jump back to my INBOX independently of creating some messages in the background ? But this solution works ONLY if I create a new message! If I want to open a existing message in the background I can not jump back to the INBOX because mutt is blocking till I close the vim editor. In my settings I have the line: set editor='/home/schule/.config/mutt/bgedit-tmux.sh vim' for calling the vim in a new tmux window. Is there a difference how mutt calls the external editor when I create a new message and when I only edit a existing message? regards HS -- ================================ hs-bit.de Hable Siegfried Niedermayerstr. 4a D-84028 Landshut Tel.: ++49 (0) 871 9656545 Mail: info at hs-bit.de UST-ID: DE302479776 From cs at cskk.id.au Fri Mar 14 23:53:51 2025 From: cs at cskk.id.au (Cameron Simpson) Date: Sat, 15 Mar 2025 10:53:51 +1100 Subject: vim as editor In-Reply-To: References: Message-ID: On 13Mar2025 15:25, hable at hs-bit.de wrote: >As editor I set a script that calls the vim-editor in a new >tmux-window, >so I can jump back to my INBOX independently of creating some messages >in the background ? >But this solution works ONLY if I create a new message! If I want to >open a existing message in the background I can not jump back to the >INBOX because mutt is blocking till I close the vim editor. >In my settings I have the line: > set editor='/home/schule/.config/mutt/bgedit-tmux.sh vim' >for calling the vim in a new tmux window. >Is there a difference how mutt calls the external editor when I create a >new message and when I only edit a existing message? I do something similar. The return-to-the-inbox-from-tmux approach relies on a (very useful) quirk of mutt - if you quit a new message _unchanged_ it quietly doesn't send. I haven't looked at bgedit-tmux.sh itself, but I have a script of my own for exactly the same purpose. So the flow with making a new message goes: - ordinary mutt edit-new-message - the script runs as the editor, making a copy of the original temp file - it starts a new mutt in the tmux composing a message from the copy, to send when complete When you leave tmux, the _original_ temp file is unchanged and mutt quietly returns to the index view, sending nothing. It is the distinct mutt in the tmux session which does any sending. Editing a message in the inbox is rather different - it just runs an editor on the message and rereads the modified message file when you're done. To make this a detachable thing in mutt you'd need the editor to know how to independently open the message file. FOr a Maildir or MH folder that might be feasible, as each message lives in its own file. For an mbox file this isn't feasible because the entire folder is in one big mbox format file. For this reason, I only set editor to the tmux-mediated editor script for replies or new messages with this cumbersome macro: macro index g ":set my_old_editor=\$editor:set editor=muttedit:set editor=\$my_old_editorr" "group reply" If you want to dispatch per-message edits or view in a detachable tmux you probably need to invoke mutt in a special way for the tmux session. Cheers, Cameron Simpson