Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

vim-smartword: Support o_V and o_CTRL-V

  • Loading branch information...
commit 4ba24dc86cd4fa4c7663a938e98d4d8fb5f89f82 1 parent fe5b912
@kana authored
View
28 vim/dot.vim/autoload/smartword.vim
@@ -23,8 +23,26 @@
" }}}
" Interface "{{{1
function! smartword#move(motion_command, mode) "{{{2
+ let exclusive_adjustment_p = 0
if a:mode ==# 'o' && (a:motion_command ==# 'e' || a:motion_command ==# 'ge')
- normal! v
+ if exists('v:motion_force') " if it's possible to check o_v and others:
+ if v:motion_force == ''
+ " inclusive
+ normal! v
+ elseif v:motion_force ==# 'v'
+ " User-defined motion is always exclusive and o_v forces it inclusve.
+ " So here use Visual mode to behave this motion as an exclusive one.
+ normal! v
+ let exclusive_adjustment_p = !0
+ else " v:motion_force ==# 'V' || v:motion_force ==# "\<C-v>"
+ " linewise or blockwise
+ " -- do nothing because o_V or o_CTRL-V will override the motion type.
+ endif
+ else " if it's not possible:
+ " inclusive -- the same as the default style of "e" and "ge".
+ " BUGS: o_v and others are ignored.
+ normal! v
+ endif
endif
for i in range(v:count1)
@@ -43,6 +61,14 @@ function! smartword#move(motion_command, mode) "{{{2
endif
endwhile
endfor
+
+ if exclusive_adjustment_p
+ if a:motion_command ==# 'e'
+ " FIXME: NIY
+ else " a:motion_command ==# 'ge'
+ " FIXME: NIY
+ endif
+ endif
endfunction
View
4 vim/dot.vim/doc/smartword.txt
@@ -127,6 +127,10 @@ BUGS *smartword-bugs*
- |o_v| and others don't work for |<Plug>(smartword-e)| and
|<Plug>(smartword-ge)| because of the limitation of Vim script.
+ Note that if the following patch is applied, |o_V| and |o_CTRL-V| work for
+ both motions: http://github.com/kana/vim/commits/hack/vimvar-motion_force
+ (|o_v| doesn't work yet.)
+
Please sign in to comment.
Something went wrong with that request. Please try again.