vim-asterisk icon indicating copy to clipboard operation
vim-asterisk copied to clipboard

Issue when running it at the 1st time

Open kevin4fly opened this issue 11 years ago • 8 comments

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.

kevin4fly avatar Dec 30 '14 06:12 kevin4fly

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.

haya14busa avatar Dec 31 '14 02:12 haya14busa

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

kevin4fly avatar Dec 31 '14 02:12 kevin4fly

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 avatar Dec 31 '14 05:12 haya14busa

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

haya14busa avatar Dec 31 '14 05:12 haya14busa

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.

kevin4fly avatar Dec 31 '14 11:12 kevin4fly

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?

haya14busa avatar Dec 31 '14 11:12 haya14busa

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.

  • Plugin: https://github.com/thinca/vim-visualstar
  • Author: thinca (https://github.com/thinca)

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

kevin4fly avatar Dec 31 '14 12:12 kevin4fly

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.

haya14busa avatar Dec 31 '14 13:12 haya14busa