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

learn more… | top users | synonyms

-1
votes
1answer
21 views

Print output in multiple lines [on hold]

I am new to unix and shell scripting.I am trying to create a script which will have various commands in there, on executing that script it should write the output in the terminal. Below is the sample ...
1
vote
3answers
36 views

how to make a large command line broke in two lines be executed as a single line inside of a script

I am very begginer with Unix. I am using IBM z/OS390 and I am using the OMVS shell. I don't have "vi" installed at all so I use "oedit". If I try to initialize the app.jar straigh from OMVS shell it ...
0
votes
1answer
24 views

How to delete part of a file and save it in another - using vi

Say you have a file call stuff.txt and you're editing it in vi. cat stuff.txt 11233 blah doesn't matter what <---------------------pretend your cursor is here xxcvbbb dfdfdd How can you ...
13
votes
2answers
445 views

What is “<Esc>Kv” in bash

When I am in bash and press Esc, Shift+K, V, bash fires up $EDITOR with a filename similar to /tmp/bash-fc-186566385. Why is that and what is its purpose? I probably need to mention that I am ...
-2
votes
1answer
34 views

How to replace all dots in vi

How to replace in vi? There are numerous explanations in Internet, but most of them doesn't contain information about which buttons to press. If I enter :s/[.]/[.] <ENTER> then only one ...
3
votes
2answers
30 views

How to replace a line with a certain pattern in vi?

I am trying to replace lines that contain the pattern "s#_decoded_block[" with "s#_decoded_block_". The command I am using to do that is %s/s\d\+_decoded_block\[/s\d\+_decoded_block_/g I expect to ...
3
votes
2answers
702 views

In vi/vim, how do I append to a file instead of overwriting it?

I know I can write to a file by simply doing :w <file>. I would like to know though how can I write to a file by appending to it instead of overwriting it. Example use case: I want to take some ...
0
votes
1answer
18 views

Less quit behavior

I'm not sure how to describe this but I'll try by comparing it to vi. When I open vi, do something, and then exit vi it brings me back to the terminal where I can see all of the commands I had ...
1
vote
1answer
43 views

Two different versions of VIM

When I install just about any distribution of linux it's accompanied with an unorthodox version of vi. I most recently dealt with this on Ubuntu 14.04. I can vi a file but a number of the "hot" keys ...
0
votes
1answer
43 views

How can I get rid of the byte-order mark 

I have created an html webpage when I run it at the bottom of the page there's some unwanted characters uncoding . I tried to get rid of it through vi using set nobomb but it still appears in the ...
1
vote
4answers
56 views

Command line in vi mode: replace all

How do I replace globally from the command line in vi mode. It seems like I can't use ex commands by prefixing with :, so what do I do instead. for instance if I want to replace all \ with / in a ...
0
votes
1answer
35 views

vi is frozen after search on arch linux

I'm on Arch Linux live USB. I'm using vi to open an 18kb text file containing a single line of json. I did a search with / and hit a block partway through the file represented by an @ symbol. Then, ...
0
votes
2answers
103 views

Linux server terminal - rows of tildes, can't write commands?

I'm pretty new - came across this problem. My webserver terminal is looking weird, there are some code echoes and then rows and rows of tilde. Where I type would be at the green square, but nothing I ...
26
votes
4answers
2k views

Does vi silently add a newline (LF) at the end of file?

I have trouble understanding a weird behavior: vi seems to add a newline (ASCII: LF, as it is a Unix (AIX) system) at the end of the file, when I did NOT specifically type it. I edit the file as such ...
2
votes
4answers
103 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
204 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
136 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
71 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
51 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
200 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
28 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
627 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
35 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
46 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
128 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
17 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
66 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
50 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
146 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
56 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
61 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
81 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
90 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
84 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
116 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
40 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
90 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
88 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
101 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
24 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
43 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
41 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
66 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
275 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
52 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
6k 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
349 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
635 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 ...