1

How to get vim keybindings at terminal output so I can navigate/operate at terminal output like in vim or get smooth shell command processing in vim. For example I type:

ifconfig

an i want to make moves to ipaddres location, then copy it and paste into command line.

I already know solution inside VIM like:

read ! ifconfig

but it I am looking for more persistent solution that will work smoothly for a long run.

  • 2
    I'm voting to close this question as off-topic because it is not about vi/vim but asking for vim-like features in other apps. – jecxjo May 22 '18 at 18:19
1

one way is to simply issue terminal ifconfig (vim8 or vim7 with a lot of patches).

This will open a vim-buffer with the result.

1

How about using the Vi-mode in your terminal. You can do something like this:

set editing-mode vi
set keymap vi-command

You can further customize keybindings, as described in this article: http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal

Another way would be to probably pipe it out to something like "less" and then use a tool similar to vim-less: https://github.com/groenewege/vim-less

1

With tmux (terminal multiplexer) you can do select/copy/paste of terminal screen contents using Vim commands. When you're in a tmux session run your command(s) outputting to terminal (stdout). Then hit "prefix" + [ to get in "copy mode". From there you can navigate with Vim commands like Ctrl-U, optionally select some text using Visual mode and yank with commands like y. Quit copy mode and you can paste anywhere in the tmux session (with "prefix" + ]).

Note: "prefix" is a special keystroke used to initiate most tmux commands. It is Ctrl-B by default but configurable.

Not the answer you're looking for? Browse other questions tagged or ask your own question.