Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [vi]

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

0
votes
0answers
13 views

Binary executable file with write permission get READONLY from vim

First I know that use vim to write a binary executable program is not recommended. So, I don't want to talk about its rationality here. I have a binary program, with permission 755(owner is root), so ...
3
votes
1answer
57 views

When I try to load and edit files in nano or vi, it only creates a new blank file. Why is this?

When I try to load any files in nano or vi, it simply creates a blank [New File]. For some reason it won't load any files I'm trying to edit. I'm at a loss. Why would this be? I open up a terminal ...
0
votes
0answers
43 views

shell expansions while in vim

Being in vim.tiny in command mode and executing some shell command with :!, is there a way that I can benefit from the shell expansions, namely from the filename generation? When I simply enter key, ...
0
votes
3answers
39 views

“grep -Rl” results as vi arguments with proper space support

I am trying to do something like vi `grep -Rl 'keyword'` But I want to support spaces in the file names. vi "`grep -Rl 'keyword'`" Does not do what I need, it turns the grep output in a single ...
0
votes
0answers
9 views

`~/.inputrc` vi editing mode with emacs shortcut keys, `Control-e: end-of-line` not working

I am using Debian 9 with the Bash shell as default. This is my ~/.inputrc file. set editing-mode vi set show-mode-in-prompt on set vi-ins-mode-string "+ " set vi-cmd-mode-string "- " # in vi-command ...
0
votes
3answers
38 views

Error to Create symbolic binary link

