Questions tagged [vi]

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

Filter by
Sorted by
Tagged with
0
votes
2answers
44 views

Force create nonexistent directory via vi or touch?

There are -p option in mkdir command to create parent directories as needed wolf@linux:~$ tree . 0 directories, 0 files wolf@linux:~$ wolf@linux:~$ mkdir dir1/dir2/dir3 mkdir: cannot create ...
0
votes
1answer
28 views

st terminal + shell vi mode

Context: I use zsh and use vi editing mode. To go up in the history instead of pressing ESC to go to the normal mode and pressing k, I press alt+k which sends the esc character and sends k afterwords (...
6
votes
5answers
341 views

How to edit a list of generated files whose names contain spaces

I've got a relatively small list of filenames generated from a pipeline based on find. The file names contain spaces and possibly punctuation but definitely no other non-printing characters or ...
-3
votes
1answer
36 views

How to import tmux setting for vim to normal vim?

When using tmux my color/font/syntax highliting in VIM gets improved. How can i import that red/yellow/white combination of color in .vimrc file. I want that. VIM ON TMUX: AND THIS IS MY NORMAL UGLY ...
0
votes
0answers
33 views

How to copy full vim/vi remote file content to my local clipboard

I am having a file in the remote machine ( connected with customized ssh not Normal ssh ) .I do not have a way to copy/move the file to my local ( No scp allowed and no other connectivity ) .I am ...
-1
votes
2answers
84 views

vi, or vim, on Centos7, overwrites the previous 30 lines in my bash window and thus those line are lost forever

I'm running Centos7 with TERM=linux. Whenever I open a file with vi, or vim, the previous 30 lines in my bash window are over written. vi works fine, but when scrolling back, those 30 lines are lost ...
1
vote
1answer
49 views

vi / Vim: oddities of composing delete/change (d/c) with motion

Let's start with investigating some motions in vi(m). I use the sample line AA BBB as subject of these investigations, and for each experiment we are starting off in normal mode, cursor at beginning ...
2
votes
3answers
96 views

Use substitution to delete everything up to a point on a line

I want to use a global substitution in Vim to delete everything up to https. Before The website is https://website.com The website is https://website.com The website is https://website.com After ...
1
vote
2answers
55 views

How to jump to the first line of the C/C++ function using vim?

Is there a set of commands to jump between various elements of the C/C++ source code in vim? I know ctags but that offers limited functionality. For example, is it possible to jump to the first line ...
4
votes
1answer
179 views

Access time of a file

I am using bash shell. If I just open a file with the vi editor and close it without even moving the cursor even once, then that, as far as I understand, should change the last access time of the file ...
0
votes
1answer
48 views

Linux account will no longer let me edit or create files

I was editing a file and Instead of typing ZZ to save and exit I typed something else by mistake. I think it might have been either ctl-z or ctl-c . Anyway it ended up abending the vi session. When I ...
0
votes
1answer
34 views

How to set tab for all files to use two spaces when in vi?

When I edit ruby (.rb) and Javascript (.js) files my settings seem to work ok to make a tab be a space. However for other files, such as files with no extension, when I use tab I get a tab, not two ...
0
votes
0answers
31 views

ESC (in VI) on FreeBSD as Guest in VirtualBox on macOSX does not work. Neither over VB own screen, nor via Terminal > SSH

I just installed FreeBSD-12-Current as guest of VirtualBox6 on my MacBook Pro 15° 2018 with TouchBar under macOS Mojave 10.14.6 an then installed "SUDO" on the virtual machine. When I try to configure ...
-2
votes
1answer
15 views

How to reduce numbering indent in vi in 19.10?

Upgraded to 19.10 and my terminal window without numbers is ok but with numbers (:set nu) it now has a large annoying indent! I tried the solution at https://unix.stackexchange.com/a/252200/10043 ...
0
votes
1answer
17 views

How can I delete marks in Kile/Kate in vim-mode?

When setting marks in Kile’s/Kate’s vim-mode via m. the line will be highlighted. This can be annoying and the attempt to remove the mark via :delmarks fails with unknown command: “delmarks”. Is it ...
0
votes
3answers
60 views

Search string and add # to the beginning of that line

Need some help using the vi editor. I am trying to comment out a line on crontab for a specific user. This is the line on the crontab among many other lines: 0,5,10,15,20,25,30,35,40,45,50,55 2-...
0
votes
1answer
51 views

How to properly edit a TXT file created in Windows using VI editor

I created a text file (link goes to DropBox) with a Windows application and now I MUST edit it with VI in Unix. Once I opened the file, I realized that I cannot easily navigate within the lines in ...
0
votes
1answer
107 views

How do I remap function keys in readline bash vi (vi shell mode)?

Regarding mapping function keys in vi readline, I have read these two stackexchanges: Remap bash vi keys? Custom key bindings for vi shell mode, ie, "set -o vi"? I have a MacBookPro with a ...
1
vote
2answers
247 views

Invoking external editor from Vi command line editing mode in zsh

For some reason, I can't get the keybinding to invoke Vim (my editor) to work with Esc+v zsh when using iTerm. I've gone back to a minimalist .zshrc file, to ensure it's not a plugin issue: # If ...
2
votes
1answer
1k views

Disabling vim visual mode in /etc/vim/vimrc does not work

I found plenty of questions regarding disabling visual mode in vim but none that tackles my particular problem: I added set mouse-=a to my /etc/vim/vimrc file to disable visual mode for good. Thing ...
0
votes
0answers
89 views

vim doesn't terminate when terminal is forcefully closed

steps to replicate: [Windows PC] SSH to machine as user using putty/cmder (centos 7 VM) [Linux VM] vim def.txt (as a user) [Windows PC] kill the terminal program (putty/cmder) using task manager [...
0
votes
1answer
130 views

How to turn colors for vim.tiny without internet access?

readlink -f 'which vi' output: /usr/bin/vim.tiny vi --version output: VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 17 2016 07:08:19) Included patches: 1-488, 576 Extra patches: 8.0.0056 ...
0
votes
2answers
640 views

How can I search date format in vi?

I want to search date format like 2019-07-12 11:22:33. but, in vi mode, :/2019-07-12 11:22:33 is not executed by white space. how can I search 2019-07-12 11:22:33? (other format is not pretty)
1
vote
3answers
334 views

vi/vim, how can I write out the nth word of all lines to a new file

How can I write out the nth word of all lines to a new file? For example, I want the second word of all lines wrote out in new_file.txt: old_file.txt: pippo pluto paperino gigi lui marco piero ...
0
votes
1answer
720 views

Run zsh (oh-my-zsh) in Vi mode when connecting to remote server via ssh

I'd like to connect to a remote server using ssh and have the session running in Vi mode. I have found how to do that for bash: ssh username@server -t 'bash -o vi' But I need the same thing for zsh (...
0
votes
1answer
112 views

How to turn on syntax highlighting for vi/vim?

Running a minimal ISO of CentOS_7 I've tried writing a .sh script using vi but can't get syntax highlighting to work. Pressing escape and typing :syntax on as shown in articles like this one are not ...
1
vote
1answer
377 views

Vim autostart with Vexplore and terminal

I want to setup vim to behave like a traditional ide for the most part. What I would like to do is when I type the command vim it opens up this way: The problem is it opens this way: I would like ...
2
votes
1answer
60 views

Replace VI macro with Linux equivalent

My file arrives on a Linux server and contains ^M characters when seen in VI and the file format = unix, (ff=unix) I want to turn lines 1-4 into line lines 9 - 10. My vi macro solves my problem. /\r/...
2
votes
1answer
118 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
380 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
60 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
107 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
3answers
516 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
133 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 ...
1
vote
1answer
952 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
638 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
74 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 ...
10
votes
3answers
2k 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
118 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
40 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
1k 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
590 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
46 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
1k 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 ...
23
votes
1answer
37k 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
424 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
105 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
185 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
255 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
98 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 ...

1
2 3 4 5
8