vi is a screen-oriented text editor originally created for the Unix operating system.

learn more… | top users | synonyms

2
votes
3answers
95 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
919 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
30 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 ...
3
votes
4answers
161 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 ...
8
votes
1answer
572 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
168 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
141 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
1k 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 ...
18
votes
6answers
5k 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
164 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 ...
6
votes
2answers
2k 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 ?
9
votes
2answers
2k 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 ...
4
votes
2answers
902 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
58 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
97 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
505 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
54 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
456 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
252 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
91 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
193 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 ...
5
votes
2answers
274 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 ...
1
vote
2answers
870 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
326 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
67 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 ...
19
votes
9answers
1k 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
1k 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" ...
5
votes
1answer
677 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
507 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
813 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
99 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 ...
4
votes
3answers
1k 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
121 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)?
18
votes
6answers
2k views

Using VI keys 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 key bindings to edit my shell commands. He placed the command in a file that ran every time I logged in. Since ...
6
votes
1answer
223 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
382 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 ...
2
votes
1answer
190 views

Beep when typing backslash in cvim normal mode

I installed the cvim plugin for vim. Almost all the cvim commands start with '\'. But I when enter this character in normal mode, all I hear is a beep. Nothing happens. What might be causing this ...
3
votes
3answers
83 views

console space eaten up by file contents

see the example below to understand my problem ; consider my console prompt look like this user@server $ ls "I opened a file temp" user@server $ vi temp "temp will open in the same window, when I ...
8
votes
2answers
1k views

why inode value changes when we edit in “vi” editor?

When I edit a file in "vi" editor the inode value of the file is changing. But when edited with cat command the inode value is not changing.
2
votes
1answer
2k views

Replace using VIM, reuse part of the search pattern

I am working with VIm and trying to set up a search and replace command to do some replacements where I can re-use the regular expression that is part of my search string. A simple example would be a ...
1
vote
2answers
894 views

Color of the fonts in my remote terminal screen when using VI in linux

I notice one of my linux remote login window shows color in VI editor interface but another window doesn't show color. These 2 windows are remotely connected to 2 different server IP addresses. May ...
9
votes
3answers
1k views

How different is Elvis from Vim?

I've been using Slackware for a while now, which ships with Elvis as its default editor. Most other Linux distributions seem to ship with Vim, instead of Elvis. Having gotten quite used to Elvis, ...
2
votes
2answers
906 views

How to delete the line after a search pattern, globally with vi?

Assume I have a big file, ~1k lines, and I need to delete the line after some pattern, lets call it: somePatern. Conditions: cannot be done by hand (no searching -- /somePattern, and/or manually ...
0
votes
2answers
395 views

Vi for Cygwin syntax

How can I make vi in Cygwin highlight the syntax when I open a file by default? I know that I can type in the command "syntax on" but I would prefer to not do this all the time.
14
votes
3answers
4k views

What is the difference between vi and vim?

As far as I know vi is more commonly found on out-of-the-box unix systems while vim often has to be installed. Also vim stands for vi improved, but improved how? What are the main differences?
17
votes
6answers
3k views

Advantages of using set -o vi

I have seen many developers using this command to set the option to vi. I never understood the real use of this? When using bash commands, what help does switching to vi provide?
7
votes
1answer
1k views

How to enable ctrl-R in zsh

I recently switched to zsh (finally) and am loving it! So far one thing that I am missing is ctrl-R to do incremental history search. I have the history set up properly HISTSIZE=10000 ...
5
votes
3answers
360 views

Search and replace next n words in vi [duplicate]

Possible Duplicate: Vim :s replace first N < g occurrences on a line In vi, how do I search and replace a word's first n occurrences with a word, say "hello", and the next m occurrences ...
21
votes
1answer
2k views

How to get root inside of vi? [duplicate]

Possible Duplicate: Becoming root from inside Vim It could happen to anyone. The admin types: vi /etc/resolv.conf as a regulare user. He edits the /etc/resolv.conf file, but when he ...
2
votes
1answer
146 views

Expanding text format in VI

The following code is taken from the superfish module for websites: (function($){$.fn.hoverIntent=function(f,g){var ...