vimunite.vim

How to navigate results (candidates) in Unite.vim?


After a search in unite.vim, you open a candidate. Is there an easy way to jump to the next one without having to run the search command again? Similar plugins (ack.vim, git-grep) use the quickfix window, so you can type :cn and :cp to jump to next/previous results. Is there anything similar in unite.vim?

Thanks!


Solution

  • I haven't managed to find a way to put results into the quickfix or location lists, though I'm sure you could extend Unite to include that action.

    Meanwhile, this little exerpt from the Unite documentation can help you re-open the Unite buffer you just recently had open:

    :UniteResume [{options}] [{buffer-name}]    *:UniteResume*
            Reuses the unite buffer named {buffer-name} that you opened
            previously.  Narrowing texts or candidates are
            as-is.  If {options} are given, context information gets
            overridden.
    
            Note: Reuses the last unite buffer you used in current tab if
            you skip specifying {buffer-name}.
    

    I use this in the following way in my vimrc:

     " Press <leader>ll to re-open last Unite buffer
     nnoremap <silent><leader>ll :<C-u>UniteResume<CR>
    

    Another useful snippet from the docs:

        -no-quit
        Doesn't close unite buffer after firing an action.  Unless you
        specify it, a unite buffer gets closed when you selected an
        action which is "is_quit".
    
        -keep-focus
        Keep the focus on a unite buffer after firing an action.
        Note: This option is used with "-no-quit" option.
    

    For example, you could bind

    nnoremap <silent><leader>lg :<C-u>Unite -no-quit -keep-focus grep<CR>
    

    To be able to press <leader>lg to grep through your source files, without closing or de-focusing the Unite buffer when you select an item.