I want to create a symbolic link for vi to see this program when calling from console run vim: ln -s /usr/bin/vi /usr/bin/vim` ln: failure to create symbolic link «/ usr / bin / vim»: The file ...
0
votes
3answers
45 views

are there side-effects to remapping/aliasing less to vim?

I added the following to .bashrc to remap less to vim alias vsi='vim -R -c ":map Q :q!<enter>" -' # Vim Standard Input [readonly] alias less='vsi' the reason is that I don't want to maintain ...
0
votes
0answers
22 views

Different behaviours of sudo [duplicate]

I created a file with sudo like this: sudo touch abc.txt Which understandably set the owner to root. Now when I try to edit the file via vi using sudo, it works: sudo vi abc.txt #works But when I ...
1
vote
1answer
110 views

Removing control M characters from a given file and to remove newline character if it is the only character in the entire file

We have a file named as abc.txt and its a empty file. Due to some junk or control M characters, the file size is populated as 5 byte file. In order to have clean file we are using dos2unix command to ...
0
votes
1answer
89 views

Close the file in vim without closing the file explorer

I am browsing the files in vim file explorer by entering vim dirname. Then I am opening the file, saving and closing it by entering :wq. Now the file explorer window disappears. How to prevent this ...
3
votes
2answers
57 views

FreeBSD's vi does not do control-D unindent properly?

I'm on a minimalist FreeBSD system and need to use the built-in vi editor to edit files. To be specific, this is not vim, or vim-tiny or other replacement. It's the "4BSD bug-for-bug compatible" nvi ...
9
votes
3answers
735 views

How to set and determine the command-line editing mode of Bash?

How to set the vi or emacs command line editing mode the Bash AND how to determine which mode is currently set?
1
vote
1answer
79 views

Should I learn to memorize these keys for Vim for moving - h,l,k,j? [closed]

For VIM in command mode, the keys h,l,k, and j are used to move the cursor but I see no point in memorizing these at the moment because when going into insert mode, I use the arrow keys to move the ...
-1
votes
1answer
35 views

Find the pattern in 1 line and replacing in another line

I have some local soft link paths of files as below. ./tech/finegrain/DUALDFTIO/synopsys/DUALDFTIO.TSMC7N.db ./tech/finegrain/ESD18V/synopsys/ESD18V.TSMC7N.db I got original paths till directories ...
5
votes
3answers
738 views

Opening most recently modified file in vim

The following commands work $ ls -1t | head -1 git_sync_log20180924_00.txt $ vi git_sync_log20180924_00.txt But this does not $ ls -1t | head -1 | vi Vim: Warning: Input is not from a terminal Vim:...
0
votes
2answers
143 views

How to search in vim ignoring all whitespace (and making it a function)

How can I search a string in vim and thereby ignoring any whitespace (or particularly line breaks) between any characters? And probably thereby making a function that can search ignoring all ...
0
votes
4answers
41 views

substitutions in vi editor

I have file called foo.txt. This file contains values: abc.tar.gz abc.1.1.tar.gz bca-1.2.tar.gz I would like to get an output like this abc abc.tar.gz abc.1.1 abc.1.1.tar.gz bca-1.2 bca-1.2.tar.gz ...
0
votes
3answers
407 views

Why doesn't root alias vi to vim if it's standard for other users?

On centos (and I believe many other distros) vi is aliased to vim for all users by default. However, for whatever reason vi is not aliased to vim for the root user, something that always annoys me ...
0
votes
1answer
735 views

vi - How go to line N?

In vi editor how do I go to a particular line ? For example if I open a file named file.py is there an option for open the file at a particular line or can I open my file and then go to line with ...
7
votes
2answers
390 views

Find any line in VI that has something other than ATCG

I have a file of genomic data that is approximately 5 million lines long and should have only the characters A, T, C, and G in it. The problem is, I know how large the file should be, but it's ...
0
votes
1answer
67 views

Vi editor message - input encoding conversion not supported

I'm currently using FreeBSD10, when i open a file using vi then a message displays at the end of file- "Input encoding conversion not supported". Is this to warning or error ? Note:- However the file ...
0
votes
3answers
91 views

resume reading a log file from the point I left it last time [duplicate]

I have a log file which is continuously updating(new line added) after few time period. I am fetching only error messages from the file in every 10 minutes. Initially, at 1st time I fetched all line ...
0
votes
2answers
82 views

How can I search matching pattern (stored in a variable) in a file using awk?

I have a log file in which I need to check if there are any error messages, if there are, extract the error message to another file. Like this I may have error file for the different file have ...
0
votes
1answer
60 views

Terminal doesn't understand some easy commands and keeps trying to install package 'sed' after trying to add directory to PATH

Learning linux so I wrote a simple script to test different scripting variables and arguments. Tried adding the directory to my PATH, something went wrong. I can't even use the ls command... I have ...
0
votes
1answer
18 views

Using Script edit the file and replace some variable value

I have n number of servers like: c0001234.cloud.com c0005678.cloud.com c0009123.cloud.com I need to write one script that will login to these servers and edit one file. Basically there is one ...
0
votes
1answer
54 views

Sed conditional removal of EOL [duplicate]

For the following example, where we have "\" at the end, the \ and EOL character should be removed. line 1\ line 2 line 3 line 4\ line 5 Output should be line 1 line 2 line 3 line 4 line 5 Using ...
0
votes
0answers
247 views

Vim color scheme in bash and byobu

I have a problem with the vim color scheme installation. I did the following: 1) a folder was created ~/.vimrc/colors 2) I put the color definition monokai_pro.vim there 3) I edited the file .vimrc ...
4
votes
1answer
102 views

How to delete “undeletable” lines in Vi?

Background I accidentally deleted an important python script, and so I ran the command sudo grep --binary-files=text --context=100 'unique string' /dev/sda1 > recover_file to search for it on my ...
-2
votes
1answer
26 views

What was the general workflow for finding/discovering/editing project files in VI(M) before virtual terminals? [closed]

When asked what is the native "VI(M) Way" to explore a directory tree and view/edit files, it is often stated that one would type the relative or direct path of the file being targeted and open it in ...
0
votes
1answer
338 views

Replacing non printable characters with hex numerical values

I have a badly corrupted Sqlite file The usual trick of dumping everything into a sql file and loading it into a fresh file doesn't work, but with a hex editor I can see that the data I need to ...
0
votes
1answer
324 views

How do I remove a special character in a file?

I had to use OCR to get the text of a very large script I did not want to type by hand. I have multiple lines like this echo "<91>ps <97>eF|grep... It should read; echo "`ps -eF|grep......
1
vote
1answer
32 views

vi with files/directories on the side?

I'm wondering if there's a plugin or a way to make vi/vim have collapseable folders/files on the left side like a regular IDE.
0
votes
0answers
71 views

set -o vi visual cue in shell [duplicate]

