AutoYADM commit: 2025-05-26 20:50:39

This commit is contained in:
Daniel Fichtinger 2025-05-26 20:50:39 -04:00
parent 405e779c5e
commit e9b8ab9717
3 changed files with 43 additions and 18 deletions

View file

@ -1,15 +1 @@
declare-option -docstring 'mail formatter' str mail_fmt '/home/fic/dev/utils/mail-utils/format.py'
hook global WinSetOption filetype=mail %~
set-option window formatcmd %opt{mail_fmt}
set-option window comment_line '>'
hook -group mail-spell window ModeChange (push|pop):.*insert %{
try %{ spell-clear }
}
hook -group mail-spell window NormalIdle .* %{ try spell }
hook -group mail-auto-format window BufWritePre .* format
hook -once -always window WinSetOption filetype=.* %{
unset-option window formatcmd
remove-hooks window mail-auto-format
}
~

View file

@ -71,3 +71,14 @@ hook global WinSetOption filetype=kdl %{
remove-hooks window kdl-auto-format
}
}
hook global WinSetOption filetype=mail %~
set-option window formatcmd '/home/fic/dev/utils/mail-utils/format.py'
set-option window comment_line '>'
try autospell-enable
hook -group mail-auto-format window BufWritePre .* format
hook -once -always window WinSetOption filetype=.* %{
unset-option window formatcmd
remove-hooks window mail-auto-format
}
~

View file

@ -1,10 +1,38 @@
# spellcheck using aspell for now (maybe better options?)
provide-module spell %~
define-command -hidden register-autospell %{
hook -group auto-spell window ModeChange (push|pop):.*insert %{
try %{ spell-clear }
define-command -override -hidden true nop
define-command -override -hidden false fail
declare-option -hidden bool autospell_enabled false
define-command -docstring %{
Enable autospell. Autospell refreshes spellchecks and hides spelling in insert mode.
} autospell-enable %{
try %{
spell
hook -group auto-spell window ModeChange (push|pop):.*insert %{
try %{ spell-clear }
}
hook -group auto-spell window NormalIdle .* %{ try spell }
} catch %{
fail "Couldn't enable autospell!"
}
}
define-command -docstring %{
Disable autospell. Autospell refreshes spellchecks and hides spelling in insert mode.
} autospell-disable %{
try spell-clear
remove-hooks window auto-spell
}
define-command autospell-toggle %{
try %{
%opt{autospell_enabled}
autospell-disable
} catch %{
autospell-enable
}
hook -group auto-spell window NormalIdle .* %{ try spell }
}
# keybindings