dotfiles

Configuration for the software I use.
git clone https://git.sr.ht/~jbauer/dotfiles
Log | Files | Refs | README | LICENSE

commit 6e595a89bbe069d2b8da00df86ad80ec7f5ef276
parent d75b3b5ecfdb974a88ca1751028398f5bbb5bafc
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Fri, 26 Jun 2020 16:15:20 -0400

Split SpellCheckToggle() into its own file

This way it can be sourced at the beginning of init.vim so the function
can be called from files in ftplugin/

Alternatives would have been putting `filetype plugin on` at the end of
the file or moving the function higher in init.vim but neither of these
felt clean.

Diffstat:
A.config/nvim/autoload/spell.vim | 17+++++++++++++++++
M.config/nvim/init.vim | 21++-------------------
2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/.config/nvim/autoload/spell.vim b/.config/nvim/autoload/spell.vim @@ -0,0 +1,17 @@ +" Enable Spell Check {{{ +" Thesaurus: gutenberg.org/files/3202/files/mthesaur.txt +" SpellFile: ftp.vim.org/pub/vim/runtime/spell/en/ +" Colours: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim +func! SpellCheckToggle() + set thesaurus+="~/.vim/thesaurus/mthesaurus.txt" + set spellfile="~/.vim/spell/en_CA.diff" + set complete+=s + setlocal spell! spelllang=en_ca + hi clear SpellBad SpellCap SpellRare SpellLocal + " Red Yellow Cyan Magenta + hi SpellBad gui=underline,bold guifg=#e27878 + hi SpellCap gui=underline,bold guifg=#e2a478 + hi SpellRare gui=bold guifg=#89b8c2 + hi SpellLocal gui=bold guifg=#a093c7 +endfu +" }}} diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim @@ -1,4 +1,5 @@ let mapleader = "," +source ~/.config/nvim/autoload/spell.vim "Plugins Used: {{{ " goyo.vim — (centers buffer in the terminal / 'distraction-free' mode) @@ -38,6 +39,7 @@ filetype plugin indent on map <leader>s :source ~/.vim/vimrc<CR> set history=100 nnoremap <F9> :make +noremap <silent> <C-S> :call SpellCheckToggle()<CR> " Ensure Externally Modified Files Stay Up To Date set autoread @@ -196,22 +198,3 @@ nnoremap <Down> :resize -2<CR> nnoremap <Left> :vertical resize +2<CR> nnoremap <Right> :vertical resize -2<CR> " }}} - -" Enable Spell Check {{{ -" Thesaurus: gutenberg.org/files/3202/files/mthesaur.txt -" SpellFile: ftp.vim.org/pub/vim/runtime/spell/en/ -" Colours: http://vim.wikia.com/wiki/Xterm256_color_names_for_console_Vim -func! SpellCheckToggle() - set thesaurus+="~/.vim/thesaurus/mthesaurus.txt" - set spellfile="~/.vim/spell/en_CA.diff" - set complete+=s - setlocal spell! spelllang=en_ca - hi clear SpellBad SpellCap SpellRare SpellLocal - " Red Yellow Cyan Magenta - hi SpellBad gui=underline,bold guifg=#e27878 - hi SpellCap gui=underline,bold guifg=#e2a478 - hi SpellRare gui=bold guifg=#89b8c2 - hi SpellLocal gui=bold guifg=#a093c7 -endfu -noremap <silent> <C-S> :call SpellCheckToggle()<CR> -" }}}