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

  • Home
  • SEARCH
  • 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 8824741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:42:33+00:00 2026-06-14T06:42:33+00:00

Can anyone help me how to put an <esc> command in a vimscript in

  • 0

Can anyone help me how to put an <esc> command in a vimscript in order to switch from a insert visual mode (selection mode) to the visual mode?

This is my script:

  if a:type == "'<,'>" 
    normal! "\<esc>\<esc>"
    normal gvy
    let myvariable= @+
  endif

explication:
I have selected a piece of text. (I’m now in insert visual mode (=selection mode))
I have to select the same text in visual mode.
Without vimscript I just have to push 2 times the <esc> command and the command gv in normal mode to reselect the selection again and this time I’m in visual mode.

I tried to put the <esc> commands as in above script but it doesn’t work.

  • 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-14T06:42:34+00:00Added an answer on June 14, 2026 at 6:42 am

    You have completely wrong syntax for invocation of :normal.

    normal! "\<Esc>\<Esc>"
    

    will execute 14 characters in normal mode, none of them will be escape character: normal does not accept expressions. You have to use

    execute "normal! \e\e"
    

    (\<Esc> also works, but \e is faster to type). I see no reason in having two normal commands here so

    execute "normal! \e\egvy"
    

    . But I am still wondering what you do to invoke this script? Without this information the above is likely to prove being completely useless.

    PS: I completely agree with @romainl that using easy mode and, more, using mouse in easy mode is completely wrong way of using vim.

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

Sidebar

Related Questions

Can anyone help me to get hour, minutes, seconds from this code: <strong class=countdown>
Can anyone help - this is driving me mad. I am calling a mysql
I want to put a background image in mt QWidget, can anyone help me
Can anyone help me make sense of this error message? I wrote a drag
Can anyone help me to remove last word from the text area and it
Can anyone help me with this problem I have. Quite hard to summarise into
Pls can anyone help me. Any time i configure my youtube-g and i put
Can anyone help me with a MySQL query I'm trying to put together. I
Can anyone help explain this? I am using the Populator and Faker gems to
can anyone help me find out url from given paragraph using regex c# Note:

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.