4

Today's Daily Vim says this:

Assuming you're using the bash shell, the following can be helpful when composing long command lines.

Start typing on the command line and then type Ctrl-x Ctrl-e, it should drop you into your system's default editor (hopefully Vim) and allow you to edit the command line from there. Once finished, save the command line, and bash will run the command.

Is there any way to do this in tcsh?

Community
  • 1
  • 1
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319

2 Answers2

3

A little explanation for the uninitiated.

bindkey -v

puts you in vi-mode (oh yeah!)

and hitting v from there would take you to $EDITOR -- and all is good with the world from there on.

Jeffrey Jose
  • 1,992
  • 2
  • 16
  • 21
1

Hmmm... IIRC, tcsh uses a command called bindkey. Try bindkey -v at the command line. Then hit escape followed by v. It's been a while since I used tcsh so the details are a bit fuzzy. When in doubt, Google it.

D.Shawley
  • 58,213
  • 10
  • 98
  • 113
  • that's not a very useful answer. I know that I can use various bindings to edit the commandline. The question is if I can somehow copy the commandline to $EDITOR, edit it and then copy it back, all automatically like Bash apparently does. – Nathan Fellman Jun 02 '09 at 13:05
  • 1
    @Nathan - a good start is to man tcsh and take a look at the section about bindkey. In particular, look at `run-fg-editor` I believe that this is what you are after. It's been about 15 years since I used tcsh so my memory is a little fuzzy. – D.Shawley Jun 02 '09 at 13:59
  • I'm unclear why this was chosen as an answer to this question, since it doesn't actually answer the question. And the comment on "run-fg-editor" is not an answer either, that is a keybinding to let you switch to the last editor that was put in the background. – David Ljung Madison Stellar Feb 15 '22 at 18:52