Excellent! Thanks a lot!

Sidenote: Since I decided to use the basic mode but wanted to have the
feature to jump to other occurrences, I've modified the basic version
a bit to jump into the other window in case the word was found (see
below). It is completely o.k. for me to do CTRL_W p to go back to the
original window.

func! StarAltWin()
    let word = expand("<cword>")
    let @/ =  escape(word, '\.*$^~[')
    if winnr("$") < 2
        echohl ErrorMsg
        echo "StarAltWin: no other window"
        echohl None
        return
    elseif winnr("#")<1 || winnr("#")==winnr()
        noa wincmd w
    else
        noa wincmd p
    endif
    try
        normal! nzv
    catch /:E486:/
        " pattern not found
        " (NEXT LINE NEWLY INSERTED:)
        noa wincmd p
        echohl ErrorMsg
        echo printf("StarAltWin: Pattern not found in window %d: %s",
            \ winnr(), @/)
        echohl None
    endtry
    " (LINE noa wincmd p DELETED)
endfunc

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to