Questions tagged [vi]
vi is a screen-oriented text editor originally created for the Unix operating system.
415
questions
0
votes
0
answers
25
views
how to use `vi`/`vim` in cli mode like `sed` [duplicate]
i need to replace some strings and due to some reason, vi or vim is my only options.
but the problem is i need this to be done in a shell script, is it possible to use vi/vim in cli mode like sed?
e.g....
1
vote
0
answers
37
views
Backspace on vim doesn't work after I create a ~/.vimrc file
I'm using vim on macOS, I did different tests.
Backspace doesn't work in vim with my ~/.vimrc.
I saw that when I remove my ~/.vimrc file everything is ok, but whatever I write in it (any writable ...
0
votes
1
answer
29
views
Bind C-h in tmux copy mode
I'm trying to bind C-h to move to the window on the left. Here is my tmux.conf
set -g default-terminal "xterm-256color"
bind -n S-down new-window
bind -n C-l next
bind -n C-h prev
bind q ...
1
vote
0
answers
22
views
How to remap "vi-search-again" in .inputrc?
I use Colemak + Bash Vi mode, and have remapped h j k l to h n e i in .inputrc.
The original N n keys for repeating search seem to be bound to the same command:
$ # Run in command mode
$ bind -p | ...
1
vote
2
answers
31
views
Disable $keyword$ expansion by RCS ci check in?
For better or worse, I am using rcs to track changes to HTML and JSON files exported from chatGPT. Some of these contain chats with embedded $keyword$'s. These get expanded on ci check in. How do I ...
0
votes
1
answer
96
views
yamlfix not using configuration + (neo)vim usage
I'm using yamlfix with ale in vim.
I followed these steps because I wanted to remove the automatic "---" adding on top of the file every time I save my work (and some others default ...
0
votes
2
answers
140
views
Highlight for two strings simultaneously in vi or less editor?
https://stackoverflow.com/questions/41901319/how-to-search-for-multiple-strings-in-a-log-file-using-less-command-in-unix
I found this.
awk '/pattern1/ && /pattern2/ && /pattern3/' file....
0
votes
0
answers
90
views
Why am I unable to copy to clipboard from vi editor?
I use old servers so I've to use vi editor. Problem is that I need to copy logs frequently and it's totally painful to do so. I've to convert that to a file, do SCP then only be able to get the logs. ...
2
votes
0
answers
51
views
How do I get the man page for a sub command using vim?
For example, I get the manpage for a command using 'K':
docker run
+------------ cursor is on d
# if I press 'ESC-SHIFT-K', I'll get a manpage for docker
Now, if I want to get the manpage for docker ...
1
vote
1
answer
304
views
quick-swap TUI mode while using vi keybindings in GDB
In the default mode of gdb, pressing ctrl+x a turns on and off the UI, and ctrl+x 2 cycles through different split views. There are a number of similar useful shortcuts.
I can turn on vi emulation ...
0
votes
1
answer
77
views
How to do a random search in vi editor?
By random, I mean neither from top, nor from middle, nor from bootom. The search should return randomly ordered results.
eg: I am searching for "failed" in vi editor. I want randomly ordered ...
1
vote
2
answers
147
views
Is there a way to get the keyboard layout (which letter is where)?
I have a very rarely used keyboard layout and there are a lot of things that are quite obviously not optimized for my very specific layout.
I would like to change hotkeys for a program but I would ...
3
votes
1
answer
161
views
How to make bash keyboard editing default to vi from emacs?
I know how to set the keyboard editing in bash to vi (set -o vi), and probably I could do it in bashrc. But I use bash in a variety accounts and contexts and want it to just default to vi over emacs ...
-4
votes
1
answer
48
views
how can i reduce the byte of the code bellow from 146 to 144 need help please [closed]
How can i reduce the byte(memory) of the code:
#include<stdio.h>
/**
* main - Entry Point
* Return: Always 0 (success)
*/
int main(void)
{
printf("Size of a char: %d byte(s)\n&...
0
votes
0
answers
43
views
Having to press `esc` twice to enter normal mode in vi on tmux [duplicate]
I'm having a problem in TMUX, where in order to go to normal mode in VIM, it takes 2 key presses of "ESC", how do I fix it?
0
votes
1
answer
510
views
Exit out of Insert mode in Bash with Vi keybindings on command run
I have bash set up with Vi keybindings, however when a command finishes running it returns to insert mode rather than movement mode.
I can use bind '"\C-M":vi-movement-mode' in my .bashrc to ...
0
votes
0
answers
48
views
How is ex implemented in vim?
Now I am reading a book on sed and awk and to learn the history needed to use ed and ex commands.
I thought for a vim user on Arch Linux, there is no need to install other packages but I found that ex ...
0
votes
1
answer
441
views
How can I prevent vim from trying to connect to an X server?
I'm starting vim in a bash session, within an SSH session. This session has X forwarding enabled, for reasons, but - I want vim to not try to connect to the X server (see this question).
Other ...
0
votes
0
answers
772
views
How do I recover data from xfs and ext4 filesystem
Hi guys I just wanna know if there’s a simple command to recover a simple data file such as vi text in ext4 and xfs filesystem in linux
0
votes
2
answers
194
views
Paste with VIM through regular-expression replace
I'm using VIM's y command to copy some code (multiline), and want to paste it with p-command in some other place in the file.
However, I want to paste the copied code quickly after doing some changes ...
0
votes
1
answer
192
views
How to delete text with a backspace using `nvi` on FreeBSD?
For some reason, it’s impossible to backspace delete text that is already present in the file before the current insert mode switch.
If I try to edit a line in this text and then backspace it in the ...
0
votes
1
answer
65
views
`ZQ` does not work on vi version installed on FreeBSD
When I open a file with the default vi on FreeBSD and press the buttons ZQ (close without saving) it tells me Usage: ZZ.
But ZZ saves any modifications and I don't want that.
:q! works, though.
:...
0
votes
3
answers
4k
views
how to add particular character in starting of each line in text file using vi
Let's suppose we have a text file which contains the below entries.
my name is XYZ
I study at ABC school
if using vi mode I want to add "#" in front of each line
:%s/^/#/gThe issue is that ...
2
votes
1
answer
154
views
(n)vi - Erase in ex mode
How does one erase characters in ex mode (':' command line) of (n)vi 1.79 or make 'Backspace' behave as in Vim?
'Backspace' and 'Delete' only move the cursor left, from where new keystrokes overwrite ...
4
votes
1
answer
895
views
Why RHEL has two vim installed by default?
I'm on a RHEL 8.3 system. I found that the built-in vim and vi are all vim. They have the same version, but compiled differently. Below is my testing:
[root@192 ~]# which vim
/usr/bin/vim
[root@192 ~]#...
1
vote
1
answer
297
views
Repeat a sequence of edits in vim
I have this text:
gradient
continuité
direction
and I would like this one:
\donnee{gradient}
\donnee{continuité}
\donnee{direction}
In visual mode, I can prepare the sequence \donnee{ ESC
then going ...
0
votes
2
answers
188
views
add # to every line except those with #
Using vi
How do i add # to every line except those lines already having #
1,$s/^/#/ help here
Thanks in advance
2
votes
0
answers
161
views
How to start xterm instance which automatically opens nvi in a "complete" environment with ^Z :suspend capability
I am having problems starting a xterm instance that automatically opens nvi in a "complete" environment with job control.
I am referring to xterm specifically here and not a VTE skin or ...
0
votes
0
answers
18
views
in terminal utilizing vi command , somehow changed the keyboard so that upon pressing a character on the keyboard does not output the proper value [duplicate]
while in terminal . utilizing and learning basic Linux commands and was covering the usage of the vi command when it became apparent that something was different than the screen that i was taking ...
2
votes
1
answer
701
views
Pasting text to VI adds pound? [duplicate]
When I paste the following text into VI
VI adds pound to each line, Is there a way around this?
####################################
##Parameters for XEROX Printers MSSQL DB
##########################...
0
votes
1
answer
127
views
Load/Connect automatically to the Linux server session using Mputty
Looking for a help on Loading the putty sessions through Mputty.
I can login to my app servers(Linux) only through Jumphost. After login to jumphost i need to perform the ssh to connect my App servers....
0
votes
1
answer
153
views
vi doesn't see a file on an over-mounted file system, while ls does
I have been editing and trouble shooting a script. When I tried to edit it now, it shows an empty file and says[New File]. The file exists both ls and cat see it. And, I had edited about 10 minutes ...
0
votes
1
answer
383
views
Does my vim not use the config in the home directory when used with sudo?
I tried to manipulate a file with sudo but NERDTree was obviously not loadable. I am new to vi(m) so I don't have many other plugins which I would have had the chance to see if vim missed to load them....
0
votes
1
answer
439
views
Which $TERM renders bold text in vim as well as display status line?
I am looking for a $TERM which displays bold text in vim and display airline statusline too. To know what I mean,I have screenshot of two identical files opened by vim but using different terms by ...
1
vote
1
answer
1k
views
how do I redirect output of echo "!#/bin/bash" into another SH file using vi editor [duplicate]
basically I am creating another SH file inside a SH file using vi editor and echo commands.
here is the content of original SH file-
#!/bin/bash
echo "#!/bin/bash" > f1.sh
echo "echo ...
3
votes
7
answers
3k
views
How to remove \n in a string
I have a tab delimited text file where the 23rd column with string has \n in it which causes it to break to the next line.
I opened the text file in vi and enabled white space characters and I can see ...
0
votes
0
answers
113
views
Keymap causes Readline Delay on `.` in Vi Mode
When I press . in Vi/command mode there is always a delay (half a second) before the last action gets repeated.
I found that this is caused by my .inputrc:
set editing-mode vi
set keymap vi-command
&...
2
votes
1
answer
2k
views
Setting cmd-mode bindings in inputrc for vi editing-mode
I am using vi key bindings in .inputrc with
set editing-mode vi
Then I would like to add new bindings for command mode, namely use K and J to perform forward and reverse search in history of what I ...
1
vote
2
answers
332
views
Adding vi to vim mapping for all users in centos
I'm using a specific centos7 image from AWS EC2 which, for some reason, does not have vim installed.
I already run ansible scripts on newly spun up servers, so I planned to add VIM via ansible. I ...
0
votes
0
answers
137
views
How to trap interrupt signal using a shell script while editing a file in vi editor which has been opened using the same shell script?
I am trying to write a shell script which helps me to run and edit java files easily with just one click. I mean the script takes the java filename as argument and then provides three different ...
0
votes
1
answer
32
views
tree: Is there a way to maintain visibility of outer level directory labels when scrolling?
When you generate a tree for a large directory base with innumerable sub-directories and associated files, with -a option, often you get a large file with thousands of lines. While traversing the tree ...
0
votes
1
answer
773
views
File is having lots of special characters. How to replace?
I have a file with record like:
CENTURY®KETTLEBELLS
COLEMANTT40°BAG
AlphaPro2¾TDLE
Lot™Stretch
M6×30
It shows normally in notepad files but in terminal when i cat it, it shows:
CENTURY▒KETTLEBELL
...
0
votes
2
answers
263
views
comment out lines in a file when condition met
I can comment out certain lines through vi in files. It is strenuous activity to do it in the 100's of files. Can I put a condition through sed or awk, for example, I want to put a condition as to ...
0
votes
3
answers
1k
views
Researched, but still really confused about Vi vs. Vim [closed]
My first post on unix.stackexchange.com. Please, don't just react by the title of this post as I'm not jumping in having not researched what I'm asking for.
I have done quite a research about Vi vs. ...
4
votes
2
answers
2k
views
Using the caret symbol (^) in substitutions in the vi editor
I'm using CentOS and I was reading about the substitution command, s///, in the vi editor. I wanted to test some of the examples I saw:
:%s/old/new/g Substitutes old with new throughout the file
:....
3
votes
1
answer
3k
views
How can exporting EDITOR="nano visudo" be considered a severe security risk in the context of visudo?
Reading a security guide on how to harden Arch Linux, I've come across the following tip that exporting EDITOR=nano visudo is considered a severe security risk.
Tip:
To use restricted version of nano ...
2
votes
1
answer
307
views
have vi or perhaps vim leave the file content in the terminal
20 years ago, whatever vi I was using used to leave the file contents on the terminal after you quit. This meant you could exit and then copy and paste some of the content you'd just created. With ...
0
votes
1
answer
235
views
Scroll, instead of move cursor, if at end of file
I find myself unintentionally hitting j (or some other downward cursor movement key) when I'm at the bottom of a file. Then the next thing I do is to hit Ctrl-E to scroll the current line up - I may ...
0
votes
1
answer
80
views
Remove multiple @ symbol from a file
I have a file in linux that has json data in each new line. When I open that file in vi editor, multiple @ symbols show up at the end of every record in a new line. The file does have new line after ...
0
votes
2
answers
2k
views
Force create nonexistent directory via vi or touch? [duplicate]
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 ...