let username = input('Enter username: ')
let passw = input('Enter password: ')
在vim输入字段上输入密码时,不应显示密码(或应显示*******之类的内容)。我如何实现这一目标?
答案 0 :(得分:2)
您可以尝试使用inputsecret()
功能:
let username = inputsecret('Enter username: ')
let passw = inputsecret('Enter password: ')
来自:h inputsecret(
的函数说明:
inputsecret({prompt} [, {text}]) *inputsecret()*
This function acts much like the |input()| function with but
two exceptions:
a) the user's response will be displayed as a sequence of
asterisks ("*") thereby keeping the entry secret, and
b) the user's response will not be recorded on the input
|history| stack.
The result is a String, which is whatever the user actually
typed on the command-line in response to the issued prompt.
NOTE: Command-line completion is not supported.