Answer the question
In order to leave comments, you need to log in
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
>>> 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]
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 questionAsk a Question
731 491 924 answers to any question