How to insert current date time in vscode?

前端 未结 7 1751
旧时难觅i
旧时难觅i 2020-12-24 01:27

Does anyone know of a way that I can insert the current date & time in a visual studio code by snippets?

I have looked docs but did not get any information abou

7条回答
  •  心在旅途
    2020-12-24 02:02

    if you don't want create a snippet, there is a simple way, using keybindings.

    open keybindings.json (Preferences: Open Keyboard Shortcuts (JSON)), and add fellow code to your keybindings.json

    [
        {
            "key": "cmd+k t",
            "command": "editor.action.insertSnippet",
            "when": "editorTextFocus",
            "args": {
                "snippet": "$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND"
            }
        }
    ]
    

    that's all.

    now you can use cmd+k t to insert current data time while typing.

提交回复
热议问题