This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I join two lines in vi?
I have the following text:
the bunny
is very cute
How can I quickly delete the \n\t between bunny and is?
Type J (capital J) to join lines.
Related
This question already has answers here:
Remove all arbitary spaces before a line in Vim
(9 answers)
Closed 5 years ago.
I'm new to the vim editor.
How can I adjust all lines to the left? I have many lines which are indented and I want to arrange them so they all abut the left side of the file (no spacing at the start of the lines).
Select all line in visual mode and then type :left . Hope this helped.
keerthan
The simple key sequence :%left will do the trick, it basically applies the left command to all lines in the file.
This question already has an answer here:
Navigate through camel case
(1 answer)
Closed 5 years ago.
Actually, the title says it all.
How can I get my text cursor to navigate through the start and the end of each word in a specific line of text?
Just tap ALT+> or <. Arrow key: right or left.
This question already has answers here:
Is there a decent Vim regexp OR command? What is the best way to find mismatched if else's?
(3 answers)
Closed 8 years ago.
Question is:
To display only lines contains keyword1 or keyword2,how to do that?
I know there's command like :g/pattern but that can work only for one keyword.
It's not duplicate question as it is to search instead of search replace case
Use alternation:
:g/foo\|bar\|baz/#
This question already has answers here:
Sorting words (not lines) in VIM
(6 answers)
Closed 8 years ago.
I know that it's very easy to do sort operations in vim through build in command sort.
But how to sort just one line and text within that line horizontally?
e.g. from this point (aaa ccc bbb)
to this (aaa bbb ccc)
I tried vi(:sort but it doesn't helped me. Any suggestions?
:s/\s\+/\r/g " break the line into multiple ones
:'[,sort " sort them
:,']j " join them
This question already has answers here:
Delete n lines in the up direction in vim
(5 answers)
Closed 9 years ago.
Is there a way to apply a vim command backward? For example, I want to kill 5 lines backward, instead of 5dd, is there something like -5dd?
From :he d:
["x]d{motion} Delete text that {motion} moves over [into
register
x]. See below for exceptions.
How about 5dk 4dk (k being the motion for upwards)?
Edit: changed count to 4 as this results in 5 lines being deleted apparently...