Changeset 4728 for lang/vim/textobj-user/trunk
- Timestamp:
- 01/17/08 01:24:31 (10 months ago)
- Location:
- lang/vim/textobj-user/trunk
- Files:
-
- 2 modified
-
autoload/textobj/user.vim (modified) (4 diffs)
-
doc/textobj-user.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/vim/textobj-user/trunk/autoload/textobj/user.vim
r2774 r4728 1 1 " textobj-user - Support for user-defined text objects 2 " Version: 0. 13 " Copyright (C) 2007 kana <http://nicht.s8.xrea.com/>2 " Version: 0.2 3 " Copyright (C) 2007-2008 kana <http://nicht.s8.xrea.com/> 4 4 " License: MIT license (see <http://www.opensource.org/licenses/mit-license>) 5 5 " $Id$ "{{{1 6 6 " Interfaces "{{{1 7 7 8 function! textobj#user#move(pattern, flags) 8 function! textobj#user#move(pattern, flags, previous_mode) 9 if a:previous_mode ==# 'v' 10 normal! gv 11 endif 9 12 let i = v:count1 10 13 while 0 < i … … 20 23 " FIXME: In a case of a:pattern matches with one character. 21 24 function! textobj#user#select(pattern, flags, previous_mode) 22 execute 'normal!' "gv\<Esc>" 25 if a:previous_mode ==# 'v' 26 execute 'normal!' "gv\<Esc>" 27 endif 23 28 let ORIG_POS = s:gpos_to_spos(getpos('.')) 24 29 … … 114 119 for lhs in lhss 115 120 if function_name == 'move-to-next' 116 execute 'nnoremap' s:mapargs_single_move(lhs, pat0, '') 121 execute 'nnoremap' s:mapargs_single_move(lhs, pat0, '', 'n') 122 execute 'vnoremap' s:mapargs_single_move(lhs, pat0, '', 'v') 123 execute 'onoremap' s:mapargs_single_move(lhs, pat0, '', 'o') 117 124 elseif function_name == 'move-to-next-end' 118 execute 'nnoremap' s:mapargs_single_move(lhs, pat0, 'e') 125 execute 'nnoremap' s:mapargs_single_move(lhs, pat0, 'e', 'n') 126 execute 'vnoremap' s:mapargs_single_move(lhs, pat0, 'e', 'v') 127 execute 'onoremap' s:mapargs_single_move(lhs, pat0, 'e', 'o') 119 128 elseif function_name == 'move-to-prev' 120 execute 'nnoremap' s:mapargs_single_move(lhs, pat0, 'b') 129 execute 'nnoremap' s:mapargs_single_move(lhs, pat0, 'b', 'n') 130 execute 'vnoremap' s:mapargs_single_move(lhs, pat0, 'b', 'v') 131 execute 'onoremap' s:mapargs_single_move(lhs, pat0, 'b', 'o') 121 132 elseif function_name == 'move-to-prev-end' 122 execute 'nnoremap' s:mapargs_single_move(lhs, pat0, 'be') 133 execute 'nnoremap' s:mapargs_single_move(lhs, pat0, 'be', 'n') 134 execute 'vnoremap' s:mapargs_single_move(lhs, pat0, 'be', 'v') 135 execute 'onoremap' s:mapargs_single_move(lhs, pat0, 'be', 'o') 123 136 elseif function_name == 'select-next' || function_name == 'select' 124 137 execute 'vnoremap' s:mapargs_single_select(lhs, pat0, '', 'v') … … 214 227 215 228 216 function! s:mapargs_single_move(lhs, pattern, flags) 217 return printf('<silent> %s :<C-u>call textobj#user#move(%s, %s)<CR>', 218 \ a:lhs, string(a:pattern), string(a:flags)) 229 function! s:mapargs_single_move(lhs, pattern, flags, previous_mode) 230 return printf('<silent> %s :<C-u>call textobj#user#move(%s, %s, %s)<CR>', 231 \ a:lhs, 232 \ string(a:pattern), string(a:flags), string(a:previous_mode)) 219 233 endfunction 220 234 -
lang/vim/textobj-user/trunk/doc/textobj-user.txt
r2774 r4728 1 1 *textobj-user.txt* Support for user-defined text objects 2 2 3 Version 0. 14 Copyright (C) 2007 kana <http://nicht.s8.xrea.com/>3 Version 0.2 4 Copyright (C) 2007-2008 kana <http://nicht.s8.xrea.com/> 5 5 License: MIT license (see <http://www.opensource.org/licenses/mit-license>) 6 6 $Id$ … … 25 25 26 26 *textobj#user#move()* 27 textobj#user#move({pattern}, {flags} )27 textobj#user#move({pattern}, {flags}, {previous-mode}) 28 28 Move the cursor to the appropriate object defined by {pattern}. 29 29 … … 33 33 'b' search backward instead of forward. 34 34 'e' move to the end of the match. 35 36 {previous-mode} is a string representing the "previous" mode, 37 that is, which mode of mapping causes the calling of this function. 38 For example, if this function is called via a mapping for 39 Operator-pending mode, {previous-mode} must be 'o'. 40 char meaning ~ 41 ---- ------- ~ 42 'n' Normal mode 43 'o' Operator-pending mode 44 'v' Visual mode 35 45 36 46 Return value is same as |searchpos()|. … … 49 59 cursor is not in the range of an object. 50 60 51 {previous-mode} is a string that represents the "previous" mode. 52 For example, if this function is called via a mapping for 53 Operator-pending mode, {previous-mode} must be 'o'. 54 char meaning ~ 55 ---- ------- ~ 56 'o' Operator-pending mode 57 'v' Visual mode 61 For the detail of {previous-mode}, see |textobj#user#move()|. 58 62 59 63 Return value is not defined. … … 74 78 {pattern1} and {pattern2}, this function does nothing. 75 79 76 For the detail of {previous-mode}, see |textobj#user# select()|.80 For the detail of {previous-mode}, see |textobj#user#move()|. 77 81 78 82 Return value is not defined. … … 128 132 CHANGELOG *textobj-user-changelog* 129 133 134 0.2 2008-01-07T08:44:14+09:00 135 - textobj#user#select(): Fix the wrong selecting in Operator-pending 136 mode. 137 - textobj#user#move(): Modify to be able to use in Visual and 138 Operator-pending mode. 139 130 140 0.1 2007-11-16T01:17:45+09:00 131 141 - Modify to be autoloaded.
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)