Questions tagged [ex-mode]

Vim's ex mode is similar to the command line mode which is designed for Batch processing.

Vim in Ex mode (also aliases as ex) is useful when:

  • You're in need of editing (multiple) files non-interactively (as part of the script).
  • Your connection is very slow or screen is not updated after your actions.
  • Mappings and abbreviations are disabled.
  • Common keys such as Escape or Control doesn't work.

There is Ex mode (vim -e) and improved Ex mode which allows for more advanced commands than the vi compatible Ex-mode (vim -E).

123 questions
194
votes
9 answers

Does Ex mode have any practical use?

Vim has an Ex mode that can be entered by entering Q, and a command line mode that can be entered with q:. A common complaint amongst new vim users is that they enter these modes accidentally when trying to quit vim. As such, I disable these keys in…
Andrew Ferrier
  • 6,729
  • 7
  • 28
  • 41
20
votes
2 answers

What does :open do in Vim?

Vim's documentation has this to say about the :open command: This command is in Vi, but Vim only simulates it: *:o* *:op* *:open* :[range]o[pen] Works like |:visual|: end…
Random832
  • 1,222
  • 9
  • 17
14
votes
1 answer

delete lines that match a pattern from a given line to the end of the file

If I have a file with a lot of comments in it and I want to delete all of the comments from say, line 3 to the end of the file, what's the best way to do it? I'm stuck, since what I first tried doesn't seem to do quite what I…
Eric Renouf
  • 633
  • 8
  • 14
14
votes
1 answer

What is the difference between Ex mode and improved Ex mode?

There are two vim Ex modes: the vi compatible Ex-mode (vim -e -s), vim improved Ex mode (vim -E -s). Vim improved Ex mode allows for more advanced commands than the vi compatible Ex-mode, however what are the main differences? Or where I can find…
kenorb
  • 18,433
  • 18
  • 72
  • 134
7
votes
3 answers

Reusing search pattern in ex mode

Sometimes I want to try a pattern with / before doing :%s/ …; can I reuse it without having to type it all over? (or use the mouse.)
Toothrot
  • 3,129
  • 13
  • 27
4
votes
2 answers

Can one jump in ex mode?

Say I entered :e bla/bla/bla.txt and I realize I want to put a ! after the e. Can I get there without using the arrow keys?
Toothrot
  • 3,129
  • 13
  • 27
4
votes
0 answers

Why does vim ex mode 'print' command insert a space on empty lines?

Take the following example: $ printf "a\n\nb\n" | vim -E -c "%p" -c 'q!' /dev/stdin | hexdump -C 00000000 61 0a 20 0a 62 0a |a. .b.| 00000006 I would not expect that space (0x20) to be present between the two line…
PiQuer
  • 151
  • 3
4
votes
1 answer

How to get particular time format inside the text file

I want to paste particular date format (mm--dd-yyyy) using following terminal command in ex command mode: :r !echo $(date +"%d-%m-%Y") Its print the current file name instead of printing date, After that I try another command: :r…
SuperKrish
  • 217
  • 1
  • 5
3
votes
1 answer

Why can I give the ex: line a monitor wedgie?

Does pulling the ex line up like below serve any purpose?
leeand00
  • 3,555
  • 5
  • 24
  • 40
3
votes
3 answers

How do I emulate Sed's y command?

For the very first time I find myself in need for the y command Sed has. For those who don't know what y does, here's an example: $ echo x1 x2 x3 | sed 'y/123/234/' x2 x3 x4 Apparently Vim has no way of doing this. Am I wrong?
Enlico
  • 2,194
  • 15
  • 31
3
votes
2 answers

vim ex mode write to stdout

I am trying to output the contents of a file opened in vim ex mode to stdout. vi -es +'%write !tee' +'q' ./testfile Unfortunately, it does not write anything, although if I open the file in ex mode, like this: vi -e ./testfile and issue the same…
z32a7ul
  • 133
  • 5
2
votes
2 answers

Why "normal n" does not work in Ex mode?

For example, if I want to find all bar lines and print them. $ cat file line foo line bar 1 line bar 2 $ cat cmd norm gg /bar p norm n p $ cat cmd | vim -u NONE -es file line bar 1 line bar 1 $ As it outputs, normal n does not move to line bar 2.
vim.ggyG
  • 201
  • 1
  • 8
1
vote
2 answers

How can I go back to the editing file after invoking shell in Ex mode?

I run into a problem while practicing the Ex mode by running sh command, following this tutorial. I cannot go back to the editing file[s]. I can see the .swp dot file by running ls -a. None listed by running jobs fg can neither call it back. …
Lerner Zhang
  • 740
  • 7
  • 19
1
vote
1 answer

Is it possible to do an "inline" insertion of text with ex

So I'm reading the ex spec and came across the following section under Command Line Parsing in ex: Otherwise: a. If the command was a map, unmap, abbreviate, or unabbreviate command, characters up to the first non--V-escaped ,…
TAAPSogeking
  • 111
  • 4
1
vote
1 answer

Find definition of ex command

Normally when I try to trace back a setting to where it was set in my vim config (or plugins) I use something like: :verbose set undodir undodir=~/.vimundo Last set from ~/.vimrc line 62 To discover this. How do I find this location for…
Keith Smiley
  • 143
  • 8
1
2