Notgnoshi / dotfiles

Personal dotfiles and shell scripts

Home Page:https://agill.xyz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keep spellfile sorted, but don't clear the screen

Notgnoshi opened this issue · comments

for d in glob('~/.vim/spell/*.add', 1, 1)
    " This likely forces the generation of the binary .spl file. Until the
    " performance becomes noticeable, that's acceptable. Otherwise, I think a
    " git-hook, or a more sophisticated shell incantation to also _diff_ the
    " sorted file against the original one, would be the approach to use.
    " BUG: This clears the screen, so when you exit vim, the prompt is on the
    " bottom of the screen. This is surprisingly frustrating.
    silent! execute '!sort --unique ' fnameescape(d) ' --output ' fnameescape(d)
    if filereadable(d) && (!filereadable(d . '.spl') || getftime(d) > getftime(d . '.spl'))
        silent exec 'mkspell! ' . fnameescape(d)
endif

I think the thing to do here is use a pre-commit hook to sort and deduplicate the spell file.

":silent" will also avoid the hit-enter prompt. When
using this for an external command, this may cause the
screen to be messed up. Use |CTRL-L| to clean it up
then.