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

learn more… | top users | synonyms

0
votes
1answer
35 views

How to send the Escape Key inside VirtualBox “vi” session?

When using a "vi" session within VirtualBox, how can I send the Escape Key to change modes from input mode to command mode? I have tried many combinations which do not work: Ctrl-Esc, Atl-Esc, ...
1
vote
1answer
39 views

Write before the cursor

In Vim, I have a #write after cursor A #write after end line I #write at start of line I want to write before a word, for example I want to edit this line My cursor is at the position after ...
2
votes
2answers
170 views

Search and replace control characters (^@, ^M, ^I…) in vi

I copied this line from /proc/some_proc_id/cmdline in my ubuntu machine, java^@-jar^@/usr/lib/selenium/selenium-server-standalone.jar^@-port^@4444^@-trustAllSSLCertificates^@ Somehow, the space ...
2
votes
2answers
244 views

Pressing $ then Enter adds a newline before the last character, not after

I'm trying to add another line at the end of the last line in the VI editor and I need to go to the very last of the last line (command $) to insert a new line by hitting enter key. But, the cursor ...
4
votes
4answers
8k views

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 ...
2
votes
1answer
46 views

Copy current line to clipboard under cursor without mouse selection

How can i copy the current line under cursor in vi to the system clipboard? I may paste the contents anywhere, in vi itself, or in shell, or in libreoffice app... And i am looking for simpler ...
3
votes
1answer
109 views

How to enable 'daw' vi command in zsh?

I've seen that the vi mode option in zsh is rather limited. For example, 'daw' (delete around word) and 'diw' don't work. What is the reason and how can I solve it?
1
vote
2answers
50 views

How can I delete <93> <94> symbols in file? It is equivalent “ ”

I copied text from a PDF file in bash - vi and I get lines like this: echo <93>The Hypotenuse is $hypotenuse<94> I tried to change that in vi by: s/<93>/"/g But: E486: ...
0
votes
2answers
44 views

How (and whether) to copy and paste on an ssh web interface?

A web page provides web-based ssh access to a linux machine. I'm using it one a Windows7 machine. While editing a file in vi, I want to repeadetly enter the following: j0nhd0 This (1) goes to the ...
6
votes
1answer
266 views

Why is the vi editor's copy command called Yank?

Why is the vi editor's copy command called “yank”? Is there any thing significant that can help me to remember the command name?
37
votes
5answers
28k views

vim - better colors so comments aren't dark blue?

Mostly I edit ruby files, although shell script file comments are also # Currently my comments show as dark blue on black which is really hard to read. See screenshot. How can I change their color? ...
0
votes
2answers
52 views

Search and replace with a regular expression in vi?

I would like to replace a string with regular expression that appears in multiple lines with the character "x": The problem is to replace words with the x in front that has an integer after the x, ...
0
votes
0answers
30 views

Vi help problem with / in command mode

Hope someone can guide me in the right direction. I have an issue with the vi text editor, when in command mode after I enter ":" and want to use "/", the forward slash does not come up. What I get is ...
20
votes
3answers
16k 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?
30
votes
7answers
31k 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 ...
18
votes
6answers
15k views

How to pipe the result of a grep search into a new vi file

I'm using grep -e Peugeot -e PeuGeot carlist.txt to search through carlist.txt and pull out some items and I presumed that grep -e Peugeot -e PeuGeot carlist.txt | vi would pipe it through for me but ...
3
votes
1answer
118 views

What is the difference between .exrc and .vimrc?

I know from experience that the ~/.exrc file can be used to configure vim. I also know that the ~/.vimrc file can be used for the same purpose. However, If I use .exrc to configure vim, this leads ...
3
votes
4answers
274 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 ...
0
votes
2answers
1k views

How to change search result highlight in vi?

The scenario: I log on a server using ssh, and search for keywords in a log file using vi. The problem: at the moment, the results of a search is only highlighted by a cursor _ below the searched ...
0
votes
2answers
104 views

Why is emacs not preinstalled? [closed]

I want to learn Emacs or Vi. I don't like modal editing but Vi is ubiquitous and looks more useful for emergencies. What are the reasons why Emacs is not preinstalled in most distributions?
2
votes
2answers
4k 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 ...
13
votes
6answers
26k views

Delete 100 lines from vi editor using single command

I am using Ubuntu and trying to delete all 100 lines from vi editor but I got interview question of doing this in one command.
0
votes
0answers
93 views

Is there a way to recover my vi-edited file?

2 days ago, I remotely logged into my school's Unix system and wrote a lengthy file with vi. I saved with :wq and reopened it multiple times to check if it saved (it did). Today, I log back in and ...
1
vote
1answer
77 views

Unable to install vim plugins

I am unable to install any vim plugins on nixOS running the command: nix-env -i vimplugin-Syntastic gives these as the last 3 lines of output: output path ...
0
votes
1answer
26 views

Open a result of `locate` with `vi`

I'd like to get the nth (3rd) result of locate, and then open it to vi. $ locate /private/etc/my.cnf /private/etc/my.cnf.bak_ /usr/local/mysql-5.6.22-osx10.8-x86_64/my.cnf ....
1
vote
1answer
49 views

