Date 将读入日期的结果保存到vim脚本中的变量
有没有办法将读取当前日期的结果保存到可在脚本中使用的变量中? 所以我可以通过以下方式成功读取当前日期:Date 将读入日期的结果保存到vim脚本中的变量,date,variables,vim,Date,Variables,Vim,有没有办法将读取当前日期的结果保存到可在脚本中使用的变量中? 所以我可以通过以下方式成功读取当前日期: :r!date "+\%F" 返回: 2018-03-28 现在,我希望能够将这个2018-03-28保存到一个变量中,以便稍后在脚本中使用 提前感谢您可以使用:help systemlist(): 或者结合使用:help localtime()和:help strftime(): let now = systemlist('date "+%F"')[0] let now = strfti
:r!date "+\%F"
返回:
2018-03-28
现在,我希望能够将这个2018-03-28保存到一个变量中,以便稍后在脚本中使用
提前感谢您可以使用
:help systemlist()
:
或者结合使用:help localtime()
和:help strftime()
:
let now = systemlist('date "+%F"')[0]
let now = strftime("%F", localtime())