From f98861a96103663a1bfd396438939cfd28ef19a4 Mon Sep 17 00:00:00 2001 From: Alexander Tsepkov Date: Fri, 7 Feb 2020 17:13:19 -0500 Subject: [PATCH] renamed auto_comma_or_semicolon flag to avoid conflict with outside variables --- README.md | 4 ++-- plugin/cosco.vim | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f5b5dc1..cd0a88c 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ Auto insertion of a comma or a semicolon is also supported through the function: To activate the AutoCommaOrSemiColon by default add the following line to your `.vimrc`: ```vim -let g:auto_comma_or_semicolon = 1 " Default : 0 +let g:cosco_auto_comma_or_semicolon = 1 " Default : 0 ``` For faster toggle you can use the command: @@ -152,7 +152,7 @@ This will show a message about the current state of the auto insetion mode (ON / By default what triggers the auto insertion is leaving insert mode (`InsertLeave` event). This can be modified by changing the desired events in the events list: ```vim -let g:auto_comma_or_semicolon_events = ["InsertLeave"] +let g:cosco_auto_comma_or_semicolon_events = ["InsertLeave"] ``` __**Warning**__: diff --git a/plugin/cosco.vim b/plugin/cosco.vim index 25f0f04..c30c13f 100644 --- a/plugin/cosco.vim +++ b/plugin/cosco.vim @@ -8,34 +8,34 @@ " autocmd FileType c,cpp,css,java,javascript,perl,php,jade imap ; (cosco-commaOrSemiColon) " command! CommaOrSemiColon call cosco#commaOrSemiColon() -if !exists("g:auto_comma_or_semicolon") - let g:auto_comma_or_semicolon = 0 +if !exists("g:cosco_auto_comma_or_semicolon") + let g:cosco_auto_comma_or_semicolon = 0 endif -if !exists("g:auto_comma_or_semicolon_events") - let g:auto_comma_or_semicolon_events = ["InsertLeave"] +if !exists("g:cosco_auto_comma_or_semicolon_events") + let g:cosco_auto_comma_or_semicolon_events = ["InsertLeave"] endif augroup auto_comma_or_semicolon autocmd! - for event in g:auto_comma_or_semicolon_events + for event in g:cosco_auto_comma_or_semicolon_events execute "au " . event . " * call AutoCommaOrSemiColon()" endfor augroup END command! AutoCommaOrSemiColonToggle :call AutoCommaOrSemiColonToggle() function! AutoCommaOrSemiColonToggle() - if g:auto_comma_or_semicolon >= 1 - let g:auto_comma_or_semicolon = 0 + if g:cosco_auto_comma_or_semicolon >= 1 + let g:cosco_auto_comma_or_semicolon = 0 echo "AutoCommaOrSemiColon is OFF" else - let g:auto_comma_or_semicolon = 1 + let g:cosco_auto_comma_or_semicolon = 1 echo "AutoCommaOrSemiColon is ON" endif endfunction function! AutoCommaOrSemiColon() - if g:auto_comma_or_semicolon >= 1 + if g:cosco_auto_comma_or_semicolon >= 1 call cosco#commaOrSemiColon() endif endfunction