Questions having to do with the range modifier in ex (command-line) commands.
Questions tagged [range]
59 questions
4
votes
3 answers
Define range as: "from first line matching to last line matching a given pattern"
Considerthis text with shopping and todo list
First thing in the morning
- call Bob
- buy carrots
- buy bread
- text Charlie
- buy butter
- email Alice
only then start the day
What I am looking for a is a vim command to be applied from the first…
Yossi Gil
- 755
- 5
- 19
2
votes
1 answer
specifying a range the last of which is the penultimate line
I have 69 files in which I want to prepend lines 5 to penultimate with a short string. How could I address the penultimate line? :5,61s/^/X/g would do it if I manually look up that the last line is 62, but if I want to script it for all the files,…
muk.li
- 449
- 3
- 8
1
vote
0 answers
How to list the hex range of an a fileencoding in vim?
Is there any way to take a fileencoding setting (for instance utf8 or cp1252) that you might set and find out what it's valid hex range is?
When a character falls outside the range, it is displayed with a hex code in the file, so vim knows what…
leeand00
- 3,555
- 5
- 24
- 40
1
vote
0 answers
specify a range for command but not move cursor
In vim, when executing a command with a range specified, the cursor will move to the end of the range. For example, after 10;+4print, cursor will be at line 14 wherever you run this command.
Q1: Is there a method to hold the cursor while executing…
doraemon
- 1,667
- 11
- 27
0
votes
2 answers
Vim: How to open a new tab containing range/selected text from current tab?
I'm in a file and want to copy and edit part of the file content in a new tab temporarily.
I know that I can write it in a file using :'<,'> w /tmp/list.txt, then :tabnew /tmp/list.txt.
But what if I don't want to write a file and open it…
pedyram
- 101
- 1