When typing a complicated command that started on the command line in Bash, how do I switch to editing it with ViM?
120458
I have recently discovered that if we press Ctrl+X Ctrl+E, bash opens the current command in an editor (set in $VISUAL or $EDITOR) and executes it when the editor is closed. But it doesen't seem to be documented in the man pages.
3215
It should be trivial, and it might even be in the help, but I can't figure out how to navigate it. How do I indent multiple lines quickly in vi?
84776
I was just curious if there's a way to get input not from StdIn but from $EDITOR - be it vim, nano, emacs or even a non-command-line-editor (MacVim/TextMate). What are the options/workarounds/bestpractices?  Basically I'd wish for a workflow as with heredoc - but from the $editor instead.   $ sort -nr &lt;&lt; FOO | uniq -c  pipe heredoc&gt; foo  pipe heredoc&gt; bar pipe heredoc&gt; baz pipe heredoc&gt; foo pipe heredoc&gt; FOO    2 foo    1 baz    1 bar
44516
They seem to both signal BASH to commence with another command following the symbols but is there a distinct difference?
35185
So, I've looked at history and at Ctrl+R, but they are not what I thought I knew. Is there a way that I can type in the beginning of a command, and cycle through the matches in my history with some bash shortcut?  # mysq(some shortcut key)   Gives me:  # mysqldump  --add-drop-table -e -q -n -C -u  (some shortcut key) #  mysql -u ben.dauphinee -p
81768
Consider the simple script hello:  #!/bin/bash  echo 'hello world!'   Now from bash if I try to run this in the background:  $ hello &amp; [1] 12345 $ hello world! █ &lt;--- prompt is stuck here until I hit enter! [1]+ Done $ █ &lt;--- prompt back to normal   What I would rather see:  $ hello &amp; [1] 12345 [1]+ hello world! [1]+ Done $ █ &lt;--- prompt normal the whole time   How can I change the behavior?
43076
I use autocomplete a lot in the terminal, like for example for cp command. But sometimes, when I am putting in the directory for the cp command and I press Tab, the list of files is so long that Ubuntu spits out part of the list and then waits for key input before sequentially listing the rest of the files, one by one. This feature is near useless because you never know how many files are left, and almost always end up with an error.   Is there some way to leave this list and go back to my cp command, or do I have to press Ctrl+C and start typing in my cp command again?
25720
i need to learn to do it just using the commands in the terminal. any help would really help thanks
112657
I know I can solve this problem several ways, but I'm wondering if there is a way to do it using only bash built-ins, and if not, what is the most efficient way to do it.  I have a file with contents like  AAA B C DDD FOO BAR   by which I only mean it has several lines and each line may or may not have spaces.  I want to run a command like  cmd AAA "B C DDD" "FOO BAR"   If I use cmd $(&lt; file) I get  cmd AAA B C DDD FOO BAR   and if I use cmd "$(&lt; file)" I get  cmd "AAA B C DDD FOO BAR"   How do I get each line treated a exactly one parameter?
33020
What is the easiest way to add a text to the beginning of another text file in Command Line (Windows)?
91102
I'd like to be able to paste from the system clipboard (or text selection) into my "vi-like" shell prompt using the keyboard. I normally use zsh and sometimes bash. In both cases, I have the shell set up with vi-like behaviour (bindkey -v / set -o vi).   In vim, the behaviour I'm looking for is available with the key sequence "+p. This particular key sequence doesn't work as expected in a vi-enabled shell prompt, though. Is there any way to either enable this or a similar behaviour, using keyboard only, while remaining with vi-like keybindings in a zsh or bash shell prompt?  -- edit --  Usage case: I often navigate between Firefox with the , a terminal emulator and vim itself - using the  window manager with custom keys to move around. All three programs have vi-like keybindings, which is very efficient (for "finger memory") so it would be ideal communicate text between them using vim syntax (or a very similar syntax) only.
43075
Could someone explain to me in simple terms the easiest way to change the indentation behavior of Vim based on the file type? For instance, if I open a Python file it should indent with 2 spaces, but if I open a Powershell script it should use 4 spaces.
83327
Otherwise, is there any alternative command line utility that can achieve this?
123974
The autocorrection function of zsh is very helpful for me but it does't always gives a proper result.  ~$ sudo vim somefile zsh: correct 'vim' to '.vim' [nyae]?    Yet what I want is something like the a never option that can stop it to correct commands like those forever.  How can I do this?
19829
I generally run Linux. I use Vim a lot, so the Escape key is extremely important. I also use other keyboard shortcuts a lot, so Control is "key" as well. On Linux, I've solved this by using  to map the Caps lock key to Escape if pressed by itself, or Control if pressed in combination with another key. This puts the best of both worlds within quick reach of my pinky finger. Is there any way I can do this on a Mac?
46250
Is there a way I can do what stated in the title from the terminal commands, or will I have to look into the codes?
121608
In vi[m] there is the  through a shell command -- like sort or indent -- and get the filtered text back into the buffer. Is there an equivalent in emacs?