Jürgen Krämer <[EMAIL PROTECTED]> writes:

> Hi,
>
> Marc Weber write:
>> You're hitting two problems:
>> a) How to run a command and pass an args?
>>   using exec. Exapmle:
>>   exec "MyCommand ".arg1
>>   You still have to quote spaces eg using substitute
>> 
>> b) How to get char under cursor. Sure, yanking works. But maybe you
>>    don't want to change the registers. 
>>   answer: 
>>     getline('.')[col('.')-1]
>
> you cannot use this getline()-expression reliably if encoding is set to
> utf8 and your line contains non-ASCII characters, because getline()[i]
> only returns *one* byte of a possible multi-byte sequence, e.g. with
> this text
>
>   123äöüabc
>
> the commands
>
>   let line = getline(1)
>
>   for i in range(0, strlen(line) - 1)
>     echo i . ': ' . line[i]
>   endfor
>
> prints
>
>   0: 1
>   1: 2
>   2: 3
>   3: <c3>
>   4: <a4>
>   5: <c3>
>   6: <b6>
>   7: <c3>
>   8: <bc>
>   9: a
>   10: b
>   11: c
>
> In contrast, yanking the character under the cursor with
>
>   normal yl
>
> works correctly.
>
> Regards,
> Jürgen

Yes, I need yl method, thanks :)

-- 
Regards,

  anhnmncb
 gpg key: 44A31344

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to