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

learn more… | top users | synonyms

1
vote
1answer
32 views

Vi mode or emacs mode in the whole system

I use vi mode in zsh, tmux and my favorite text editor (vim obviously). I'm interested to have this behavior in the whole system. I know I can use plugins in firefox, thunderbird, etc. but if there is ...
1
vote
1answer
18 views

Backward and foreward search are inversed with vi mode in zsh

When I enter in vi mode with set -o vi, I enter in command mode, and I touch the key ? it produce a / and the inverse. Is it normal ? How to change this behavior?
0
votes
1answer
19 views

Faster way to enter in command mode with vi mode in the shell

I want to use the vi mode in bash but I find the ESC key a little bit too far, as for vim. The ideal can be to keep a key pressed, like ALT or the caps lock, to stay in command mode and be in insert ...
0
votes
1answer
36 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
172 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 ...
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 ...
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?
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 ...
3
votes
1answer
119 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 ...
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?
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 ...
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
78 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 ...
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 ...
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 ...
2
votes
2answers
114 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 ...
1
vote
1answer
217 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 ...
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 ...
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.
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 ...
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 ...
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 ...
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 ...
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 ...
0
votes
1answer
161 views

Vi editor, search and replace complex string

I want to search and replace particular string in file. Example, the string: ***BNS S&P/TSX60 ROC,SERIES will become: ***BNS S&P/TSX60 ROC SERIES How can I do this?
9
votes
2answers
555 views

In VIM, replace path with slashes without using escape slashes

In vim I want to substitute a long path /a/b/f/g/d/g with another /s/g/w/d/g/r in a text file. Usually I use \/ but there are too many slashes here. Is there an easier way?
2
votes
1answer
264 views

In VIM how do you run a command silently in the background?

I'm using ubuntu and currently have the following line in my vimrc file: nnoremap < leader >dc :execute 'silent !drush cc all' | redraw! The command works but it doesnt hit me back to the ...
39
votes
8answers
30k 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
36 views

Initializing search in vi before starting

I use a small program I wrote that takes a regular expression pattern as parameter and searches 2000+ files. The files are in a directory hierarchy. The pattern can be in multiple files and multiple ...
0
votes
1answer
50 views

Does VI v4.0 on Solaris 2.5.0 have a command history

I normally use VIM but have to fiddle with files in VI. Does the vi on Solaris 2.5 have history I can recall to re-use commands? It's a pain to retype complete lines sometimes. In VIM I can go ESC, ...
1
vote
1answer
89 views

What is happening while executing this command cd / | vi?

When I execute the command cd / | vi, it goes to the vi editor. When I type any command it does not display the command but it gets executed and the command that is executed is not shown in the ...
3
votes
2answers
236 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?
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. ...
-2
votes
1answer
112 views

Why are there several keys unbound in vim?

There are several keys that are unbound in vi/vim, such as g, q, v and #. Is there a particular reason why these keys are unbound? Can I just use them however I want or will I be breaking certain ...
0
votes
2answers
54 views

Skip search and replace after a heading in Vim

I have to replace a pattern, but I don't want to replace it after a particular word. This is my program: :vnoremap ::silent! call Bib() function! Bib() %s/\s*\n*{\\&}\s*\n*/ /g ...
6
votes
1answer
126 views

Can I specify the layout of a vsplit command?

When I do the :vsplit command, it always opens the new file on the left side of the screen. Is there a way I can specify I want the new file to open to the right?
0
votes
2answers
71 views

add bracket across numbers at only end of each line

I have a file having lines as: ram_reg_10/raja_reg_9/raghu_reg_8 abc_reg_4/bcd_reg_5 cad/pqr_reg_91 I want to convert string "_reg_number" into [number] at only last of every line in vi ...
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 ...
6
votes
2answers
155 views

In VI how do I paste text into my file from a range of lines I have yanked?

I am using vi in Solaris 10. I am yanking a range of lines by doing 283,295y, and I do believe the yank command is working as it says 12 lines after I execute the command. However when I try to copy ...
6
votes
1answer
711 views

How can I count the number of words in a file whilst editing the file in vim

I know I can use wc for counting characters, words and lines of files at the command line. Is there any way I can can count the number of words while in vim?
1
vote
3answers
3k views

Vim Error 'E212: Cannot open file for writing', when trying to create new files outside of home dir

I am running Wheezy Debian. When I try to create a new file in a directory other than my home directory, such as /var/www, I get the following error in vim: E212: Cannot open file for writing. I ...
2
votes
0answers
47 views

How do you set up a “compiling parser”-like function to help with editing plain scripts in elvis?

I'm using elvis to edit files etc. in a context where limiting the keystrokes makes a difference1. I don't know all the implications of its differences from vim and I'm actually inexperienced with ...