Questions tagged [vi]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
20 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 | ...
UM-Li's user avatar
  • 47
1 vote
2 answers
26 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 ...
Steve Dutky's user avatar
0 votes
1 answer
55 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 ...
Corentin Michel's user avatar
0 votes
2 answers
76 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....
barnyard9's user avatar
  • 157
0 votes
0 answers
80 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. ...
achhainsan's user avatar
2 votes
0 answers
44 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 ...
Chris's user avatar
  • 961
1 vote
1 answer
230 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 ...
Fraser's user avatar
  • 111
0 votes
1 answer
72 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 ...
achhainsan's user avatar
1 vote
2 answers
113 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 ...
xyious's user avatar
  • 111
2 votes
1 answer
127 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 ...
kmand's user avatar
  • 101
-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&...
Aroh chukwuebuka's user avatar
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?
Origami's user avatar
  • 21
0 votes
1 answer
344 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 ...
Biran4454's user avatar
0 votes
0 answers
45 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 ...
Taro's user avatar
  • 101
0 votes
1 answer
340 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 ...
einpoklum's user avatar
  • 9,515
0 votes
0 answers
633 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
Tae's user avatar
  • 1
0 votes
2 answers
152 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 ...
Cocktail's user avatar
0 votes
1 answer
167 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 ...
t7e's user avatar
  • 323
0 votes
1 answer
57 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. :...
t7e's user avatar
  • 323
0 votes
3 answers
3k 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 ...
jazz's user avatar
  • 27
2 votes
1 answer
137 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 ...
zatg98n4qwsb8heo's user avatar
4 votes
1 answer
796 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 ~]#...
Fajela Tajkiya's user avatar
1 vote
1 answer
277 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 ...
Marc Le Bihan's user avatar
0 votes
2 answers
169 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
visedawk's user avatar
2 votes
0 answers
134 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 ...
Kajukenbo's user avatar
  • 307
0 votes
0 answers
17 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 ...
Newby Mad Brad's user avatar
1 vote
1 answer
582 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 ##########################...
JavaSheriff's user avatar
0 votes
1 answer
113 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....
Amala's user avatar
  • 1
0 votes
1 answer
138 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 ...
Garnet's user avatar
  • 398
0 votes
1 answer
362 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....
von spotz's user avatar
  • 435
0 votes
1 answer
409 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 ...
Machinexa's user avatar
  • 123
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 ...
lives_in_virgosupercluster's user avatar
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 ...
ntropi's user avatar
  • 37
0 votes
0 answers
105 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 &...
laktak's user avatar
  • 5,976
2 votes
1 answer
1k 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 ...
Joce's user avatar
  • 192
1 vote
2 answers
304 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 ...
dsollen's user avatar
  • 794
0 votes
0 answers
133 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 ...
Esha's user avatar
  • 193
0 votes
1 answer
31 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 ...
Vinod's user avatar
  • 165
0 votes
1 answer
725 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 ...
Amin's user avatar
  • 13
0 votes
2 answers
250 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 ...
Muhammad Ilyas's user avatar
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. ...
Giorgi Tsiklauri's user avatar
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 :....
user447343's user avatar
4 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 ...
Shuzheng's user avatar
  • 4,431
2 votes
1 answer
263 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 ...
projix's user avatar
  • 179
0 votes
1 answer
221 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 ...
g.delgado's user avatar
  • 121
0 votes
1 answer
74 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 ...
hiphop's user avatar
  • 1
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 ...
Wolf's user avatar
  • 1,631
0 votes
1 answer
306 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 (...
Iresh Dissanayaka's user avatar
6 votes
5 answers
840 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 ...
Chris Davies's user avatar
-3 votes
1 answer
113 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 ...
Machine Yadav's user avatar

1
2 3 4 5
9