Mercurial > vim
diff src/spellfile.c @ 17682:3dbff5d37520 v8.1.1838
patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
commit https://github.com/vim/vim/commit/08cc374dabd2a02785129fa1c0100f7745c244ad
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 11 22:51:14 2019 +0200
patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Problem: There is :spellwrong and :spellgood but not :spellrare.
Solution: Add :spellrare. (Martin Tournoij, closes https://github.com/vim/vim/issues/4291)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 11 Aug 2019 23:00:07 +0200 |
parents | ce04ebdf26b8 |
children | 4fbfecbb968c |
line wrap: on
line diff
--- a/src/spellfile.c +++ b/src/spellfile.c @@ -6125,28 +6125,31 @@ spell_message(spellinfo_T *spin, char_u /* * ":[count]spellgood {word}" - * ":[count]spellwrong {word}" + * ":[count]spellwrong {word}" * ":[count]spellundo {word}" + * ":[count]spellrare {word}" */ void ex_spell(exarg_T *eap) { - spell_add_word(eap->arg, (int)STRLEN(eap->arg), eap->cmdidx == CMD_spellwrong, + spell_add_word(eap->arg, (int)STRLEN(eap->arg), + eap->cmdidx == CMD_spellwrong ? SPELL_ADD_BAD : + eap->cmdidx == CMD_spellrare ? SPELL_ADD_RARE : SPELL_ADD_GOOD, eap->forceit ? 0 : (int)eap->line2, eap->cmdidx == CMD_spellundo); } /* - * Add "word[len]" to 'spellfile' as a good or bad word. + * Add "word[len]" to 'spellfile' as a good, rare or bad word. */ void spell_add_word( char_u *word, int len, - int bad, - int idx, /* "zG" and "zW": zero, otherwise index in - 'spellfile' */ - int undo) /* TRUE for "zug", "zuG", "zuw" and "zuW" */ + int what, // SPELL_ADD_ values + int idx, // "zG" and "zW": zero, otherwise index in + // 'spellfile' + int undo) // TRUE for "zug", "zuG", "zuw" and "zuW" { FILE *fd = NULL; buf_T *buf = NULL; @@ -6213,7 +6216,7 @@ spell_add_word( fname = fnamebuf; } - if (bad || undo) + if (what == SPELL_ADD_BAD || undo) { /* When the word appears as good word we need to remove that one, * since its flags sort before the one with WF_BANNED. */ @@ -6280,8 +6283,10 @@ spell_add_word( semsg(_(e_notopen), fname); else { - if (bad) + if (what == SPELL_ADD_BAD) fprintf(fd, "%.*s/!\n", len, word); + else if (what == SPELL_ADD_RARE) + fprintf(fd, "%.*s/?\n", len, word); else fprintf(fd, "%.*s\n", len, word); fclose(fd);