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 9023635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:48:31+00:00 2026-06-16T05:48:31+00:00

I use mappings to normal mode commands that I’d also like to work in

  • 0

I use mappings to normal mode commands that I’d also like to work in insert mode. This can be done by adding <C-o> to insert mode mapping:

nmap <C-Up> 10<Up>
imap <C-Up> <C-o>10<Up>

But this means repeating each mapping twice.
To avoid repetition, I’ve tried to “overload” some other key, then use it for mode-specific part:

" F12 selects prefix suitable for current mode
nmap <F12> <Nop>
imap <F12> <C-o>
" single mapping relying on "overloaded" F12 
map <C-Up> <F12>10<Up>

For some reason, it doesn’t work. F2 in insert mode just inserts <F2> as text.
Any idea what’s wrong and how to fix it?
Bonus points if you can extend the solution to visual mode.

  • 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-06-16T05:48:32+00:00Added an answer on June 16, 2026 at 5:48 am

    There are no commands to define mappings for all modes: :map maps for normal, operator-pending and visual modes (really visual and select at once) which is clearly stated in documentation. It does not make any sense to have same mapping for all modes, though unlike movement ones saving may be done in all modes with exactly the same rhs:

    function s:Save()
        update
        return ''
    endfunction
    noremap  <expr> <F2> <SID>Save()
    noremap! <expr> <F2> <SID>Save()
    

    . noremap! is another multi-mode mapping command, it covers insert and command mode now. You can’t move the cursor from <SID>Save() function (textlock) thus this method is not applicable for cursor movement commands, but you can use variables in order not to repeat the same thing twice:

    let s:tendownlhs='10j'
    execute ' noremap <C-Down>      '.s:tendownlhs
    execute 'inoremap <C-Down> <C-o>'.s:tendownlhs
    

    . Now without command mode as this is tricky and likely useless.

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

Sidebar

Related Questions

I've seen people use many-to-one mappings to represent one-to-one relationships. I've also read this
Is it possible to use Fluent NHibernate's PersistenceSpecification to test NHibernate mappings done via
Hibernate allows adding indexes on @ManyToOne mappings by the use of @org.hibernate.annotations.Index . Is
I have several one-to-many mappings in an NHibernate project that are configured to use
We use a bit of javascript that overwrites the setTimeout method for IE. This
In order to use normal mapping in GLSL shaders, you need to know the
I try to use this mapping : @Entity @Table(name=ecc.\RATE\) @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name=DISCRIMINATOR, discriminatorType= DiscriminatorType.STRING) public
Wether I use Automapper or manually mapping, that plays no role. All the data
I'm trying to use empty() in array mapping in php. I'm getting errors that
Could I use action mappings in struts.xml and Spring's RequestMapping annotation in the same

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.