On So, 25 Dez 2011, Asis Hallab wrote:
> Merry Christmas to all!
> 
> Hopefully anyone of you can help me with my latest problem:
> 
> I want to write a function that extends the behaviour of t.T.f and F,
> so that the character-search does not stop at the end of the current line.
> 
> I just could not get it to work with the built in function search(),
> because in order to emulate t<char> and T<char>,
> I need to call /char/e-1, which I cant do using search().
> 
> So far I tried:
> 
> function! ExtendT(searchChar)
>      " search does not accept the 'e-1':
>      " search('/'.a:searchChar.'/e-1')
>      " can't be passed as "flag" to search:
>      " search(a:searchChar, "/e-1")
>      " eval does not work:
>      " eval '/'.a:searchChar.'/e-1'
>      " exe doesn't work either:
>      " execute '/'.a:searchChar.'/e-1'
> endfunction
> 
> Anyway, I am unsure, if getting the above function to work and mapping it
> to e.g. t,
> this will work as a movement-command in Vim?
> So will I be able to do ct#
> on the following (cursor-position is indicated by *):
> 
> This is l*ine one
> and I want to change until here #.
onoremap <silent> <expr> t '/'.nr2char(getchar())."/e-1\n"
Mit freundlichen Grüßen
Christian
-- 
Sicherheit ist das Irrlicht, dem Wünschende nachjagen.
		-- Walter Heiby
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
 
No comments:
Post a Comment