vi is a screen-oriented text editor originally created for the Unix operating system.
3
votes
3answers
56 views
vi: backspace in insert mode not erasing characters
I am new to vi, actually I have started learning vi from today and I have got stuck at the behavior of the backspace key. Actually when I fired up vi on my Ubuntu 12.04 for the first time my backspace ...
3
votes
3answers
98 views
vi / vim - how to automatically strip trailing spaces on save?
Is there a .vimrc setting to automatically remove trailing whitespace when saving a file?
Ideally (to be safe) I would like to only have this functionality for certain files, e.g. *.rb
0
votes
1answer
53 views
vi / vim - extra indents when pasting text? [duplicate]
I can copy characters in other apps such as browsers with ctrlc.
I can then press i to enter insert mode in vim and press shiftctrlv to paste the text in.
The problem is that each line gets indented ...
4
votes
3answers
133 views
How do I quickly move the cursor to the end in bash in vi mode?
I don't know why but when I'm in insert mode and I move left from the last cursor position (the empty spot to the right of the last character), then I can't go back to that position anyomre.
Instead ...
3
votes
2answers
47 views
vim shortcut to open a file under cursor in an already opened window
In vim you can open a file under the cursor by using the gf command.
One can also easily open that file in a new split window by hitting <c-w> f. This is a really nice and time saving feature. ...
3
votes
1answer
46 views
Custom key bindings for vi shell mode, ie, “set -o vi”?
I just discovered the wonders of set -o vi, and am curious if it is possible to customize this vi shell mode in some of the same ways you can customized vi or vim?
For example, create a custom key ...
1
vote
2answers
91 views
How can I set “vi” as my default editor in UNIX?
I believe I can do something like export EDITOR=vi, but I'm not sure what exactly to enter, and where.
How can I set "vi" as my default editor?
1
vote
1answer
44 views
vi - search the string you cursor is over?
I looking more for a method that is "built-in" to vi, and not something that I could do in my .vimrc. Though, solutions for .vimrc are appreciated. :-)
When I want to search a string, sometimes that ...
1
vote
2answers
52 views
How do I set vim as the default editor when I sudo?
I'm working on a CentOS 5.9 machine, and I simply want to type
sudo vi somefile
and have my trusty vim with syntax highlighting, etc. This seems simple enough, but after many attempts, it's ...
2
votes
1answer
72 views
Vim - how to increase each number in visual block?
I have the following SQL:
update am.PERMISSIONS set PRM_ORDER = 35 PRM_VISIBLE = b'1' where PRM_ID = 3;
update am.PERMISSIONS set PRM_ORDER = [35] PRM_VISIBLE = b'1' where PRM_ID = 7;
update ...
1
vote
2answers
76 views
How do I set bash aliases and variables from within vim?
In cmdline mode, the following examples do not work for me.
!alias lol='echo lol'
!lol='echo lol'
1
vote
1answer
84 views
vi backspace problem
I have to work on a really old AIX workstation with vi version 3.10 in it.
I have done a little work in vim, but that was much more easy to use than the old vi (atleast untill I get used to the old ...
0
votes
0answers
42 views
set hlsearch not working in vi
I want the result to be highlighted when I search for it in a file.So,I opened a file with vi(version 7.2) and then used command :set hlsearch to enable highlighting.But even then I don't get my ...
5
votes
6answers
170 views
How to select complete file in vi, to be pasted in gedit?
I know that doing %y a will yank complete file into register a. However this doesn't help in pasting the file content in another text editor (say gedit). What alternative is there for doing so?
2
votes
3answers
69 views
Ctrl+W in vi[m] to erase to whitespace
I want to mimic the functionality of bash readline in vim. Is there an easy way to do that?
Currently in vim Ctrl+W "cuts" from cursor back to special char or whitespace.
ie. In bash Ctrl+W "cuts" ...
0
votes
1answer
177 views
Unable to write to file on FreeBSD — read-only filesystem
I bought a load balancer that runs the application on of FreeBSD. I found the configuration file that has all the settings and login information for both the admin and read-only users. I logged in as ...
2
votes
1answer
20 views
messages appearing when not desired
I have SSH access to a CentOS box and I have a strange behavior of that box, I have never seen before.
Lets say I am editing a file with vi or displaying tail -f of a file. Every time the server has ...
2
votes
4answers
113 views
What are some of the main differences between vim and vi?
What are a few of the main differences between vi and vim? Are there any significant keyboard shortcut differences, any features that one has that the other does not? Yes, I do know that I asked ...
7
votes
1answer
139 views
Vim: Making XML text “pretty”
Is there an easy way within vi to make your XML text "pretty"?
For example:
I want this..
<person>
<name>Nick</name>
<age>26</age>
...
0
votes
1answer
136 views
Write out without quitting in Vim?
I looked through the vim manual, and I could only find the commands for "write and quit" and "write (if edited) and quit". Is there a command for "write out without quitting", similar to ^o in nano?
3
votes
2answers
99 views
While in vi how can I pull in / insert / paste the contents of another file
I am editing file 'A' in vi.
I have another file 'B' whose contents I want to 'paste' into my current location.
Other than actual mouse copy and pasting, is there a command that I can use that will ...
2
votes
1answer
203 views
How to enter non-ascii characters using hex or octal codes in vi
I'm trying to write a golfing library for postscript. But it needs to be condensed itself. So I need a convenient way to type-in arbitrary bytes within mostly ascii text.
I know this can easily be ...
16
votes
6answers
1k views
Vi vs vim, or, is there any reason why I would ever want to use vi?
I know a bit about *NIX text editors (currently migrating from nano to vim), and, after looking around a bit on the Unix & Linux SE, have noticed that a fair about of question use vi instead of ...
2
votes
4answers
112 views
Disable vi from going to the last visited line upon file opening
Is there something I can put in my exrc file to prevent vi from going to the last line I was on last time I had the file open and just set the cursor at the top by default?
I think it is ...
3
votes
2answers
507 views
How to unset set -o vi?
I wanted to try vi mode in bash but now I would like to change it back to normal.
How can I unset -o vi ?
6
votes
1answer
434 views
Why is vi apparently broken (viminfo error E576), and how can I fix it?
I am proficient at using Unix/Linux, but I am not an expert. If I want to open a file (for example, file.txt), I use vi:
vi file.txt
This opens the file, and if I want to close it, I use :q!. I ...
3
votes
2answers
229 views
Globally replace Vi with Vim on Fedora
On Debian-based systems the alternatives system handles both the vi and vim executable. So if vim is installed and you execute vi, you also get vim, which I find very nice, because I absolutely hate ...
2
votes
1answer
50 views
remotely query text file associated with an instance of vi
I have opened several text files (a.txt, b.txt, c.txt, ...) in different sessions of vi launched from different instances of a bash shell. Having then accessed that machine remotely, I wish to ...
2
votes
2answers
81 views
Bash Vi-mode: Move back to last slash
I'm using Bash in vi mode with set -o vi.
Often I re-run a command but need to change the name of a file in the same directory.
Example:
mv /tmp/myfileA.txt /home/daniel/myfileA.txt
Then, I ...
5
votes
2answers
288 views
Does using ctrl+c instead of esc to exit insert mode break anything in vi?
When using vi, you can exit insert mode with Ctrl + C instead of the more traditional Esc. Are there any situations where it would be undesirable to use for former instead of the latter? Does it break ...
5
votes
0answers
52 views
Change PS1 without hitting enter [duplicate]
Possible Duplicate:
Change cursor shape (or color) to indicate vi mode in bash
I am using vi-mode in a bash shell, and I would like to change the PS1 variable whenever I am in insert mode. ...
1
vote
2answers
209 views
vi <TAB> completes only directories in bash
In a directory I type vi and then tab (twice), this gives me
user$ vi
CMakeFiles/ global/ libs/
whereas ls followed by 2 tabs gives me
user$ ls
! core.log CMakeFiles/ global/ libs/ ...
3
votes
3answers
126 views
Sed processed file displays differently in vi vs cat
I can't tell if sed is mucking my file up. In vi or less it displays properly, but cat and more insert other characters. why are they showing up differently
I am on a redhat linux system with a ...
3
votes
2answers
75 views
Shortcut for tabn & tabp in vim/vi
When I open several files using vim+tabf, switching across the files will involve using tabp & tabn.
Can I have a quicker way to do so?
1
vote
2answers
135 views
concat file content horizontally in vi/vim
I have a text file that contains a big matrix, that columns are split like the following example:
col1 col2 col3
row1 .. .. ..
row2 .. .. ..
row3 .. .. ..
row4 .. .. ..
row5 ...
4
votes
2answers
125 views
vim customized with emacs commands (insert mode only)
I was an emacs user, and I have to switch to vim. But I miss some basic emacs commands in vim insert mode:
C-A
C-E
C-K
C-Y
C-x C-s
... and some other
I know that I can press Escape and then press ...
0
votes
2answers
360 views
git commit error - cannot run vim: No such file or directory
$ git commit
error: cannot run vim: No such file or directory
error: There was a problem with the editor 'vim'.
Please supply the message using either -m or -F option.
How can I overcome the error ...
6
votes
1answer
193 views
How can I switch 2 characters in vi?
I like the fact that I've memorized ddp for switching two lines (i.e. dd deletes the line and then p puts it back '1 higher').
Is there are similar set of keystrokes for switching 2 characters so ...
2
votes
1answer
61 views
Finding parentheses with % in vim across lines
In the following text block, starting at 1 or 3, and pressing % in normal mode in vim, finds the pair of matching parentheses, and toggles between them if you press % again. Starting at 1 finds the ...
17
votes
9answers
985 views
Bash commands inside vi
Is it possible to type a bash command inside vi and get the stdout?
I find it often tedious to close and reopen vi just because I want to look something up in the shell.
2
votes
5answers
632 views
Comment all lines in a text file?
In a text file I need to comment out all lines by adding a ";" as first character of each line. What is a good way to do this? I thought of Vim's visual block mode, but I couldn't find a "select all" ...
4
votes
1answer
392 views
How to edit a .gpg file with vi?
So I created a gpg encrypted file with password:
gpg -c passwords.txt.gpg
how can I open it with vi, edit it, then close it? (So that no passwords.txt file will be created, the decrypted ...
2
votes
1answer
305 views
Defining key sequences in Evil-mode Emacs
I couldn't find any instructions on defining key sequences in the Evil doc.
The example given by the developers only covers a single key.
(define-key evil-normal-state "w" 'foo)
What do I need to ...
4
votes
4answers
325 views
xargs and vi - “Input is not from a terminal”
I have about 10 php.ini files on my system, located all over the place, and I wanted to quickly browse through them. I tried this command:
locate php.ini | xargs vi
But vi warns me Input is not ...
0
votes
1answer
59 views
How do I get bcvi installed and working (with Cygwin and Perl 5.8.8)?
I'm trying to install bcvi (under Cygwin), and there are apparently no directions that apply to this setup. The directions at http://sshmenu.sourceforge.net/articles/bcvi/#installation state that ...
3
votes
3answers
273 views
vi/vim, how can I write out a number of lines to a new file
I have a bunch of lines that I want to write out to a different file.
How can I do that?
6
votes
4answers
116 views
Replace a line with the line that I have in the buffer in vi
I cc or dd to copy a line into my paste buffer. Then I go to a new location.
I want to replace a line that I see. So I type p Down dd.
Is there an easier way (fewer keystrokes)?
15
votes
6answers
1k views
Using VI to edit shell commands in UNIX
I used to have a co-worker who was really good at UNIX.
He showed me how to use Vi to edit my shell commands.
He placed the command in a file that ran every time I logged in.
Since then, I've ...
4
votes
1answer
104 views
vim: how do I set :match and :2match search results to different colors?
For example, I want something along the lines of:
:match search /<div/ guib=Green
:match search /<\/div>/ guibf=Blue
only that doesn't work.
1
vote
4answers
292 views
Is learning a text editor like vi necessary and still worth the time today? [closed]
I started a new internship where all the servers run on AIX. Logging in for the first time I was suprised to see that my favorite text editor nano was not installed.
Everyone here uses vi not ...


