vi is a text editor of the Unix operating system.
Questions tagged [vi]
249 questions
247
votes
12 answers
How do I select all text in Vi/Vim?
Using VI tool for editing config files.
How can I select all the text in a file (around 1000 lines), copy it, then paste into Google Docs?
Daniel t.
56
votes
7 answers
How to get rid of the warnings when opening a file that has a .swp file?
How can I get rid of the annoying warnings when I open a file that has a .swp file? Or, how do I not generate the .swp files at all? Example warning:
E325: ATTENTION
Found a swap file by the name ".notes.swp"
owned by: james dated: Fri…
James
- 5,159
42
votes
4 answers
How to use vimium to select text from a page
Background
I'm a religious fanatical devoted believer of vimium. It speeds up my internet usage like nothing else. I'm also (naturally) a heavy user of vim itself.
Question
How can I actually select a certain text in a screen using vimium without…
abbood
- 1,354
41
votes
5 answers
Inserting a blank line in vim?
I quite often find I have a need to insert a blank line either below or above the current line when editing in vim. o and O will do this, but they subsequently switch into insert mode, which is annoying. Is there any built-in command to do this…
Andrew Ferrier
- 2,264
37
votes
2 answers
Why is VIM starting in replace mode?
On several new CentOS 7 machines, I find that VIM automatically starts in replace mode.
After removing all automatically installed .vimrc files, normal behavior returns. However, if I simply create a .vimrc (eg. touch ~/.vimrc), VIM will begin…
Michael
- 651
35
votes
9 answers
Vim to replace Vi
Guys, anyone know how to change linux console editor from vi into vim everytime we execute vi?
I'm using Ubuntu and Fedora Core
Funky81
- 563
33
votes
7 answers
Is there a command to split lines in Vim?
In Vim, the J key joins two lines together. Is there a similar, built-in, key combination to split lines with a newline (at the cursor position, or similar)?
Alternatively, what would be the most robust way to define a key combination to do that (in…
Andrew Ferrier
- 2,264
33
votes
3 answers
vi: how can I jump to end of file with a new line appended?
Here's an answer I want about 5 times a day.
In vi, the command to go to the end of the file is G.
But that always leaves me at the start of the last line of the file, if files don't have a blank line at the end.
How can I jump to the end of the…
Richard
- 1,015
33
votes
4 answers
Vim shows strange characters <91>,<92>
While using Vim over SSH I copied some content from a webpage to my SSH/Vim session and got the following result:
SIZE=`df -h|grep $DISC|awk <91>{print $2}<92>`
Apparently <91> and <92> stand for ' but how can I search and replace this stuff? And…
Jeremy S.
- 499
32
votes
5 answers
How can I edit all the files returned by find in vi in Linux?
Something I find myself doing a lot is running a find command and then editing all of them in vi, which looks something like this:
> find . "*.txt"
./file1.txt
./file2.txt
./path/to/file3.txt
> vi ./file1.txt ./file2.txt ./path/to/file3.txt
Is…
abeger
- 795
28
votes
6 answers
Always use :set paste, Is it a good idea?
In a terminal vim, pasting clipboard data often messes up the code indent.
I just knew if I uses :set paste the indent is not broken.
Though, after pasting data, should I do :set nopaste again? What if I don't, what problem comes?
Benjamin
- 2,399
25
votes
1 answer
How to switch comfortably to vi command mode on the zsh command line?
In vi, I have mapped 'jj' to escape to be able to switch to command mode without using the annoying escape key. Now I want to have the same for command line editing for which I use vi-mode. I already have found the following solution:
bindkey '^j'…
Eman Resu
- 285
23
votes
3 answers
Any IRC clients with VI key binds?
Is there any IRC client that supports VI keys? The ''obvious'' script VimIRC is and has been broken for so long it's not even funny.
Do you know any IRC clients on Linux, GUI or Curses, that provides some of that nice vi usability?
Or could some of…
mike3996
- 1,611
19
votes
3 answers
vi/vim alternative to sublimetext's "Expand selection to scope"
Sublime text has a cool feature called "Expand selection to scope" SHIFT+CMD+SPACE which selects the everything within the scope.
It select everything in scope, works perfectly ( ) or [ ] or { } repeating it expands the scope to its parent.
I'm…
palaniraja
- 351
17
votes
1 answer
Vim: edit multiple lines
I was looking for a way to edit multiple line simultaneously.
I found that Ctrl-V + selecting the lines + I should be the solution. The problem is that, for me, after pressing I (in fact Shift-i) I'm switching to the classic single line insertion…
gregseth
- 747