haya14busa / vim-asterisk

:snowflake: *-Improved
http://www.vim.org/scripts/script.php?script_id=5059
MIT License
382 stars 19 forks source link

Issue when running it at the 1st time #6

Open kevin4fly opened 9 years ago

kevin4fly commented 9 years ago

I have installed haya14busa/incsearch.vim, haya14busa/vim-asterisk, osyo-manga/vim-anzu and thinca/vim-visualstar via neobundle. And here are the settings for these plugins:

" provide incremental highlighting for all pattern matches{{{2
NeoBundleLazy 'haya14busa/incsearch.vim', {
            \ 'name'     : 'incsearch',
            \ 'mappings' : ['<plug>(incsearch-'],
            \ }

" show details of the position of the search result{{{2
" NeoBundleLazy 'henrik/vim-indexed-search', {
"             \ 'name'     : 'indexed-search',
"             \ 'commands' : [
"             \               {'name': 'ShowSearchIndex'},
"             \              ],
"             \ }

" show the index of the matched searching results
NeoBundleLazy 'osyo-manga/vim-anzu', {
            \ 'name'     : 'vim-anzu',
            \ 'mappings' : ['<plug>(anzu-'],
            \ }

" improve star motions
NeoBundleLazy 'haya14busa/vim-asterisk', {
            \ 'name'     : 'asterisk',
            \ 'mappings' : ['<plug>(asterisk-'],
            \ }

" provide star feature in visual-mode{{{2
NeoBundleLazy 'thinca/vim-visualstar', {
            \ 'name'     : 'visual-star',
            \ 'mappings' : ['<plug>(visualstar-'],
            \ }

if neobundle#tap('incsearch')

  function! neobundle#tapped.hooks.on_post_source(bundle)
    IncSearchNoreMap <c-a> <home>
    IncSearchNoreMap <c-e> <end>
    IncSearchNoreMap <c-l> <right>
    IncSearchNoreMap <c-h> <left>
    IncSearchNoreMap <c-j> <down>
    IncSearchNoreMap <c-k> <up>
    IncSearchNoreMap <c-f> <bs>
    IncSearchNoreMap <tab>   <Over>(buffer-complete)
    IncSearchNoreMap <S-Tab> <Over>(buffer-complete-prev)
  endfunction

  " let g:incsearch#auto_nohlsearch = 1
  nmap /  <plug>(incsearch-forward)
  nmap ?  <plug>(incsearch-backward)
  nmap g/ <plug>(incsearch-stay)
  " nmap n  <plug>(incsearch-nohl-n)zv:ShowSearchIndex<cr>
  " nmap N  <plug>(incsearch-nohl-N)zv:ShowSearchIndex<cr>
  nmap n  <plug>(incsearch-nohl)<plug>(anzu-n-with-echo)
  nmap N  <plug>(incsearch-nohl)<plug>(anzu-n-with-echo)
  " nmap *  <plug>(incsearch-nohl-*)
  " nmap #  <plug>(incsearch-nohl-#)
  " nmap g* <plug>(incsearch-nohl-g*)
  " nmap g# <plug>(incsearch-nohl-g#)

  map *   <plug>(incsearch-nohl)<plug>(asterisk-*)
  map g*  <plug>(incsearch-nohl)<plug>(asterisk-g*)
  map #   <plug>(incsearch-nohl)<plug>(asterisk-#)
  map g#  <plug>(incsearch-nohl)<plug>(asterisk-g#)

  map z*  <plug>(incsearch-nohl0)<plug>(asterisk-z*)
  map gz* <plug>(incsearch-nohl0)<plug>(asterisk-gz*)
  map z#  <plug>(incsearch-nohl0)<plug>(asterisk-z#)
  map gz# <plug>(incsearch-nohl0)<plug>(asterisk-gz#)

  call neobundle#untap()
endif

" settings for visual-star{{{2
if neobundle#tap('visual-star')
    vmap * <plug>(visualstar-*)N
    vmap # <plug>(visualstar-#)N
    vmap g* <plug>(visualstar-g*)N
    vmap g# <plug>(visualstar-g#)N

  call neobundle#untap()
endif

Open a file via vim, move cursor to a word and press *. It doesn't search the word under the cursor. Clear the unexpected result, move cursor the a word and press * again. It just works fine. This issue only happens when we do the search for the 1st time.

haya14busa commented 9 years ago

Thanks. Hm... I guess this issue is related with NeoBundleLazy by chance, so would you mind removing Lazy and confirm whether the issue is caused by Lazy or not.

kevin4fly commented 9 years ago

yes, you are right. the fact is as what you said. Removing the Lazy of incsearch, all things works fine.

haya14busa commented 9 years ago

Thanks for the confirmation.

Hmm.... I don't know why but something conflict with lazy loading mappings. I guess we should report it to neobundle as well.

But, anyway, I recommend you not to use lazy loading with incsearch.vim (and vim-asterisk as well) because incsearch.vim doesn't execute heavy scripts at startup at all. There are just some definition of mappings and commands.

haya14busa commented 9 years ago

Oh, and I guess this is incsearch.vim's problem, not vim-asterisk's one.

kevin4fly commented 9 years ago

Previously, incsearch.vim just works fine. However, this issue occurs after adding the vim-asterisk. Thus I file report it to asterisk.

I think if there is anther issue report (in incsearch.vim or neobundle) to keep track of this, you could feel free to close it.

I accept that remove the lazy suffix, it is not a big deal. Now things are done and thanks.

haya14busa commented 9 years ago

Previously, incsearch.vim just works fine. However, this issue occurs after adding the vim-asterisk. Thus I file report it to asterisk.

Hm, how about vim-anzu?

kevin4fly commented 9 years ago

Oh, the vim-anzu plugin works fine.

I have a question, should I still add thinca/vim-visualstar plugin after I have added haya14busa/vim-asterisk? From the haya14busa/vim-asterisk doc:

CREDITS asterisk-credits

|asterisk.vim| uses the code from vim-visualstar for visual star feature.

I test it also, star feature works OK without vim-visualstar added. I am gonna double check with you. :)

haya14busa commented 9 years ago

Oh, the vim-anzu plugin works fine.

Thanks! Hmm... vim-asterisk use <expr> mappings, so it may have something to do with it.

I test it also, star feature works OK without vim-visualstar added. I am gonna double check with you. :)

Oh, I guess that's my bad. My explanation in the document is confusing. You don't have to install visualstar in addition to vim-asterisk, I just took some code from visualstar.