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-mode]

The tag has no usage guidance.

8
votes
1answer
390 views

Why don't I see the difference between two different files in insert mode in vim?

Let's create two files: $ echo -n 'test' > test.txt $ wc test.txt 0 1 4 test.txt The file test.txt doesn't contain the trailing newline. $ echo 'test' > test_n.txt $ wc test_n.txt 1 1 5 ...
2
votes
0answers
32 views

vi mode of bash 5: How to invoke plain editor instead of fc?

Apparently since the release of bash v. 5 some weeks ago (witnessed on Archlinux and Debian Buster), the default behaviour of invoking the editor in vi mode has changed. set -o vi <Esc>v bash ...
2
votes
1answer
143 views

Bash's “set -o vi” vs readline's own options?

I know there is, for readline, set editing-mode vi You can put the above option in ~/.inputrc, editing-mode is documented by Readline as editing-mode (emacs) Controls whether readline begins with ...
-1
votes
2answers
49 views

What does “set keymap vi” actually do?

In an effort to vim-theme Readline, I see there are two set editing-mode vi set keymap vi I believe I understand what editing-mode vi does providing different VIM keymaps to edit, and insert text ...
1
vote
0answers
44 views

Customize ZSH history search in vi mode

I want to replace default history search widget in vi mode with my own (binding it the the default key, i.e. / in command mode). Here's what I tried putting in my .zshrc: custom_command() { ...
0
votes
1answer
47 views

