Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Need to double-escape backslashes in langmap?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ben Fritz  
View profile  
 More options Dec 9 2011, 10:27 am
From: Ben Fritz <fritzophre...@gmail.com>
Date: Fri, 9 Dec 2011 07:27:20 -0800 (PST)
Local: Fri, Dec 9 2011 10:27 am
Subject: Need to double-escape backslashes in langmap?
I'm a little stumped by a problem brought to light by a recent edit to
http://vim.wikia.com/wiki/Using_Vim_with_the_Dvorak_keyboard_layout

:help 'langmap' says:

        The 'langmap' option is a list of parts, separated with commas.  Each
        part can be in one of two forms:
        1.  A list of pairs.  Each pair is a "from" character immediately
            followed by the "to" character.  Examples: "aA", "aAbBcC".
        2.  A list of "from" characters, a semi-colon and a list of "to"
            characters.  Example: "abc;ABC"
        Example: "aA,fgh;FGH,cCdDeE"
        Special characters need to be preceded with a backslash.  These are
        ";", ',' and backslash itself.

The tip linked above tries to set 'langmap' to include a mapping of
the comma key to a w (because in Dvorak, you press what would be a
comma in QWERTY to get a w, and vice versa).

From the :help entry, I and the tip author would type the following to
accomplish this:

:set langmap=\,w

However, doing so gives:

E357: 'langmap': Matching character missing for w

This works, but I cannot justify why it would be needed:

:set langmap=\\,w

And, as a related problem, this means you need to type FOUR
backslashes to get a single backslash in a langmap. This seems wrong.

e.g. this gives the same error as above:

:set langmap=\\h

But this works:

:set langmap=\\\\h

Am I missing something here? It's certainly surprising behavior that
should be documented if intentional, but I'm not confident it's a
bug...yet.

Vim 7.3.353 "Vim without Cream" build.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tony Mechelynck  
View profile  
 More options Dec 9 2011, 11:44 am
From: Tony Mechelynck <antoine.mechely...@gmail.com>
Date: Fri, 09 Dec 2011 17:44:25 +0100
Local: Fri, Dec 9 2011 11:44 am
Subject: Re: Need to double-escape backslashes in langmap?
On 09/12/11 16:27, Ben Fritz wrote:

What you are missing is documented under :help option-backslash

In order to get a backslash in the value of an option, you need two in
the :set statement; in order to get two, you need four. Similarly, if
you want a space, a tab or a vertical bar to be part of the value of an
option, you need backslash-escaping in the :set statement.

When it is said under 'langmap' that "special characters must be
preceded by a backslash", it means they must be preceded by a backslash
in the _value_ of the option; but _setting_ that value already halves
the number of backslashes in the :set command.

If you want the langmap to change a comma to a w, you need to
backslash-escape the comma so it isn't used as a separator. This is done
by using

        :set langmap=\\,w
or
        :let &langmap = '\,w'

which are equivalent.

Similarly, to change a backslash to an h, you need

        :set langmap=\\\\h
or
        :let &langmap = '\\h'

because a backslash-escaped backslash must remain in the value of the
option.

Best regards,
Tony.
--
"It's a small world, but I wouldn't want to have to paint it."
                -- Steven Wright


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Fritz  
View profile  
 More options Dec 9 2011, 2:00 pm
From: Ben Fritz <fritzophre...@gmail.com>
Date: Fri, 9 Dec 2011 11:00:55 -0800 (PST)
Local: Fri, Dec 9 2011 2:00 pm
Subject: Re: Need to double-escape backslashes in langmap?

On Dec 9, 10:44 am, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:

> What you are missing is documented under :help option-backslash

> In order to get a backslash in the value of an option, you need two in
> the :set statement; in order to get two, you need four. Similarly, if
> you want a space, a tab or a vertical bar to be part of the value of an
> option, you need backslash-escaping in the :set statement.

> When it is said under 'langmap' that "special characters must be
> preceded by a backslash", it means they must be preceded by a backslash
> in the _value_ of the option; but _setting_ that value already halves
> the number of backslashes in the :set command.

Thanks, Tony; it all makes sense now.

How about a change to :help 'langmap', so that it reads:

        The 'langmap' option is a list of parts, separated with commas.  Each
        part can be in one of two forms:
        1.  A list of pairs.  Each pair is a "from" character immediately
            followed by the "to" character.  Examples: "aA", "aAbBcC".
        2.  A list of "from" characters, a semi-colon and a list of "to"
            characters.  Example: "abc;ABC"
        Special characters ';', ',', and backslash itself need to be preceded
        in the option value with a backslash, meaning you must escape
        backslashes twice in a |:set| command.

        Example for mapping the first few alphabetic characters to their
        capitalized counterpart, and also mapping '\' to I and ',' to J: >
            set langmap=aA,fgh;FGH,cCdDeE,\\\\I,\\,J


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tony Mechelynck  
View profile  
 More options Dec 9 2011, 2:42 pm
From: Tony Mechelynck <antoine.mechely...@gmail.com>
Date: Fri, 09 Dec 2011 20:42:27 +0100
Local: Fri, Dec 9 2011 2:42 pm
Subject: Re: Need to double-escape backslashes in langmap?
On 09/12/11 20:00, Ben Fritz wrote:

                                                (see |option-backslash|)

>    Example for mapping the first few alphabetic characters to their
>    capitalized counterpart, and also mapping '\' to I and ',' to J:>
>    set langmap=aA,fgh;FGH,cCdDeE,\\\\I,\\,J

Best regards,
Tony.
--
Your conscience never stops you from doing anything.  It just stops you
from enjoying it.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »