Saturday, August 4, 2012

Re: Encoding of double quotes by Vim

On 04/08/12 13:19, Eric Weir wrote:
>
> I write in Vim and when ready to format/publish dump documents in LyX
> for formatting as LaTeX documents. When I do so, double quotes show up
> in LyX with closing quotes at the beginning and end of the quote. When
> dumped in a word processor, opening and closing quotes are identical as
> well, but they are the vertical quotation marks, not the ones that curve
> in and out that is standard in LyX. I'm guess the latter is what is
> meant by "smart quotes."
>
> I'm wondering if it's possible to change the encoding of double quotes
> in Vim so they don't get translated the way they do in LyX.
>
> Thanks,
> ------------------------------------------------------------------------------------------
> Eric Weir
> Decatur, GA
> eeweir@bellsouth.net <mailto:eeweir@bellsouth.net>

Vim's double quotes are Latin1 0x22, Unicode U+0022 QUOTATION MARK;
Unicode adds about them:
* neutral (vertical), used as opening or closing quotation mark
* preferred characters in English for paired quotation marks are U+201C
" and U+201D ".

If LyX modifies your neutral (") quotation marks to make them closing
ones (") that's a LyX problem, not a Vim problem.

If you want to be able to type "pretty" quotation marks in Vim (as I
just did here in my mailer), there are several possibilities:
- find out if your keyboard has them (on mine, it's AltGr+v and AltGr+b)
- use Ctrl-V u 201c and Ctrl-V u 201d (see :help i_CTRL-V_digit)
- make up (or find) a keymap which has them, see
http://vim.wikia.com/wiki/How_to_make_a_keymap
- make Insert-mode mappings for them, for instance (with the ' and '
single quotes for good measure):

" double opening quote
map! <F6> <Char-0x201C>
" double closing quote
map! <F7> <Char-0x201D>
" single opening quote
map! <S-F6> <Char-0x2018>
" single closing quote
map! <S-F7> <Char-0x2019>

and put them in your vimrc (see :help <Char> about the values I used
above in the {rhs} of the mappings). The above assumes that 'encoding'
has been set to UTF-8 before you define those mappings, see
http://vim.wikia.com/wiki/Working_with_Unicode


Best regards,
Tony.
--
Don't cook tonight -- starve a rat today!

--
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: