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

learn more… | top users | synonyms

2
votes
4answers
81 views

How to move to the “Nth” offset in a file

I'm in need of a command that would help me to the the N th offset in a file. Say this is my file's contents: [root@localhost ~]# cat /file1.txt this is the the first line of many lines and is just a ...
3
votes
2answers
195 views

How to write contents of a file to new file removing repeated lines [duplicate]

For example, a file file1.txt contains Hi how are you hello today is monday hello I am fine Hi how are you After the processing of file1.txt it should write to file2.txt and contents ...
0
votes
4answers
43 views

grep all the lines in a file and write line to a file from the pattern matching point

For example, a temp.txt file contains information like below: adsf on line jhkjhvjdbvjvbvbdjkvn qerwtt on line fdgdgdgdd qwqertg on line safffasffaf wrt on line adaddsd I want to grep for ...
0
votes
3answers
39 views

strange vi behavior on OSX Debian ssh terminal

While creating a swapfile I issue vi /etc/fstab as root. fstab file comes up, great. Issue G $ to jump to end of line and i to enter INSERT mode. Press the right arrow to move the cursor over by one ...
3
votes
1answer
36 views

Vim - Is there a way to get immediate visual feedback during Insert in Visual Block Mode?

I often press: <Ctrl> V to go into visual block mode and highlight a column hit <shift>-i (to insert at the beginning of the line), type a few things (at this point, I see my changes on ...
1
vote
3answers
192 views

How to match two lines at once in vim

I have a file that contains records with tab separated format but in two lines, I want to arrange records in one line with tab separated values using vim editor pattern match. Ex. Abc PQR ...
3
votes
2answers
24 views

vi — replace chars from part of line

I've got a file with all Belgian cities. Some of these cities have boroughs. Lier;stad;Antwerpen;49,70;33930;Lier;Koningshooikt ...
5
votes
3answers
615 views

When using vi typing a “c” will delete a character

This also happens when copying and pasting. I am attempting to edit Go code and typing or copying and pasting "package main" comes out as "pkage main". No idea why I can't type a c. Pressing delete ...
1
vote
1answer
34 views

With crtl-p can I open a file outside the current tree?

In looking to have functionality that can match my textmate friends for opening files with quick regex capability I found ctrl-p - https://github.com/ctrlpvim/ctrlp.vim It builds, indexes and then ...
1
vote
1answer
44 views

vi needs two <enter> keystrokes instead of one

If I want to open a file using "vi", it needs two <enter> keystrokes instead of one. Any idea, how to fix it? Just few hours back it was working perfectly. I have been searching on the net ...
1
vote
2answers
114 views

Not able to schedule tasks in crontab

[srinkann@sjc-ads-440 ~]$ crontab -e no crontab for srinkann - using an empty one /bin/sh: /usr/bin/vi: No such file or directory crontab: "/usr/bin/vi" exited with status 127 [srinkann@sjc-ads-440 ...
0
votes
2answers
16 views

using matches of regex in vi global substitution

I am trying to edit a text file using vi where I want to replace the matches of [a-z],[A-Z] with: {matching value of [a-z]}{a space instead of a comma}{matching value of [A-Z]}. For example: ...
2
votes
1answer
52 views

VIM with Python - Multiple # do not get colored as a comment

Something changed on my system and now VIM screws up syntax highlighting of commented lines. This makes having 'debug' lines very difficult as it looks like the line is still active based on the ...
0
votes
2answers
20 views

Need help copying text from a webpage into vi?

I have this wall of text open on my browser that I need to copy and paste into vi in order to edit it. I tried controlC and controlV and it didn't work. I tried looking online, but everyone said to ...
2
votes
1answer
88 views

`crontab -e: E212: Can't open file for writing` when using gvim (works with vi)

As a user, I want to edit my crontab. crontab -e gvim is launched. It prints "/tmp/crontab.IUVYhK/crontab" [New DIRECTORY] I can write but as soon as I try to write the temporary file, I get ...
0
votes
1answer
49 views

Vi on Xenix: why instead of scroll the line overwrite the current line?

On linux and old Unix (at&t for example) when I scroll the line I see the text on Xenix the current read line is "overwriting" the screen. Look at video,you understand what i'm talking about How ...
1
vote
2answers
51 views

Cursor position in vi at opening of the file

vishex () { echo '#!/bin/bash' > $1; chmod +x $1; vi $1 } The goal of the above function is to have an alias for fast and comfortable creation of bash scripts. I would like that at ...
0
votes
1answer
56 views

How do I clean up vi and reinstall it completely? [closed]

Basically when I try to run vi, I have the following error (and after open it, there are a lot of errors): Error detected while processing function UltiSnips#bootstrap#Bootstrap: line 35: Traceback ...
0
votes
2answers
47 views

how to move the first line to the end of the file?

How to delete the line AFTER the first line that contains the patter:invHn3ion? and how to move the first line to the end of the file? anywhere i can learn all those expressions? My professor teaches ...
1
vote
1answer
66 views

Why is vi (but not cat) showing ^[[31m[^[[m^[[31m" after I use sed and output to a file I then edit? [closed]

When I use cat Variables/user-extensions.js | sed -e 's/css/XXX/' on an input file of the form storedVars["css_body"] = "css=body"; storedVars["css_main"] = "css=main"; I see output such as ...
0
votes
1answer
62 views

In vi, convert invisible characters into escape sequences?

My text in vim looks like, i am one line i come in next line i come after a tab space Can the above text be converted like this, i am one line\ni come in next line\n\ti come after a tab space ...
0
votes
0answers
34 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
1answer
70 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 ...
3
votes
1answer
57 views

EX editor: go to previous file

Using ex I open 3 files ex file1 file2 file3 I know the command :n goes to file 2 and file3 the command :rew go to file1 from file3 or file2 But what command can I use to go to previous file? I ...
6
votes
1answer
98 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
41 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
32 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
22 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 ...
2
votes
1answer
39 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
32 views

Backward and forward search are reversed 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 produces a / and the reverse. Is it normal? How can I change this behavior?
0
votes
1answer
43 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 ...
-1
votes
1answer
163 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
49 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 ...
3
votes
2answers
3k 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
326 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 the enter key. But the cursor ...
2
votes
1answer
360 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
111 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
84 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 ...
8
votes
1answer
377 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
74 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
35 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 ...
4
votes
1answer
592 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
242 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
340 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
39 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
118 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
67 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
59 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
178 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
181 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