From 07cfbd6592338cf044b40f282ecd8e0bccf2ec29 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 10 Apr 2014 17:31:08 -0400 Subject: [PATCH] fix #27: multibyte highlighting! fix a (literal) edge case: matches near edge of screen were not considered on-screen. --- README.md | 7 ++++--- autoload/sneak/search.vim | 2 +- autoload/sneak/streak.vim | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d9e0c02..6e33ff5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # sneak.vim :shoe: -Sneak is a minimalist, versatile Vim *motion* plugin that flies you to any location specified by two characters. +Sneak is a minimalist, versatile Vim *motion* plugin that jumps to any location specified by two characters. It works with **multiple lines**, **operators** (including **repeat** `.` -and **[surround]**), **[keymaps]**, **visual mode**, -and **macros**. Many small details have been carefully considered to minimize +and **[surround]**), **[keymaps]**, **visual mode**, **[unicode]** ("multibyte"), +and **macros**. Many details have been carefully balanced to minimize friction between *intent* and *action*. The plugin chooses sane defaults, easily changed via `` mappings @@ -14,6 +14,7 @@ to [EasyMotion](https://github.com/Lokaltog/vim-easymotion): let g:sneak#streak = 1 +[unicode]: http://vimdoc.sourceforge.net/htmldoc/mbyte.html#UTF-8 [keymaps]: http://vimdoc.sourceforge.net/htmldoc/mbyte.html#mbyte-keymap [surround]: https://github.com/tpope/vim-surround [count]: http://vimdoc.sourceforge.net/htmldoc/intro.html#[count] diff --git a/autoload/sneak/search.vim b/autoload/sneak/search.vim index e4cd88c..9fdf09c 100644 --- a/autoload/sneak/search.vim +++ b/autoload/sneak/search.vim @@ -37,7 +37,7 @@ func! sneak#search#new() let wincol_lhs = a:w.leftcol "this is actually just to the _left_ of the first onscreen column. let wincol_rhs = 2 + (winwidth(0) - sneak#util#wincol1()) + wincol_lhs "restrict search to window - return '\%>'.(wincol_lhs).'c'.'\%<'.wincol_rhs.'c' + return '\%>'.(wincol_lhs).'v'.'\%<'.(wincol_rhs+1).'v' endf func! s.get_stopline() diff --git a/autoload/sneak/streak.vim b/autoload/sneak/streak.vim index 828a16b..294991f 100644 --- a/autoload/sneak/streak.vim +++ b/autoload/sneak/streak.vim @@ -33,8 +33,7 @@ let g:sneak#target_labels = get(g:, 'sneak#target_labels', "asdfghjkl;qwertyuiop func! s:placematch(c, pos) let s:matchmap[a:c] = a:pos - "TODO: figure out why we must +1 the column... - exec "syntax match SneakStreakTarget '.\\%".a:pos[0]."l\\%".(a:pos[1]+1)."c' conceal cchar=".a:c + exec "syntax match SneakStreakTarget '\\%".a:pos[0]."l\\%".a:pos[1]."c.' conceal cchar=".a:c endf func! s:decorate_statusline() "highlight statusline to indicate streak-mode.