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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:21:23+00:00 2026-05-11T18:21:23+00:00

I found an awesome tip here. You can [r]apidly invoke an editor to write

  • 0

I found an awesome tip here. You can “[r]apidly invoke an editor to write a long, complex, or tricky command”. However, when I press the key combination above, I get Emacs open. I would like to switch it to Vim. How can I invoke Vim with C-X e?

[1. Problem SOLVED by Brian Cambell]

export EDITOR=vim

Add to your .bashrc or appropriate shell rc file

[2. Problem SOLVED thanks to Pax]

I was unable to get the tricky command back to Bash. The errors were:

 > Error detected while processing BufRead Auto commands for "*":
 > E117: Unknown function: JumpToLastPosition

Quotes in .vimrc solved the second problem. I am still unsure about the part in my .vimrc:

  "  augroup misc
  "      autocmd!
  "      autocmd BufReadPost * call JumpToLastPosition()
  "      autocmd FileChangedShell * call WarningMsg("File changed outside of vim")
  "  augroup end

[3. Problem]

What do the above part in .vimrc do?

  • 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-11T18:21:23+00:00Added an answer on May 11, 2026 at 6:21 pm

    On most Linux installs (all the ones I tested), bash recognizes both the Emacs and Vi command history keys (or you can use "set -o vi" to force it).

    So, you can just use the vi-mode "<ESC>v" to to enter visual mode, this will start editing in a Vim session.

    To run the command, you just save and exit from Vim ("ZZ" or ":wq"). To cancel the command, you need to delete the contents, save and exit ("1GdGZZ").

    In addition to running it by exiting, you can also save it while in the editor to another location (":w /tmp/myscript").

    Keep in mind that visual mode will work with the currently selected line so you don’t have to start with a blank command ("<ESC>v"). You can use the normal vi-mode tools to select a line from the history first and then enter visual mode ("<ESC>kv" for last command, "<ESC>/grep<ENTER>nnv" for third-last grep command and so on).

    Using this method has the advantage of not changing the "EDITOR" variable which may be used for other things (unless you want Vim for everything, which is a very sensible position to take IMNSHO).

    Update:

    Regarding your error, posted after the question:

    JumpToLastPosition() is the function called by Vim for all files to put the cursor where it was when you last edited the file. I’m going to assume you’re actually getting this error when the editing starts, not when you exit, since this is the auto function following a buffer read.

    Can you start a “normal” vim session ("vim xx.txt" and then "vim xx") without this error occurring? You may find you get the same problem (and possibly only on the last one).

    If you do have the same problem, you need to look at your startup files. It’s possible the autocmd for BufRead is broken somehow. Have a look inside your vimrc and you filetype.vim files to see where that function is called and/or defined (I suspect it’s called but not defined and that may be a mismatch between the two files or one of them has been damaged).

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

Sidebar

Ask A Question

Stats

  • Questions 105k
  • Answers 105k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer At its most basic, you just register a keydown event… May 11, 2026 at 8:44 pm
  • Editorial Team
    Editorial Team added an answer The creation of new aggregate functions is backend-dependant, and must… May 11, 2026 at 8:44 pm
  • Editorial Team
    Editorial Team added an answer You could try setting your own cursor, but I suspect… May 11, 2026 at 8:44 pm

Related Questions

The Setting: The program in question tries to post form data via an AJAX
Yea i know i'm way behind times but what i've got here is a
So I want to trigger an event (pausing/unpausing some media) whenever the user presses
I was wondering if something exists (in Java world) able to take an snapshot
I'm working with a team that's building an engine for a variety of 2D

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.