yzhang-gh / vscode-markdown

Markdown All in One
https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one
MIT License
2.91k stars 324 forks source link

apply shortcuts to Rmarkdown #1172

Closed kongdd closed 2 years ago

kongdd commented 2 years ago

Do you have idea how to apply shortcuts to Rmarkdown files? Thank you very much! https://rmarkdown.rstudio.com/

kongdd commented 2 years ago

Can vscode-markdown export the function styleByWrapping as an command? In this way, users can define other shortcuts by themselves.

kongdd commented 2 years ago

solved by markdown.extension.editing._wrapBy.

{
        "key": "ctrl+b",
        "command": "markdown.extension.editing._wrapBy", 
        "when": "editorLangId == 'rmd' || editorLangId == 'qmd' || editorLangId == 'markdown'",
        "args": {
            "before": "**", 
            "after": "**"
        }
    },
    {
        "key": "ctrl+i",
        "command": "markdown.extension.editing._wrapBy", 
        "when": "editorLangId == 'rmd' || editorLangId == 'qmd' || editorLangId == 'markdown'",
        "args": {
            "before": "*", 
            "after": "*"
        }
    },
    {
        "key": "ctrl+u",
        "command": "markdown.extension.editing._wrapBy", 
        "when": "editorLangId == 'rmd' || editorLangId == 'qmd' || editorLangId == 'markdown'",
        "args": {
            "before": "<u>", 
            "after": "</u>"
        }
    },

Thanks