Is there a tool or shell package for either bash or zsh which will visually adjust when I am in edit or insert mode after running command: set -o vi and am using the terminal normally?
2
votes
1answer
475 views

editing sysctl.conf on oracle linux 7.5

I am going to install oracle database 12c on oracle linux 7.5. In the process, I have to edit following kernel parameters and set values. fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = ...
-1
votes
2answers
5k views

select all text in vi to copy and past in windows

How can I select all text in vi so that I can copy it, and then paste it in notepad on my windows server. I have a file with 3,000 lines in it. I cannot use FTP so I need to copy the text in the ...
2
votes
1answer
135 views

Vim: cw & dw whitespace inconsistency

vim seems to treat whitespace differently when using cw (change word) and dw (delete word). For instance with the example text below, if the cursor is over the letter a and I type dw, it will remove ...
1
vote
2answers
62 views

How to create a script to make a structure and sort files by moving them into directories?

I have a bunch of files which all have a first line being a date. All of them start with the same first 2 letters being "ff". I need to create a script which would use that first line in all files and ...
0
votes
0answers
23 views

change the VI color settings for my session via a shell script

I need to change the VI color settings for my session via a shell script. I do not want to edit the .vimrc file because that will affect everyone who logs in as the ORACLE user. I need the syntax to ...
2
votes
2answers
922 views

Searching for a specific string at beginnning and end of the line in Vi

What command is used to search for a specific string at the beginning of line and at the end of the line in vi editor?
0
votes
1answer
23 views

Second vim split is not being saved

I got two files named as vim1 and vim2. vim1 files has some text in it, but vim2 is totaly empty. I used vim vim1 command to open that file. Later on i write :vsplit vim2 to open vim2 file on splited ...
4
votes
6answers
1k views

How to see which file a user is editing in vi

If I do a w, I can see that a user is editing a certain file in vi. However there are several files with the same name in different directories. How do I see which of these files is the one that the ...
1
vote
2answers
109 views

Why pass the argument to vi as vi itself? [closed]

Whats the reason behind passing the first argument to vi as vi itself like the following: /bin/vi vi Why not just write : /bin/vi The only difference that I have seen between the two commands is ...
6
votes
2answers
1k views

Incorrect UTF-8 accents in vi/vim on OpenBSD 6.2

After a default install of OpenBSD 6.2 with FVWM, I open an xterm on the FVWM GUI, with normal user, create a test file: $ echo 'árvíztűrő tükörfúrógép' > test.txt $ echo 'ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP' ...
0
votes
1answer
2k views

How do I add myself to the sudoers file?

I attempted to add myself to the sudoers file a couple of days ago. I didn't want to have to login into root to do anything so I went into the file and inserted my name under root. Now I cannot use ...
0
votes
1answer
2k views

Tmux command mode - Use vi shortcuts

In bash commandline, you can use vim shortcuts by setting set editing-mode vi in the ~/.inputrc file. I want to be able do the same when typing <prefix>:new to create a new window for example. (...
0
votes
2answers
31 views

linux + file printed with the linux prompt

when we print the file- /etc/hosts.txt we get after the last line the - [root@master02 data]# , why? we try dos2linux , and by vi we not see any charterer after the last line - worker03.yu.com 14.23....
0
votes
2answers
2k views

How to insert and delete text in vi on Debian 9

I have only used vi on Debain 8 before and I was able to press "i" to add any text. Even delete was working fine. But now on Debian 9 it seems vi behaviour is different as pressing "i" nothing happens....
2
votes
1answer
379 views

vi commands to find specific letters

I want ask about a commands on vi. start terminal and give this ->> vi /etc/groups and I want to find the entries corresponding to groups with names that end in s or t can someone help?? I already ...
2
votes
3answers
3k views

Replacing .* in vi

I need to replace all occurrences of "period asterisk" as it is shown here: blah blah .*:.*:.* blah blah with: [0-9][0-9]:[0-9][0-9]:[0-9][0-9] so that the end result looks like this: blah blah [...
2
votes
1answer
244 views

Vi search range and replace

I'm using vi on a Tru64 system that isn't letting me use the \1 methods. So simple question I can't find the answer to: How do you concatenate a search (for the range) with a substitution? Something ...