Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 08-27-2006, 04:19 PM   #1
Registered: Sep 2005
Distribution: Ubuntu
Posts: 250

Rep: Reputation: 30
Vim map - to _ and the reverse

I am trying to get vim to switch the - and the _ keys. I have got vim to map the - to the _, which is really handy when I am programming. I used

imap - _
Now, I cannot get it to the reverse, meaning I want to to print a '-' when I would use the key sequence for an '_' (Shift + -). Whatever I map gives me a recursive mapping (which makes sense I guess). Does anyone know how to make this work?
Old 08-27-2006, 10:52 PM   #2
Valdis Grinbergs
Registered: Dec 2005
Distribution: Debian
Posts: 30

Rep: Reputation: 25
The following will do it:

As you have already done:
imap - _
imap _ -

Type the following two commands as well:

inoremap - _
inoremap _ -


dash, mapping, vim

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
vim map Caps Lock to Escape sadarax Linux - General 3 01-30-2010 01:16 PM
encryption with Vim (vim -x) mikshaw Linux - Software 2 03-07-2007 09:00 AM
LXer: Vim tips: Using Vim mappings and abbreviations LXer Syndicated Linux News 0 06-18-2006 01:54 PM
LXer: Cream for Vim - Making Vim more user friendly LXer Syndicated Linux News 0 06-17-2006 11:54 PM
SYSERR(root): hash map "generics": missing map file /etc/mail/genericstable.db? singying304 Linux - Networking 4 02-28-2005 06:49 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:50 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration