Quantcast

Cut and paste between vim and OS X terminal

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Cut and paste between vim and OS X terminal

Henry Throop
Hi --

I'm having a problem using cut and paste to put text from a VIM  
document, into a terminal window.  It's some sort of character  
encoding issue.  Here's what I do:

o Start up gvim with no file.  I'm using 6.2.
o Type a few characters.
o Copy some material (Apple-C)
o Move to a terminal window
o Paste it (Apple-V)
o Material is pasted, but the encoding is incorrect.

If I cut the phrase 'ABCabc', then what gets pasted is this:

'\344\205\202\344\215\241\346\211\243'

If I paste it into a non-terminal window such as Mail or Textedit, I  
get Chinese characters.

Copying *from* Textedit to terminal works fine, so I think the  
problem is something to do with vim.

Can someone point me to what I might have set that's doing this?

Thanks,
-Henry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Cut and paste between vim and OS X terminal

A.J.Mechelynck
Henry Throop wrote:

> Hi --
>
> I'm having a problem using cut and paste to put text from a VIM
> document, into a terminal window.  It's some sort of character encoding
> issue.  Here's what I do:
>
> o Start up gvim with no file.  I'm using 6.2.
> o Type a few characters.
> o Copy some material (Apple-C)
> o Move to a terminal window
> o Paste it (Apple-V)
> o Material is pasted, but the encoding is incorrect.
>
> If I cut the phrase 'ABCabc', then what gets pasted is this:
>
> '\344\205\202\344\215\241\346\211\243'
>
> If I paste it into a non-terminal window such as Mail or Textedit, I get
> Chinese characters.
>
> Copying *from* Textedit to terminal works fine, so I think the problem
> is something to do with vim.
>
> Can someone point me to what I might have set that's doing this?
>
> Thanks,
> -Henry
>

What happens if you set 'encoding' to "macroman" (the legacy Mac encoding)
prior to yanking? If it doesn't work, try UTF-8.


Best regards,
Tony.
--
Meader's Law:
        Whatever happens to you, it will previously have happened to
everyone you know, only more so.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Cut and paste between vim and OS X terminal

Henry Throop
OK; tried that.  Both macroman and utf-8 give me the same results,  
which are the same as before.

-Henry

On Jun 2, 2007, at 2:50 PM, A.J.Mechelynck wrote:

> Henry Throop wrote:
>> Hi --
>> I'm having a problem using cut and paste to put text from a VIM  
>> document, into a terminal window.  It's some sort of character  
>> encoding issue.  Here's what I do:
>> o Start up gvim with no file.  I'm using 6.2.
>> o Type a few characters.
>> o Copy some material (Apple-C)
>> o Move to a terminal window
>> o Paste it (Apple-V)
>> o Material is pasted, but the encoding is incorrect.
>> If I cut the phrase 'ABCabc', then what gets pasted is this:
>> '\344\205\202\344\215\241\346\211\243'
>> If I paste it into a non-terminal window such as Mail or Textedit,  
>> I get Chinese characters.
>> Copying *from* Textedit to terminal works fine, so I think the  
>> problem is something to do with vim.
>> Can someone point me to what I might have set that's doing this?
>> Thanks,
>> -Henry
>
> What happens if you set 'encoding' to "macroman" (the legacy Mac  
> encoding) prior to yanking? If it doesn't work, try UTF-8.
>
>
> Best regards,
> Tony.
> --
> Meader's Law:
> Whatever happens to you, it will previously have happened to
> everyone you know, only more so.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Cut and paste between vim and OS X terminal

A.J.Mechelynck
Henry Throop wrote:

> OK; tried that.  Both macroman and utf-8 give me the same results, which
> are the same as before.
>
> -Henry
>
> On Jun 2, 2007, at 2:50 PM, A.J.Mechelynck wrote:
>
>> Henry Throop wrote:
>>> Hi --
>>> I'm having a problem using cut and paste to put text from a VIM
>>> document, into a terminal window.  It's some sort of character
>>> encoding issue.  Here's what I do:
>>> o Start up gvim with no file.  I'm using 6.2.
>>> o Type a few characters.
>>> o Copy some material (Apple-C)
>>> o Move to a terminal window
>>> o Paste it (Apple-V)
>>> o Material is pasted, but the encoding is incorrect.
>>> If I cut the phrase 'ABCabc', then what gets pasted is this:
>>> '\344\205\202\344\215\241\346\211\243'
>>> If I paste it into a non-terminal window such as Mail or Textedit, I
>>> get Chinese characters.
>>> Copying *from* Textedit to terminal works fine, so I think the
>>> problem is something to do with vim.
>>> Can someone point me to what I might have set that's doing this?
>>> Thanks,
>>> -Henry
>>
>> What happens if you set 'encoding' to "macroman" (the legacy Mac
>> encoding) prior to yanking? If it doesn't work, try UTF-8.
>>
>>
>> Best regards,
>> Tony.
>> --
>> Meader's Law:
>>     Whatever happens to you, it will previously have happened to
>> everyone you know, only more so.
>

Analysis of the octal values you list seems to indicate that your clipboard is
getting Latin1, mistaking it for ucs-2be, and translating it to UTF-8: for
instance, \344\205\202 is the UTF-8 bytecode for the U+4142 codepoint.

I think this /might/ be a fixed bug, check the following bug summaries:

http://ftp.vim.org/pub/vim/patches/README (patches for Vim 6.2 and earlier)
http://ftp.vim.org/pub/vim/patches/6.3/README
http://ftp.vim.org/pub/vim/patches/6.4/README
http://ftp.vim.org/pub/vim/patches/7.0/README
http://ftp.vim.org/pub/vim/patches/7.1/README

Or else, boldly install 7.1.002 and see if the problem persists.


Best regards,
Tony.
--
Paranoid schizophrenics outnumber their enemies at least two to one.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Cut and paste between vim and OS X terminal

Henry Throop

On Jun 2, 2007, at 5:07 PM, A.J.Mechelynck wrote:

> Henry Throop wrote:
>> OK; tried that.  Both macroman and utf-8 give me the same results,  
>> which are the same as before.
>> -Henry
>> On Jun 2, 2007, at 2:50 PM, A.J.Mechelynck wrote:
>>> Henry Throop wrote:
>>>> Hi --
>>>> I'm having a problem using cut and paste to put text from a VIM  
>>>> document, into a terminal window.  It's some sort of character  
>>>> encoding issue.  Here's what I do:
>>>> o Start up gvim with no file.  I'm using 6.2.
>>>> o Type a few characters.
>>>> o Copy some material (Apple-C)
>>>> o Move to a terminal window
>>>> o Paste it (Apple-V)
>>>> o Material is pasted, but the encoding is incorrect.
>>>> If I cut the phrase 'ABCabc', then what gets pasted is this:
>>>> '\344\205\202\344\215\241\346\211\243'
>>>> If I paste it into a non-terminal window such as Mail or  
>>>> Textedit, I get Chinese characters.
>>>> Copying *from* Textedit to terminal works fine, so I think the  
>>>> problem is something to do with vim.
>>>> Can someone point me to what I might have set that's doing this?
>>>> Thanks,
>>>> -Henry
>>>
>>> What happens if you set 'encoding' to "macroman" (the legacy Mac  
>>> encoding) prior to yanking? If it doesn't work, try UTF-8.
>>>
>>>
>>> Best regards,
>>> Tony.
>>> --
>>> Meader's Law:
>>>     Whatever happens to you, it will previously have happened to
>>> everyone you know, only more so.
>
> Analysis of the octal values you list seems to indicate that your  
> clipboard is getting Latin1, mistaking it for ucs-2be, and  
> translating it to UTF-8: for instance, \344\205\202 is the UTF-8  
> bytecode for the U+4142 codepoint.
>
> I think this /might/ be a fixed bug, check the following bug  
> summaries:
>
> http://ftp.vim.org/pub/vim/patches/README (patches for Vim 6.2 and  
> earlier)
> http://ftp.vim.org/pub/vim/patches/6.3/README
> http://ftp.vim.org/pub/vim/patches/6.4/README
> http://ftp.vim.org/pub/vim/patches/7.0/README
> http://ftp.vim.org/pub/vim/patches/7.1/README
>
> Or else, boldly install 7.1.002 and see if the problem persists.
>
>
> Best regards,
> Tony.


Well, that was simple. I upgraded to 7.0 and the problem's fixed.  
Thank you!!

-Henry
Loading...