haya14busa / is.vim

incremental search improved - successor of incsearch.vim
MIT License
255 stars 3 forks source link

Question on `C-j`/`C-k` behavior #8

Open ts826848 opened 6 years ago

ts826848 commented 6 years ago

My understanding of the difference between C-j/C-k from this plugin and the built-in C-g/C-t is that the built-in ones advance the cursor from match to match, while the ones from this plugin advance screen-by-screen, moving the cursor to a suitable location as necessary. Am I understanding this correctly?

If C-j/C-k are supposed to scroll screen-by-screen, I don't appear to get the same kind of scrolling as in the recordings in the repo. When I hit C-j, instead of jumping up/down a screen, the cursor starts advancing to the next match until the screen has scrolled down some amount, at which point it starts jumping to the previous match until some point. The net effect is moving screen-by-screen, but it doesn't really seem right.

An example screen recording can be found here

The .vimrc used for the example:

call plug#begin()
    if has('extra_search')
        Plug 'haya14busa/is.vim'
    else
        Plug 'haya14busa/incsearch.vim'
    endif
call plug#end()

if has('extra_search')
    set hlsearch
    set incsearch
endif

Output of vim --version:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jan  8 2018 13:58:05)
macOS version
Included patches: 1-1400
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +farsi             +mouse_sgr         -tag_any_white
+arabic            +file_in_path      -mouse_sysmouse    -tcl
+autocmd           +find_in_path      +mouse_urxvt       +termguicolors
-autoservername    +float             +mouse_xterm       +terminal
-balloon_eval      +folding           +multi_byte        +terminfo
+balloon_eval_term -footer            +multi_lang        +termresponse
-browse            +fork()            -mzscheme          +textobjects
++builtin_terms    -gettext           +netbeans_intg     +timers
+byte_offset       -hangul_input      +num64             +title
+channel           +iconv             +packages          -toolbar
+cindent           +insert_expand     +path_extra        +user_commands
-clientserver      +job               +perl              +vertsplit
+clipboard         +jumplist          +persistent_undo   +virtualedit
+cmdline_compl     +keymap            +postscript        +visual
+cmdline_hist      +lambda            +printer           +visualextra
+cmdline_info      +langmap           +profile           +viminfo
+comments          +libcall           +python            +vreplace
+conceal           +linebreak         -python3           +wildignore
+cryptv            +lispindent        +quickfix          +wildmenu
+cscope            +listcmds          +reltime           +windows
+cursorbind        +localmap          +rightleft         +writebackup
+cursorshape       -lua               +ruby              -X11
+dialog_con        +menu              +scrollbind        -xfontset
+diff              +mksession         +signs             -xim
+digraphs          +modify_fname      +smartindent       -xpm
-dnd               +mouse             +startuptime       -xsmp
-ebcdic            -mouseshape        +statusline        -xterm_clipboard
+emacs_tags        +mouse_dec         -sun_workshop      -xterm_save
+eval              -mouse_gpm         +syntax            
+ex_extra          -mouse_jsbterm     +tag_binary        
+extra_search      +mouse_netterm     +tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework AppKit   -mmacosx-version-min=10.13 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.26.1/lib/perl5/5.26.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -F/usr/local/opt/python/Frameworks -framework Python   -lruby.2.5.0 -lobjc    
buzuck commented 5 years ago

Actually, it seems it is the desired behavior, see this comment bloc: https://github.com/haya14busa/is.vim/blob/master/autoload/is.vim#L31 However, the documentation is imho incoherent with that =/

The good news is, you can have the behavior of C-{g,t} on C-{j,k} like so:

let g:is#do_default_mappings = 0
cnoremap <C-j> <C-g>
cnoremap <C-k> <C-t>