Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3229182
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:46:52+00:00 2026-05-17T16:46:52+00:00

I want to map Ctrl – M to Ctrl – N in insert mode.

  • 0

I want to map Ctrl–M to Ctrl–N in insert mode. If I simply do imap <C-M> <C-N> then Ctrl–M does start to behave just like Ctrl–N, but then hitting Enter does the same as well. I want pressing Return to keep inserting new lines, and at the same time make Ctrl–M insert the next keyword completion match just like Ctrl–N does. Is that possible?

EDIT:
I managed to modify Vim’s source code to unconditionally treat Ctrl–M as Ctrl–N without affecting Return. While doing so I also realized that indeed there is no way to do that without source code change, as the distinction between what has actually been pressed – Enter or Ctrl–M, appears to vanish much too early in key-press processing. It happens in platform-dependent UI modules, and the portable code part in key-press handling already has no idea if Ctrl–M or Return was actually pressed that resulted in key code 13.

My modifications were in GUI modules for FreeBSD (GTK) and Windows, as those are the platforms I use gvim on most often.

P.S. If anyone ever wants to achieve the same, please feel free to drop me a note.

P.P.S. To all who have provided answers to this question: thank you very much! Your comments helped me a lot.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:46:52+00:00Added an answer on May 17, 2026 at 4:46 pm

    If you are using Windows, you can probably use Autohotkey to re-map Ctrl-M while in insert mode if the active window is vim.

    The ahk script would probably look something like this:

     #IfWinActive, Write: ahk_class GVIM
     ^M::^N
    

    Alternately, you might consider working on your touch typing skills (I doubt you want to hear that solution, but I still think it’s a valid suggestion) to avoid getting Ctrl-M and Ctrl-N confused.

    If you are using some flavor of Linux, I am not sure what tools could be equivalent to autohotkey.

    Another alternative is to map a completely different key to let you do autocompletion, instead of using ctrl-n, such as Ctrl-K: :inoremap <c-k> <c-n>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want something like an std::map , but I only want to see if
I want to have a map that has a homogeneous key type but heterogeneous
I want to insert a pair< string, vector<float> > into a map, first it
I want to map ctrl-tab to :tabn, and ctrl-shift-tab to :tabp. I had it
I want map my object from text file, the text file contents are like
I have this object graph, I want to map: abstract Account (username, password, ...)
I have a database field called abCode , that I want to map to
I want to fill a map with class name and method, a unique identifier
I want to texture a sphere with a cube map. So far my research
What I want is lots of nodes which can expand making a mind map.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.