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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:06:56+00:00 2026-06-08T11:06:56+00:00

I have modified the IMAP function from vim-latex , so that an undo is

  • 0

I have modified the IMAP function from vim-latex, so that an undo is possible, by changing the final return line of LookupCharacter to

return a:char . "^Gu\<bs>" . bs . IMAP_PutTextWithMovement(rhs, phs, phe)

Now to do the undo directly from insert mode, I have this mapping in my .vimrc:

imap <Undo> <Esc>ui

I use the Neo2 keyboard layout, so there’s an undo key on the 4th layer.

Now this works fairly well, but the problem is that when I use it at the end of a line, the cursor is placed before the last character. To test it without vim-latex, you could do

:imap a a^Gu\<bs>test

type ‘b’ in the middle and at the end of a line and then execute the undo, by shortcut or by manually pressing <Esc>ui.

So is there a way to make vim jump back to the correct cursor position?

I have seen an entry in wikia which gives an idea, but I don’t know how to achieve it with the imap mapping.

  • 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-08T11:06:59+00:00Added an answer on June 8, 2026 at 11:06 am

    The cursor move is due to the indiscriminate use of i at the end of your mapping. Typically, one temporarily executes a normal mode command via

    imap <Undo> <C-\><C-o>u
    

    But in your case, as the undo modifies the buffer, this may not work under all circumstances.

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

Sidebar

Related Questions

I have modified my notebook's stylesheet to include a StyleData[Todo] that inherits from StyleData[Item]
I have modified user exit MV45AFZB FORM userexit_check_xvbap_for_delet to keep users from deleting line
I have modified a working Windows service that had always been starting beforehand. After
I have modified my etc/hosts file (under Windows 7), so that www.example.com and demo.example.com
I have modified my application, so that when a new user is registered, it's
I have modified a UISegmentedControl so that it is vertical instead of horizontal- it
i have a script that i have modified to meet my requirements however i
I have modified this jQuery pluggin to make a table that updates with an
It seems to have modified the original string that I wanted to split specifying
I have modified this example from the SDK pages to grab all the Contact

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.