Questions tagged [vi-mode]

Theses questions are about GNU Readline's vi mode providing vi-like commands inside your terminal. Use this tag for questions about configuring or operating vi mode (e.g., Bash integration, setting keybindings).

Filter by
Sorted by
Tagged with
0 votes
0 answers
26 views

vi command line edit mode - an odd observation

This is not a real problem, but something that I'm curious about - and maybe somebody knows the explanation. I work on several servers, mostly Ubuntu 20.04 and 22.04, plus a few Debian 11. I always ...
j4nd3r53n's user avatar
  • 685
1 vote
1 answer
225 views

Colorful cursor to indicate vi mode in zsh, but fail to reset color

I am trying to have cursor color in zsh to indicate normal/insert mode, but once enter normal mode, the color of cursor don't reset to default color in insert mode. The source are: # color cursor zle-...
Solarisending's user avatar
1 vote
1 answer
85 views

Anyway to bind keyboard to dash (Debian Almquist Shell)?

Specifically Up/Down for history navigation. What I already know I understand dash is a minimalistic, no bloat, (somewhat) strict POSIX shell. I understand the philosophy behind it, and the reason ...
Lockszmith's user avatar
1 vote
1 answer
14 views

Is it possible to make readline ignore compspec when expanding matches in VI mode?

I use VI mode when using bash and I sometimes find that some of the standard compspec definitions don't do what I want. For example, java doesn't appear to know that you have been able to do java ...
Mark W's user avatar
  • 143
2 votes
1 answer
110 views

Zsh goes into command mode on unbound key

I like vi mode in Zsh, set with bindkey -v. Pressing escape triggers command mode as it should, but it irks me that unbound keychords trigger command mode, for example, Alt+1 and F1. Any way to stop ...
geb's user avatar
  • 83
2 votes
0 answers
373 views

How to paste selection from vi-mode to clipboard

