When I reply to a message in neomutt, it opens the reply text in vim, as I intended. However, the initial cursor position is at the top of the headers, "From:", "To:", "Subject:" etc, and I have to manually move to the first line of reply text. How do I configure neomutt/vim so that the cursor starts at the first line of reply text?
Asked
Active
Viewed 348 times
2 Answers
3
I added this to my .muttrc
. The drawback is that the cursor is not at the correct position if you want to edit your text again from Compose view.
# Start in insert mode
set editor="nvim \"+/^$/\" \"+nohl\" \"+ normal o\" \"+startinsert\"
EDIT: As @phd mentioned in the comments this can also be implemented in vim.
I crafted two different snippets the first one way faster.
" Use either this
autocmd FileType mail execute "normal /^\\n\<CR>o"
" or this
autocmd FileType mail call feedkeys("/^\\n\<CR>o")

ploth
- 435
- 8
- 16
-
2The same perhaps could be implemented in `vim`/`neovim` with file type autocommand; the file type is `mail`. Something like `autocmd FileType mail …` – phd Aug 22 '19 at 11:59
0
In using this line from above:
autocmd FileType mail execute "normal /^\n<CR>o"
For some reason, the end part "<CR>o" wasn't putting me into insert mode, so this worked for me:
autocmd FileType mail execute "normal /^$<CR>o" | startinsert
This gets me to the end of the headers in a new message or a reply. Note, my signature is source from a file and already includes a blank line above the signature.