From 1ba6e60dac1c64b0a889df198fcb6f8c4fec9bfb Mon Sep 17 00:00:00 2001 From: ayang Date: Mon, 16 Jan 2012 15:46:56 +0800 Subject: [PATCH 1/4] Update README --- README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README b/README index 8a72261..60d73e7 100644 --- a/README +++ b/README @@ -1,3 +1,7 @@ +This project is a fork from https://github.com/vim-scripts/AutoComplPop. Added +Javascript autocompletion support. + +============================================================================= This is a mirror of http://www.vim.org/scripts/script.php?script_id=1879 Repository: From 41ed5824c02c8faa7bc7b781f0473a9bc9b5b3ab Mon Sep 17 00:00:00 2001 From: Bruce Yang Date: Mon, 16 Jan 2012 21:22:20 +0800 Subject: [PATCH 2/4] added javascript support. --- autoload/acp.vim | 6 ++++++ plugin/acp.vim | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/autoload/acp.vim b/autoload/acp.vim index 827bbcc..fe1b6d6 100644 --- a/autoload/acp.vim +++ b/autoload/acp.vim @@ -126,6 +126,12 @@ function acp#meetsForPythonOmni(context) \ a:context =~ '\k\.\k\{' . g:acp_behaviorPythonOmniLength . ',}$' endfunction +" +function acp#meetsForJavascriptOmni(context) + return g:acp_behaviorJavascriptOmniLength >= 0 && + \ a:context =~ '\k\.\k\{' . g:acp_behaviorJavascriptOmniLength . ',}$' +endfunction + " function acp#meetsForPerlOmni(context) return g:acp_behaviorPerlOmniLength >= 0 && diff --git a/plugin/acp.vim b/plugin/acp.vim index 0c01a31..b2a3d30 100644 --- a/plugin/acp.vim +++ b/plugin/acp.vim @@ -30,6 +30,7 @@ function s:makeDefaultBehavior() \ '*' : [], \ 'ruby' : [], \ 'python' : [], + \ 'javascript' : [], \ 'perl' : [], \ 'xml' : [], \ 'html' : [], @@ -87,6 +88,12 @@ function s:makeDefaultBehavior() \ 'repeat' : 0, \ }) "--------------------------------------------------------------------------- + call add(behavs.javascript, { + \ 'command' : "\\", + \ 'meets' : 'acp#meetsForJavascriptOmni', + \ 'repeat' : 0, + \ }) + "--------------------------------------------------------------------------- call add(behavs.perl, { \ 'command' : "\\", \ 'meets' : 'acp#meetsForPerlOmni', @@ -140,6 +147,7 @@ call s:defineOption('g:acp_behaviorFileLength', 0) call s:defineOption('g:acp_behaviorRubyOmniMethodLength', 0) call s:defineOption('g:acp_behaviorRubyOmniSymbolLength', 1) call s:defineOption('g:acp_behaviorPythonOmniLength', 0) +call s:defineOption('g:acp_behaviorJavascriptOmniLength', 0) call s:defineOption('g:acp_behaviorPerlOmniLength', -1) call s:defineOption('g:acp_behaviorXmlOmniLength', 0) call s:defineOption('g:acp_behaviorHtmlOmniLength', 0) From 1cb7c8ab3d6ed5ce18b42fda9941befb1e599497 Mon Sep 17 00:00:00 2001 From: Bruce Yang Date: Mon, 16 Jan 2012 21:31:44 +0800 Subject: [PATCH 3/4] update doc for javascript --- doc/acp.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/acp.txt b/doc/acp.txt index 324c88b..89433e3 100644 --- a/doc/acp.txt +++ b/doc/acp.txt @@ -57,6 +57,7 @@ default behavior is as follows: Omni ruby ".", "::" or non-word character + ":" (|+ruby| required.) Omni python "." (|+python| required.) + Omni javascript "." (|+javascript| required) Omni xml "<", "" characters + " ") Omni html/xhtml "<", "" characters + " ") Omni css (":", ";", "{", "^", "@", or "!") @@ -223,6 +224,13 @@ OPTIONS *acp-options* < Length of keyword characters before the cursor, which are needed to attempt python omni-completion. If negative value, this completion + will be never attempted. + + *g:acp_behaviorPythonOmniLength* > + let g:acp_behaviorJavascriptOmniLength = 0 +< + Length of keyword characters before the cursor, which are needed to + attempt javascript omni-completion. If negative value, this completion will be never attempted. *g:acp_behaviorPerlOmniLength* > From e9ae85ba10ab3a5126e5a667f47ba8a50ac1a725 Mon Sep 17 00:00:00 2001 From: Bruce Yang Date: Mon, 16 Jan 2012 21:40:39 +0800 Subject: [PATCH 4/4] update doc for javascript --- doc/acp.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/acp.txt b/doc/acp.txt index 89433e3..f7c15b7 100644 --- a/doc/acp.txt +++ b/doc/acp.txt @@ -226,7 +226,7 @@ OPTIONS *acp-options* attempt python omni-completion. If negative value, this completion will be never attempted. - *g:acp_behaviorPythonOmniLength* > + *g:acp_behaviorJavascriptOmniLength* > let g:acp_behaviorJavascriptOmniLength = 0 < Length of keyword characters before the cursor, which are needed to