I want to access the content of what I copied in the buffer with the vi-mode of the clipboard via the command ctrl + v or ctrl + shift + v in the terminal. I copied in my .zshrc the following: (from ...
ecjb's user avatar
  • 403
3 votes
2 answers
889 views

How to use `Alt + .` in zsh with Vim bindings

I am using zsh with bindkeys -v. Alt + . does not work as expected. It seems to repeat what is currently typed in stdin, but not entered, on the next line. This post seems to imply it does work as it ...
mcp's user avatar
  • 687
3 votes
1 answer
344 views

Fish shell vi-mode is missing "repeat" command (dot/period/. key in Zsh)

I recently moved from Zsh to Fish, and I'm having a problem with vi-mode in Fish. There doesn't seem to be a "repeat" keybinding, like in Zsh's vi-mode (bound to the "dot" .). I ...
Reynald Lamury's user avatar
1 vote
1 answer
458 views

How to have gdb start in vi mode by default?

I know that I can use CTRL+ALT+J in gdb to get vim keybindings but how do I get gdb to start in vi mode by default ?
cassepipe's user avatar
  • 180
0 votes
1 answer
156 views

assign letters to jump forward and backward in bash

My default shell is tcsh. In my .cshrc file. I have bindkey -v, so that at the command line, the letters b and w jump backwards and forwards a word, respectively. I'd like to set up bash so that ...
Leo Simon's user avatar
  • 453
3 votes
1 answer
321 views

Make one normal mode command while in insert mode in zsh's vi mode

Zsh vi mode doesn't have ctrl-o behavior set by default how do I get to work like in vim ?
Hazem Elmahy's user avatar
1 vote
0 answers
381 views

Seeking alternative to KeyNav(drive mouse with keyboard, for X)

as described in the title, I am seeking user-friendly alternatives to KeyNav. I am a fan of CLI&TUI applications and stay on the terminal emulator most of the time, where I can use the keyboard to ...
hehelego's user avatar
0 votes
0 answers
411 views

Using vim keybindings in bash, is there a way to start in Normal mode?

I just started using the vim key bindings in my bash terminal because I was constantly switching between the two and I just want to stick with one editing mode. Hence, I added the line bash set -o vi ...
aja228's user avatar
  • 31
7 votes
2 answers
269 views

Insert the last argument in bash in vi mode without inserting a leading space

Using bash in the default (emacs) mode I get the following behavior when I hit Esc, .. $ echo hello hello $ hello # I hit `<ESC>.` to insert this Note there is no space before the word hello ...
mike's user avatar
  • 165
3 votes
1 answer
7k views

Vim Mode copy-paste not working on Tmux

I am new at using Tmux. I have seen that it is quite difficult to copy-paste inside Tmux. So I searched for an easier method. Some sites suggested that I should use vim mode as I am quite familiar ...
Merajul Arefin Pial's user avatar
6 votes
1 answer
1k views

How to configure the buffer used by vi-mode bash for yank and paste?

tldr: Does anyone know how to configure what buffer is used by vi-mode bash for yanking (copying) and pasting? Long version: I have set editing-mode vi in my .inputrc, so that programs using the ...
ummg's user avatar
  • 261
0 votes
1 answer
223 views

bash terminal history search in vi mode

I would like to be able to type pi [up-arrow] and have bash automatically go to previous command that started with pi for example ping -c 4 8.8.8.8 in vi mode I can get emacs mode to do this after I ...
posop's user avatar
  • 123
1 vote
0 answers
55 views

Why does no longer work stty shortcut after vi-mode?

If I do set -o vi in bash or ~/.bashrc, then no longer works shortcut such as werase = ^W or discard = ^O (from stty -a) or the one to delet to the end of line, triggered with ^K. However some of them ...
Herdsman's user avatar
  • 330
3 votes
1 answer
4k views

Using vim mappings in normal :terminal mode

I'm using vim and configured :terminal with bash and vi-mode. To do that I've configured .inputrc config from: https://vim.fandom.com/wiki/Use_vi_shortcuts_in_terminal. I've noticed that my ...
Pankracy's user avatar
2 votes
1 answer
104 views

how to detect state of bash readline using bash script?

for example; if [ 'readline is vi-command' ]; then echo 'normal mode' else echo 'insert mode' fi I really don't have any idea how to do this and I can't seem to find anything on the man pages ...
cevhyruz's user avatar
  • 437
4 votes
1 answer
1k 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 ...
Evan Carroll's user avatar
  • 30.4k
0 votes
2 answers
980 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 ...
Evan Carroll's user avatar
  • 30.4k
1 vote
0 answers
286 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() { ...
Jan Warchoł's user avatar
  • 3,051
0 votes
1 answer
237 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 ...
ka3ak's user avatar
  • 1,255
1 vote
2 answers
1k 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 ...
laktak's user avatar
  • 5,866
8 votes
1 answer
628 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 ...
viuser's user avatar
  • 2,614
1 vote
1 answer
1k 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/...
user avatar
2 votes
1 answer
274 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 ...
Anomaly's user avatar
  • 121
2 votes
0 answers
383 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 ...
Dr Krishnakumar Gopalakrishnan's user avatar
15 votes
1 answer
2k 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 ...
ramblenode's user avatar
1 vote
0 answers
132 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?
Geremia's user avatar
  • 1,183
6 votes
1 answer
4k 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 ...
Kusalananda's user avatar
  • 331k
2 votes
1 answer
257 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 ...
adam's user avatar
  • 123
1 vote
1 answer
1k 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 ...
user3751385's user avatar
9 votes
1 answer
2k 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?
Gerhard Burger's user avatar
2 votes
1 answer
2k 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 ...
Anton Tarasenko's user avatar
1 vote
0 answers
26 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 ...
danijar's user avatar
  • 1,463
2 votes
3 answers
2k 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 ...
Raghvendra's user avatar
  • 1,062
78 votes
5 answers
112k views

Why does '\r' (and not '\n') work to replace with a newline in 'vim'?

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 ...
Raghvendra's user avatar
  • 1,062
2 votes
1 answer
353 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 ...
Jakub's user avatar
  • 195
2 votes
1 answer
1k 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=...
Jules's user avatar
  • 2,084
3 votes
0 answers
1k 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 ...
Loves Probability's user avatar
1 vote
1 answer
61 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.
kirikoumath's user avatar
4 votes
1 answer
1k 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 &...
MaikoID's user avatar
  • 969
7 votes
1 answer
524 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, ...
groxxda's user avatar
  • 1,028
1 vote
1 answer
585 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 ...
Bjorn's user avatar
  • 127
2 votes
1 answer
519 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 ...
noctuid's user avatar
  • 153
7 votes
1 answer
1k 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-...
Caleb's user avatar
  • 70k
72 votes
2 answers
24k 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?
David Martínez's user avatar
13 votes
1 answer
8k 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--...
Alexej Magura's user avatar