Why do I have to press two times CTRL+[ to come back from VISUAL to NORMAL mode in vi?

Is there a simpler way to come back to NORMAL mode in vi? The answer that has just been deleted mentioned 'delay'. I pressed CTRL+[ only once and it really brought me back to NORMAL mode after some ...
1
vote
1answer
450 views

Is there a Vim like “Command Line Window” for Bash?

Is there something similar to Vim's "Command Line Window" for Bash where I can see/edit/execute items from the history? In Vim when I press : and then Ctrl-F it opens the window that shows the entire ...
5
votes
1answer
131 views

Going over start of insert action in Z shell vi-mode

Is it possible to configure the vi-mode of the Z shell so that backspace can delete characters before the position where the insert action was started? Basically the behavior of vim which can be ...
6
votes
1answer
6k views

What does CTRL+V do in vim?

In vim while in insert mode, if I press CTRL+V I'm thrown into what is known as x mode (^[,^D...) and when I press a key (the escape key for instance) I end up with ^[ or something else that starts ...
1
vote
1answer
383 views

Vim mode in FreeBSD shell?

How can I switch to Vim mode in FreeBSD shell? I echoed the value of $SHELL and it is /bin/csh however man csh opens tsch's manual page. set -o and shopts are not available as well. And /etc/...
1
vote
1answer
69 views

Is it possible to add ci" (or ci', ci{, etc.) to vi mode in bash?

As noted in this question, you cannot use the ci" (or ci', ci{, ci<, etc.) feature of vim in bash's vi-mode because this feature is from vim, not the original vi. However, is there a way to add ...
2
votes
0answers
150 views

inputrc GNU readline vi-insert mode mappings do not seem to take effect

I have set vi-mode in my ~/.inputrc. The command-mode keybinds seem to work fine whereas the insert-mode keybindings do not have any effect at all. Specifically, the following are my insert mode ...
6
votes
1answer
631 views

Bash + urxvt: delay after ESC in Vi mode

I have enabled the mode prompt indicator in my ~/.inputrc with set show-mode-in-prompt on. There is a delay of about half a second in the indicator when switching to normal mode after pressing ESC but ...
0
votes
0answers
72 views

Make GTK or KDE text fields be Vi-like?

Is there a way to make all GTK or KDE text fields Vi-like, akin to what set -o vi in ~/.bashrc does with the Bash shell?
4
votes
1answer
585 views

Make Bash's vi-mode default to “normal” Vi mode (not “insert”), and place cursor at start of line, mimicking KornShell

I'm trying to get Bash to mimic the behaviour of KornShell93 (ksh) when the shells are in Vi command line editing mode. KornShell defaults to "Vi normal mode" (a.k.a. "command" mode) and it also ...
1
vote
1answer
83 views

zsh vi mode: browse recent commands starting with

I've recently switched to vi-mode in my zsh and there is a feature from emacs-mode that I cannot find how to do in vi-mode. The feature is browsing history by lines starting by something I've already ...
1
vote
1answer
342 views

trigger vi mode key binding in normal mode only

I've created some custom key bindings for bash vi mode. They trigger while I'm in insert mode and I want them instead to trigger when I'm in normal mode. I'm using vi mode set -o vi in a terminal ...
4
votes
1answer
1k views

How to enable bash completion in vi mode on Synology DSM6

When I turned on vi mode in bash by setting set -o vi suddenly the tab completion was broken, and a literal tab was inserted. How can this be fixed?
2
votes
1answer
1k views

Pasting text in zsh in vi mode

I changed input mode in zsh to vi with set -o vi, but that created problems with pasting text. While trying to do cmd-v (MacOS) in the insert mode, zsh is pasting only a fraction of the clipboard ...
1
vote
0answers
14 views

Can I bind single keys in zsh when in vi normal mode? [duplicate]

I use urxvt with zsh and vi keys (bindkey -v). Is there a way to bind custom commands to single keys when in normal mode? For example, I'd like p to run xclip -o -sel clip and insert the result at the ...
1
vote
3answers
476 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 ...
29
votes
4answers
34k views

Vim - how to replace one new line \n with two \n's

In vim editor, I want to replace a newline character (\n) with two new line characters (\n\n) using vim command mode. Input file content: This is my first line. This is second line. Command that I ...
2
votes
1answer
47 views

Is it possible to use two characters (e.g. ^tm) in insert mode in zsh for a command binding?

in my current .zshrc file I have bindkey -M viins -s '^tm' '^[Iman ^[Ela ^[d$' and this doesn't work, however when I remove m from the shortcut and it is now only ^t the shortcut is working. I'd ...
1
vote
1answer
928 views

Setting backspace=2 in zsh with vi bindings

I just set my zsh to vi mode as I feel the word/WORD (w/b W/B) skip keybindings will help me work faster than plain ^a ^e in emacs binding mode. However, I'd like to set backspace=2 or set backspace=...
1
vote
0answers
115 views

Clear the terminal in “vi” mode? (equivalent of “ctrl+l” from “emacs” mode) [duplicate]

I am aware of Ctrl+L on bash terminal (using it on Ubuntu) which clears the screen by applying appropriate scrolling on bash terminal. After learning that the terminal is by default set to emacs mode ...
1
vote
1answer
47 views

vim color changing between | |

I'm editing some rst files. In the math section, the color changes between | |. Why is this so? How can I change my rst.vim file to not change color between | |? Thank you in advance.
4
votes
1answer
661 views

How to enable yank-nth-arg using vi mode on Bash?

Hey guys I'm trying to figure out how can I take my nth arg, from my last command, without using the !:nth. In a normal bash (emacs mode) I can do that using the follow shortcuts: <ESC>nth_arg &...
6
votes
1answer
174 views

How can I get back into “normal” edit-mode after pressing esc in zsh (vi mode)?

I'm using zsh in vi-mode. When I go to normal mode with ESC and then back into insert mode (for example using i, a or s), the line editor kind of "protects" the part of the line in front of the char, ...
1
vote
1answer
449 views

tcsh/vi-mode behavior difference between Solaris and Linux

We have both Solaris and Linux environments at work. We use tcsh as the standard shell for hundreds of users. My question is about vi-mode in tcsh: In Solaris, while I'm typing, I can backspace ...
2
votes
1answer
198 views

How to bind a key sequence to a widget in vi cmd mode zsh?

Let's say I want to bind R to redo in vicmd mode. This works. bindkey -a r redo If I change it to this, it does not work. bindkey -a rr redo I have tried different things with no success. Is this ...
6
votes
1answer
807 views

How can I configure ZSH's vi mode to persist the state between commands?

I am aware how to set ZSH's default line editor to use vi-like keybindings... bindkeys -v ...and even to default each new prompt to be in command mode instead of insert mod by default... zle-line-...
51
votes
2answers
14k views

Is there any way to enable Ctrl+L to clear screen when 'set -o vi' is set?

When you press Ctrl+L in bash default mode the screen is cleared. But when I run set -o vi and press Ctrl+L the keystroke is printed (^L). Is there any way to keep this behavior?
10
votes
1answer
3k views

bind key sequence to Escape, zsh

How would I map jj to Esc in zsh? I'm trying to recreate a key-mapping that I have setup in vim, where I have jj mapped to ESC so that whenever I double-press j, it sends the an <Esc> to vim--...
30
votes
2answers
20k views

What is meant by a shell is in “vi” mode or “emacs” mode?

This question follows directly from the answer. In this case I am specifically unable to understand the part which says: In that regard, its behaviour is closer to emacs' than with bash(readline)/...
5
votes
3answers
5k views

Running external commands in vim

It seems that if I run the following inside the vim: :w !wc -w I get the word count of the file. But I don't understand the syntax. How does this work and how would I specify that I want the ...
1
vote
1answer
527 views

Issues using sublime text to edit command line in VI mode

I am using the following to edit the current command line in Sublime Text 2 (using a working subl alias) .zshrc set -o vi EDITOR='subl'; export EDITOR bindkey -M vicmd v edit-command-line ...
24
votes
2answers
15k views

How to unset set -o vi?

I wanted to try vi mode in bash but now I would like to change it back to normal. How can I unset -o vi ?
5
votes
0answers
67 views

Change PS1 without hitting enter [duplicate]

Possible Duplicate: Change cursor shape (or color) to indicate vi mode in bash I am using vi-mode in a bash shell, and I would like to change the PS1 variable whenever I am in insert mode. When I ...
44
votes
2answers
17k views

How do I perform a reverse history search in ZSH's vi-mode?

I use vim for essentially all my editing needs, so I decided to once again try vi-mode for my shell (currently ZSH w/ oh-my-zsh on OS X), but I find myself trying (and failing) to use Ctrl-R ...