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: 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/doc/acp.txt b/doc/acp.txt index 324c88b..f7c15b7 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_behaviorJavascriptOmniLength* > + 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* > 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)