Skip to content

Add javascript support #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
6 changes: 6 additions & 0 deletions autoload/acp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
8 changes: 8 additions & 0 deletions doc/acp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<", "</" or ("<" + non-">" characters + " ")
Omni html/xhtml "<", "</" or ("<" + non-">" characters + " ")
Omni css (":", ";", "{", "^", "@", or "!")
Expand Down Expand Up @@ -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* >
Expand Down
8 changes: 8 additions & 0 deletions plugin/acp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function s:makeDefaultBehavior()
\ '*' : [],
\ 'ruby' : [],
\ 'python' : [],
\ 'javascript' : [],
\ 'perl' : [],
\ 'xml' : [],
\ 'html' : [],
Expand Down Expand Up @@ -87,6 +88,12 @@ function s:makeDefaultBehavior()
\ 'repeat' : 0,
\ })
"---------------------------------------------------------------------------
call add(behavs.javascript, {
\ 'command' : "\<C-x>\<C-o>",
\ 'meets' : 'acp#meetsForJavascriptOmni',
\ 'repeat' : 0,
\ })
"---------------------------------------------------------------------------
call add(behavs.perl, {
\ 'command' : "\<C-x>\<C-o>",
\ 'meets' : 'acp#meetsForPerlOmni',
Expand Down Expand Up @@ -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)
Expand Down