S
S
Sergey Burduzha2017-12-15 12:07:47
Python
Sergey Burduzha, 2017-12-15 12:07:47

How to use hotkeys from vim in bash terminal?

Before that, I used zsh, there I registered bindkey -v in .zshrc, I probably don’t remember exactly. And in bash, how to use vim hotkeys?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
sim3x, 2019-10-04
@sim3x

.replace

F
Forevka69, 2019-10-04
@Forevka69

>>> units = {"k":1000,"m":1000000}

>>> num=["11.4k" , "550" , "1.23m" , "30"]

>>> result=[]

>>> for n in num:
...         try:
...             result.append( float(n) )  #try to comber it to a number
...         except ValueError:
...             unit=n[-1]                 #get the letter
...             n = float( n[:-1] )        #convert all but the letter
...             result.append( n * units[unit] )

>>> result
[11400.0, 550.0, 1230000.0, 30.0]

But it's better to use Decimal who knows what size the number will be

O
Oleg, 2017-12-15
@hobo-mts

READLINE
This is the library that handles reading input when using an interactive shell, unless the --noediting option is given at shell invocation. Line is also used when using the -e option to the read builtin. By default, the line editing commands are similar to those of emacs. A vi-style line interface is also available. Line can be enabled at any time using editing the -o emacs or -o vi options to the set builtin (see SHELL BUILTIN below). To turn off line editing after the shell is running, use the +o emacs or +o vi options to the set builtin.
In this case, at the beginning of editing there will be an insert mode. To go to normal -- ESC

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question