- Notifications
You must be signed in to change notification settings - Fork21
Improved vim spelling plugin (with camel case support)!
License
kamykn/spelunker.vim
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Spelunker.vim is a plugin that improvesVim's spell checking function. It provides a smarter way to correct spelling mistakes by supportingPascalCase,camelCase andsnake_case. Each programming language (JavaScript/TypeScript, PHP, Ruby, CSS, HTML and Vim Script) has an allowlist.
Plug 'kamykn/spelunker.vim'
NeoBundle 'kamykn/spelunker.vim'
Turn off Vim'sspell
as it highlights the same words.
set nospell
Spelunker.vim offers the following configuration options:
" Enable spelunker.vim. (default: 1)" 1: enable" 0: disableletg:enable_spelunker_vim=1" Enable spelunker.vim on readonly files or buffer. (default: 0)" 1: enable" 0: disableletg:enable_spelunker_vim_on_readonly=0" Check spelling for words longer than set characters. (default: 4)letg:spelunker_target_min_char_len=4" Max amount of word suggestions. (default: 15)letg:spelunker_max_suggest_words=15" Max amount of highlighted words in buffer. (default: 100)letg:spelunker_max_hi_words_each_buf=100" Spellcheck type: (default: 1)" 1: File is checked for spelling mistakes when opening and saving. This" may take a bit of time on large files." 2: Spellcheck displayed words in buffer. Fast and dynamic. The waiting time" depends on the setting of CursorHold `set updatetime=1000`.letg:spelunker_check_type=1" Highlight type: (default: 1)" 1: Highlight all types (SpellBad, SpellCap, SpellRare, SpellLocal)." 2: Highlight only SpellBad." FYI: https://vim-jp.org/vimdoc-en/spell.html#spell-quickstartletg:spelunker_highlight_type=1" Option to disable word checking." Disable URI checking. (default: 0)letg:spelunker_disable_uri_checking=1" Disable email-like words checking. (default: 0)letg:spelunker_disable_email_checking=1" Disable account name checking, e.g. @foobar, foobar@. (default: 0)" NOTE: Spell checking is also disabled for JAVA annotations.letg:spelunker_disable_account_name_checking=1" Disable acronym checking. (default: 0)letg:spelunker_disable_acronym_checking=1" Disable checking words in backtick/backquote. (default: 0)letg:spelunker_disable_backquoted_checking=1" Disable default autogroup. (default: 0)letg:spelunker_disable_auto_group=1" Create own custom autogroup to enable spelunker.vim for specific filetypes.augroupspelunkerautocmd!" Setting for g:spelunker_check_type = 1:autocmdBufWinEnter,BufWritePost*.vim,*.js,*.jsx,*.json,*.mdcallspelunker#check()" Setting for g:spelunker_check_type = 2:autocmdCursorHold*.vim,*.js,*.jsx,*.json,*.mdcallspelunker#check_displayed_words()augroupEND" Override highlight group name of incorrectly spelled words. (default:" 'SpelunkerSpellBad')letg:spelunker_spell_bad_group='SpelunkerSpellBad'" Override highlight group name of complex or compound words. (default:" 'SpelunkerComplexOrCompoundWord')letg:spelunker_complex_or_compound_word_group='SpelunkerComplexOrCompoundWord'" Override highlight setting.highlight SpelunkerSpellBad cterm=underline ctermfg=247gui=underline guifg=#9e9e9ehighlight SpelunkerComplexOrCompoundWord cterm=underline ctermfg=NONEgui=underline guifg=NONE
Correct misspelled words with a list of suggestions.
" Correct all words in buffer.ZL" Correct word under cursor.Zl
If you are using nvim version 0.4 or higher, you need to installkamykn/popup-menu.nvim
.
" vim-plugPlug 'kamykn/popup-menu.nvim'" NeoBundleNeoBundle 'kamykn/popup-menu.nvim'
If you are using old vim/nvim, this function usinginputlist() instead ofpopup_menu().
(Before vim version 8.1.1391.)
Correct misspelled words by inserting a correction.
" Correct all words in buffer.ZC" Correct word under cursor.Zc
An example ofZC
in action:
Correct misspelled words by picking first item on suggestion list. (This is like "I'm feeling lucky!")
" Correct all words in buffer.ZF" Correct word under cursor.Zf
An example ofZF
in action:
Spelunker.vim use Vimspell
commands as default. You can also add word under cursor tospellfile
with the following commands:
" Add selected word to spellfile" zg =>Zg" zw =>Zw" zug =>Zug" zuw =>Zuw" Add selected word to the internal word list" zG =>ZG" zW =>ZW" zuG =>ZUG" zuW =>ZUW
Readhttp://vim-jp.org/vimdoc-en/spell.html#zg for more information.
Run the following command to add all misspelled words to thespellfile
:
:SpelunkerAddAll
" Jump cursor to next misspelled words.ZN" Jump cursor to previous misspelled words.ZP
This function is depend onwrapscan setting.
An example ofZN
/ZP
in action:
" Toggle to enable or disable.ZT" Toggle to enable or disable only the current buffer.Zt
" The initial state depends on the value of g:enable_spelunker_vim." 1: Default on." 0: Default off." g:enable_spelunker_vim = 1
ctrlp is fuzzy finder.
Need setting, see below:
" ctrlp extletg:ctrlp_extensions=get(g:,'ctrlp_extensions', [])\+ ['spelunker']
Start:CtrlPSpell
then list up bad spell.Select word to jump first find this bad spell.Check the context and suitability and act (fix or add, etc...).
Commonly used words are set to be excluded. Compound words and complex words may be highlighted incorrectly, but another highlight group (SpelunkerComplexOrCompoundWord) is being adapted.
Please see the code for details:white_list.vim
JavaScript/TypeScript, PHP, Ruby, CSS, HTML and Vim Script is currently supported. More support will be added in the future.
Programming language | White list |
---|---|
CSS, LESS, SCSS(Sass) | white_list_css.vim |
HTML | white_list_html.vim |
JavaScript/TypeScript | white_list_javascript.vim |
PHP | white_list_php.vim |
Ruby | white_list_ruby.vim |
Vim Script | white_list_vim.vim |
You can add words to your user specific allowlist:
letg:spelunker_white_list_for_user= ['kamykn','vimrc']