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

learn more… | top users | synonyms

0
votes
0answers
28 views

readline emacs equivalent to vi's 'fc'

In vi readline, I can use the command fc where c is a character I want to find and jump to in the current line. E.g. echo 'hello world' fw --------> Is there an equivalent command in emacs mode? ...
1
vote
0answers
30 views

ex/vi: Input encoding conversion not supported

I've a problem with vi, every time I launched it I get this message: Input encoding conversion not supported; /tmp/vi.PSzqmm9ox9: new file: line 1. Despite of this message I'm able to edit and save ...
2
votes
0answers
20 views

EX editor: go to previous file

On ex i open 3 files ex file1 file2 file3 the command :n go to file 2 and file3 the command :rew go to file1 from file3 or file2 but what command for go to previous file? I think :e previuosfile ...
6
votes
1answer
91 views

Start vi at the last line

I often find myself editing one of a set of configuration files by adding lines at the end. For editing I use vi (from bash) and currently use: vi +$(wc -c /home/john/master/tried.cfg) The above ...
1
vote
1answer
35 views

search and increase the values between the second tilde symbol and the 3rd tilde symbol in each line of a txt file

I was wondering is there any way to search and increase the values between the 2nd tilde symbol and the 3rd tilde symbol in each line of a txt file. Maybe vi can do this? For example, i have a ...
1
vote
1answer
24 views

How to search for <td>n in vim?

I can search for n with /n/ I can search for <td> with /\<td\>/ But how can I search for <td>n ? When I try /\<td\>n/ i get not found I'm trying to target the ...
0
votes
0answers
19 views

On OSX, vi seems to return 1 unexpectedly despite no error

So, on stock Mac OSX Yosemite, if I run vi /tmp/foo and then type in some text, and finally do :Wq (a common typo I make) and then :wq. Everything will appear to be fine, but for some reason the exit ...
1
vote
1answer
35 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
22 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
24 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
55 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
43 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
321 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
267 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
70 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
57 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
50 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
283 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
57 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
31 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
154 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
123 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
126 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
27 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
83 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
51 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
128 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
117 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
66 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
138 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
279 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
108 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
190 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
64 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
142 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
86 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
46 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
62 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
193 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
580 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
321 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 ...
46
votes
8answers
36k 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
38 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
52 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
90 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
258 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
40 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
117 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 ...