How can I have my .vimrc detect what OS I'm using?

Since I upgraded my Ubuntu to version 14 I've had a lot of problems with sharing my .vimrc file between Ubuntu and OSX. The following commands no longer work and in fact gives errors: set filetype ...
14
votes
3answers
2k 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
1answer
43 views

Yank all function declarations

Something I often have to do is make sure I have prototypes for all my functions in my C code at the top of file. What would be a way to quickly select all the function declarations in a .c file using ...
5
votes
5answers
2k 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 ...
2
votes
2answers
112 views

Bash Scripting VIM commands

I have a few files that I have an annoyingly repetitive group of VIM commands to apply to. They are basic VIM commands just to delete some lines which are not supported by the process I need the files ...
1
vote
2answers
105 views

How can I invoke vi instead of vim [duplicate]

I want to use vi for better pasting. When I use vi I get vim When I type /usr/bin/vi I still get vim This is on my Max OSX 10.10 Yosemite
2
votes
1answer
61 views

Strange closure of vi editor

Upon closing vi editor, (without letting it load the whole file), -bash-3.2$ vi /var/spool/mail/user1 -bash-3.2$ 0;136;0c left 0;136;0c to prompt, what could have made this happen, not letting the ...
0
votes
3answers
132 views

Is it possible to remove vi?

I want to remove the vi text editor from Linux but it does not show up as a package in aptitude. Is it possible to remove this? I have already removed vim by running sudo apt-get remove vim I am ...
39
votes
8answers
29k views

How can I delete all lines in a file using vi?

How can I delete all lines in a file using vi? At moment I do that using something like this to remove all lines in a file: echo > test.txt How can I delete all lines using vi? Note: Using dd ...
4
votes
1answer
411 views

On startup, highlight tags and display tags in a preview window

I am using vi as a note-taking and outlining tool. I am constructing the "tags" file by myself. What I would like to do is that when I open my notes or outline file, vi reads the tags present in this ...
1
vote
1answer
214 views

Where is the rc file for vi editor.

I would like to set up system-wide vi settings. I know i can setup preferences for vim editor in /etc/vimrc and ~/.vimrc but i don't think my vi on CentOS7 is reading anything from the vimrc files ...
13
votes
2answers
2k views

What happens if I use vi on large files?

Though we were instructed not to, a colleague of mine used vi to view a large text file (server.log 3.5 GB). This filled up /var/tmp and caused some problems on the server. What caused this? Why ...
2
votes
1answer
38 views

Reverse global and local marks in vi/vim

How can I reverse the capitalization convention of marks in vi/vim? Normally a lower-case mark like "a" means it is local to the current file, but upper case marks like "A" are global to the session. ...
0
votes
2answers
93 views

What is the difference between “find” and “till” in vim?

I see I can use t c or Tc to move to the next / previous character c I can also use fc or Fc to move to the next / previous character c Is the only difference between them that tc places the ...
2
votes
2answers
100 views

Vim, how to delete from CURRENT cursor position, until end of line and next N lines?

This is strangely difficult to figure out. I do not want to delete what is to the left of the cursor, only from the cursor to the end of the line, and the following 3 lines in ONE command. I know I ...
3
votes
2answers
235 views

how to recall last argument in bash with vi setting

I use set -o vi setting in bash. The shorcut Alt+. (recalling last argument of previous command) here doesn't work as in emacs mode, so what is the equivalent for vi?
1
vote
2answers
165 views

Ctrl-z doesn't work in vi launched from Gnome terminal

I'm trying to switch Vi launched from Fedora Gnome terminal to background and go back to bash with Ctrl-Z but it doesn't seem to do anything.
14
votes
1answer
4k views

How to enable reverse search 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 SAVEHIST=10000 ...
1
vote
0answers
55 views

Delete lines from a file which opened in less mode

I have a file (huge size) which cannot be opened in vi but in less mode and I want to delete the lines which I do not required. But I am unable to delete lines from file open in less mode. Please ...
5
votes
2answers
1k 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
134 views

Is replacing a particular line in a file through a bash script possible in VIM or EX?

I would like to modify a particular line, say line 5, in a file by using the EOEX construct how can I achieve my aim? The code snippet that I use to achieve my purpose is as follows: #!/bin/bash ...
1
vote
3answers
2k 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 ...
0
votes
2answers
79 views

How to insert specific lines into a file using vim?

I am using vim for both programming and competitive coding. Now, since I want to insert specific macros whenever I open a source file when I am doing competitive coding. I just copy paste the entire ...
2
votes
1answer
61 views

Character class bug in nvi: [[:digit:]] is interpreted like [[:alnum:]]

A simple search in nvi on text such as: the quick red fox jumped 1 foot over the lazy 28 pound dog using the following search /[[:digit:]] behaves like /[[:alnum:]] That is, it finds every ...
1
vote
2answers
42 views

visual mode in vi to remove char at the end of multiple lines

builder.append("sss"); builder.append("aaaaaaaaa"); I would like to remove the ; at the end. I can do it using various scripts in sed or replace all in vim. But, I would like to know how to use ...