From bf70b0d893e5c3f841e3b6822a6f52ce27921e1a Mon Sep 17 00:00:00 2001 From: Reed Esau Date: Tue, 4 Feb 2014 01:01:06 -0700 Subject: [PATCH] Added option to disable typographic (curly) quotes. --- README.markdown | 20 ++++++++++++++++++++ autoload/litecorrect.vim | 2 +- plugin/litecorrect.vim | 23 +++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 plugin/litecorrect.vim diff --git a/README.markdown b/README.markdown index c6f4f14..db3ff7a 100644 --- a/README.markdown +++ b/README.markdown @@ -64,6 +64,26 @@ where the value is a list of the common misspellings for the key. The corrections you provide will be in addition to the defaults. Where there’s a conflict, your correction will prevail. +### Typographic characters + +By default, typographic (or curly) quotes will be used in corrections. For +example: + +``` +Im -> I’m +shouldnt -> shouldn’t +thats -> that’s +``` + +If you prefer straight quotes, change this setting to 0 in your `.vimrc`: + +``` +let g:litecorrect#typographic = 1 " 0=disable, 1=enable (def) +``` + +Note that an educating quote plugin like _quotable_ (see below) will +automatically transform straight quotes to curly ones in your corrections. + ## Criteria to modify default entries Note that the number of default entries will be limited to 300 for fast diff --git a/autoload/litecorrect.vim b/autoload/litecorrect.vim index c12ebb8..b9bec3e 100644 --- a/autoload/litecorrect.vim +++ b/autoload/litecorrect.vim @@ -307,7 +307,7 @@ function! litecorrect#init(...) ia yuo you ia yuor your - if s:unicode_enabled() + if s:unicode_enabled() && g:litecorrect#typographic ia Im I’m ia couldnt couldn’t ia didnt didn’t diff --git a/plugin/litecorrect.vim b/plugin/litecorrect.vim new file mode 100644 index 0000000..4edfb53 --- /dev/null +++ b/plugin/litecorrect.vim @@ -0,0 +1,23 @@ +" ============================================================================= +" File: plugin/litecorrect.vim +" Description: lightweight autocorrection for Vim +" Maintainer: Reed Esau +" Created: January 20, 2014 +" License: The MIT License (MIT) +" ============================================================================= + +if exists('g:loaded_litecorrect') || &cp | finish | endif +let g:loaded_litecorrect = 1 + +" Save 'cpoptions' and set Vim default to enable line continuations. +let s:save_cpo = &cpo +set cpo&vim + +if !exists('g:litecorrect#typographic') + let g:litecorrect#typographic = 1 " 0=disable, 1=enable +endif + +let &cpo = s:save_cpo +unlet s:save_cpo +" vim:ts=2:sw=2:sts=2 +