Monday, March 28, 2011

Re: Function to write correctly French quotation marks

Hi Christian,

Thank you for your answer.

Le 23-03-2011, à 17:57:53 +0100, Christian Brabandt (cblists@256bit.org) a écrit :

> On Wed, March 23, 2011 3:20 pm, Steve wrote:

> > In French, we do not write "word" or 'word', we write « word », with a
> > non-breakable space after « and before ». Until now, I do:
> >
> > <c-k><<<c-k>NSword<c-k>NS<c-k>>>
> >
> > which is really not convenient. I'd like a function, say Guillemets(),
> > which does that automatiquelly. I would then map it to a function key FN
> > (or whatever else) and just call it in normal mode. Problem, I really
> > don't have the necessary skills to do that.
> >
> > Anybody could help?
>
> Does those two mappings help you?
>
> :imap <expr> " getline('.')[col('.')-2]=~'\S' ? ' »' : '« '
> :imap <expr> ' getline('.')[col('.')-2]=~'\S' ? ' »' : '« '

In fact, both don't do anything. I replaced <expr> by <F10> or
<Leader>gu, but nothing happens. But since I was using vim through a
putty connexion (from a w XP box), I thought that could be the reason.
So I installed vim 7.1 on the windows box, then created a _vimrc file
with both lines, and still nothing.

I tried to understand the meaning of those two lines, but failed, even
with the help of google.

> (the space inside the single quotes was inserted literally as non-breaking
> space, e.g. by entering <c-k>NS).

I did the same.

I was wondering if a substitution could help, something like:

s/word/« word »/

But I don't know how to catch word (or even several words, maybe with
visual mode).


More help would be greatly appreciated.

Have a nice day,
steve

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