Issue #12 resolved

Let user customize stopWords

Anonymous created an issue

Sometimes we don't want ACP search dictionary begin with some words(in case there are thousands of words for complete candidate),such as :get,set,win,etc. And now we put them in "stopWords", when we input "stopWords",ACP will stop search. maybe it's useful.\ \ \ code here:\ diff --git a/acp.vim b/acp.vim \ index 39f71d8..d19cd2b 100644\ --- a/acp.vim\ +++ b/acp.vim\ @@ -13,6 +13,18 @@ let g:loaded_autoload_acp = 1\ "=============================================================================\ " GLOBAL FUNCTIONS: {{{1\ \ +\ +let s:stopWords = [\ + \ 'en', 'mmi_', 'get', 're','__',\ + \ 'ad', 'ca', 'cl', 'co', 'cs', 'de',\ + \ 'fi', 'ft', 'ge', 'ha', 'hb', 'in',\ + \ 'is', 'js', 'm_', 'ma', 'mn', 'pa',\ + \ 'pn', 'pr', 'qs', 'qt', 're', 'se',\ + \ 'sq', 'st', 'sv', 'ti', 'to', 'tt',\ + \ 'py', '--',\ + \ ]\ +\ +\ "\ function acp#enable()\ call acp#disable()\ @@ -219,13 +231,21 @@ function s:feedPopup()\ endif\ if exists('s:lastUncompletableWord') &&\ \ stridx(s:getCurrentWord(), s:lastUncompletableWord) == 0\ -\ let s:behavsCurrent = []\ else\ unlet! s:lastUncompletableWord\ let text = s:getCurrentText()\ call filter(s:behavsCurrent, 's:matchesBehavior(text, v:val)')\ endif\ +\ + ""Idle,2009-10-28 If input ge or get will stop search\ + for stopKey in s:stopWords\ + if stridx(stopKey,s:getCurrentWord()) == 0\ + let s:behavsCurrent = []\ + break\ + endif\ + endfor\ +\ if empty(s:behavsCurrent)\ call s:finishPopup(1)\ return ''\

Comments (2)

  1. Takeshi NISHIDA repo owner
    • changed status to open

    Thanks. Now I can read your patch. I have an idea to provide more generalized function.

    diff --git a/acp.vim b/acp.vim
    index 39f71d8..d19cd2b 100644
    --- a/acp.vim
    +++ b/acp.vim
    @@ -13,6 +13,18 @@ let g:loaded_autoload_acp = 1
    "=============================================================================
    " GLOBAL FUNCTIONS: {{{1
    
    +
    +let s:stopWords = [
    + \ 'en', 'mmi_', 'get', 're','',
    + \ 'ad', 'ca', 'cl', 'co', 'cs', 'de',
    + \ 'fi', 'ft', 'ge', 'ha', 'hb', 'in',
    + \ 'is', 'js', 'm_', 'ma', 'mn', 'pa',
    + \ 'pn', 'pr', 'qs', 'qt', 're', 'se',
    + \ 'sq', 'st', 'sv', 'ti', 'to', 'tt',
    + \ 'py', '--',
    + \ ]
    +
    +
    "
    function acp#enable()
    call acp#disable()
    @@ -219,13 +231,21 @@ function s:feedPopup()
    endif
    if exists('s:lastUncompletableWord') &&
    \ stridx(s:getCurrentWord(), s:lastUncompletableWord) == 0
    -
    let s:behavsCurrent = []
    else
    unlet! s:lastUncompletableWord
    let text = s:getCurrentText()
    call filter(s:behavsCurrent, 's:matchesBehavior(text, v:val)')
    endif
    +
    + ""Idle,2009-10-28 If input ge or get will stop search
    + for stopKey in s:stopWords
    + if stridx(stopKey,s:getCurrentWord()) == 0
    + let s:behavsCurrent = []
    + break
    + endif
    + endfor
    +
    if empty(s:behavsCurrent)
    call s:finishPopup(1)
    return ''
    
  2. Log in to comment