I'm using Vim with the Unite plugin. How to prevent jump to first line in unite preview, when cursor is in last position and key down J is pressed and otherwise jump from first line to last line, when key up K is pressed?
Asked
Active
Viewed 182 times
2 Answers
3
Not too hard, given the Unite docs. Lines for your vimrc
:
augroup my_unite
autocmd!
autocmd FileType unite call s:unite_my_settings()
augroup END
function! s:unite_my_settings()
nmap <buffer><expr> j line('.') == line('$') ? '' : '<Plug>(unite_loop_cursor_down)'
nmap <buffer><expr> k line('.') == 1 ? '' : '<Plug>(unite_loop_cursor_up)'
endfunction

VanLaser
- 1,144
- 6
- 8
-
Thx for answer, this is work! But i found more simple solution: https://github.com/Shougo/unite.vim/issues/1023 – dkiyatkin Sep 15 '15 at 20:49
-
Yep, the author always knows best :) – VanLaser Sep 15 '15 at 21:00
1
You can find out if there is a mapping on your J by typing
:map j
If there is, and you do not like, you can unmap it by putting this into your vimrc
autocmd VimEnter * unmap j
It should do the trick (the same for the K).
There is also another way (:help after-directory
) but I prefer this one.

ryuichiro
- 3,765
- 1
- 16
- 21
-
Thx for answer, but this not help.. unite don't provide built-in command for key up/down without loop to start/end.. – dkiyatkin Sep 15 '15 at 16:29