Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

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
2 votes
0 answers
49 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 ...
user avatar
  • 327
2 votes
2 answers
121 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 ...
user avatar
2 votes
1 answer
138 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 ...
user avatar
0 votes
1 answer
55 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 ?
user avatar
0 votes
0 answers
16 views

Bash-vi-mode "Replace Mode" prompt differentiation

So, I have this set into my .inputrc: set show-mode-in-prompt on set vi-cmd-mode-string "\1\e[1;48;5;032;38;5;237m\2 NOR \1\e[48;5;012;38;5;032m\2\1\e[0m\2" set vi-ins-mode-string "\1\...
user avatar
0 votes
1 answer
65 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 ...
user avatar
  • 423
3 votes
1 answer
96 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 ?
user avatar
1 vote
0 answers
168 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 ...
user avatar
0 votes
0 answers
94 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 ...
user avatar
  • 1
7 votes
2 answers
167 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 ...
user avatar
  • 165
3 votes
1 answer
3k 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 ...
user avatar
5 votes
1 answer
491 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 ...
user avatar
  • 231
0 votes
1 answer
71 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 ...
user avatar
  • 123
1 vote
0 answers
23 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 ...
user avatar
  • 260
2 votes
1 answer
2k 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 ...
user avatar
2 votes
1 answer
87 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 ...
user avatar
  • 406
3 votes
1 answer
914 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 ...
user avatar
  • 22.5k
-1 votes
2 answers
812 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 ...
user avatar
  • 22.5k
1 vote
0 answers
144 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() { ...
user avatar
  • 2,341
0 votes
1 answer
97 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 ...
user avatar
  • 1,151
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 ...
user avatar
  • 4,851
7 votes
1 answer
455 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 ...
user avatar
  • 2,274
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
190 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 ...
user avatar
  • 121
2 votes
0 answers
265 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 ...
user avatar
14 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 ...
user avatar
0 votes
0 answers
99 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?
user avatar
  • 1,072
6 votes
1 answer
3k 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 ...
user avatar
  • 268k
2 votes
1 answer
207 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 ...
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 ...
user avatar
8 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?
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 ...
user avatar
1 vote
0 answers
24 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 ...
user avatar
  • 1,273
2 votes
3 answers
1k 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 ...
user avatar
62 votes
5 answers
94k 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 ...
user avatar
2 votes
1 answer
168 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 ...
user avatar
  • 185
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=...
user avatar
  • 1,934
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 ...
user avatar
1 vote
1 answer
60 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.
user avatar
4 votes
1 answer
957 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 &...
user avatar
  • 919
7 votes
1 answer
305 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, ...
user avatar
  • 988
1 vote
1 answer
542 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 ...
user avatar
  • 127
2 votes
1 answer
396 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 ...
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-...
user avatar
  • 65.9k
66 votes
2 answers
21k 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?
user avatar
13 votes
1 answer
6k 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--...
user avatar
35 votes
2 answers
25k 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)/...
user avatar
  • 6,088
6 votes
3 answers
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 ...
user avatar
  • 479
1 vote
1 answer
604 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 ...
user avatar
29 votes
2 answers
19k 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 ?
user avatar
  • 12.1k