vscode 设置关键字高亮显示

  1. 下载highlight-words插件
  2. settings.json文件中添加以下代码
    路径:(文件>首选项>设置>打开设置(json) 图标在右上角)
 "highlightwords.colors": [
        { "light": "#b3d9ff", "dark": "cyan" },
        { "light": "#e6ffb3", "dark": "pink" },
        { "light": "#b3b3ff", "dark": "lightgreen" },
        { "light": "#ffd9b3", "dark": "magenta" },
        { "light": "#ffb3ff", "dark": "cornflowerblue" },
        { "light": "#b3ffb3", "dark": "orange" },
        { "light": "#ffff80", "dark": "green" },
        { "light": "#d1e0e0", "dark": "red" }                                        
        
    ],
    "highlightwords.box": {
        "light": false,
        "dark": true
    },
    "highlightwords.defaultMode": {
        "default": 0
    },   
    "highlightwords.showSidebar": {
        "default": true
    }
  1. ctrl+shift+p打开命令窗口,搜索Highlight Toggle Current命令,此命令可高亮选中的单词。其他命令见插件简介usage部分。
  2. 设置高亮快捷键,点击命令窗口Highlight Toggle Current右侧齿轮,添加快捷键如 ctrl+F8,点击回车保存之后可以使用此快捷键高亮显示或取消高亮

PS:settings.json还可设置vscode背景,更改代码字体颜色,调整关键字变量函数宏全局变量等字体和颜色。

{
    

    "editor.fontSize": 16,
    "editor.mouseWheelZoom": true,
    "editor.tabSize": 2,
    "editor.tokenColorCustomizations": {
        // "keywords": "#ffffff",
        // "variables": "#079c2c",
        // "functions": "#07853b",
        "strings": "#bb0808",
         "numbers": "#ee1313",
        "comments": "#b5098a",
        "types": "#0517da"
    },

    "editor.semanticTokenColorCustomizations": {
        "enabled": true, // enable for all themes
        "rules": {
            // "*.static": {
            //     "foreground": "#ff09f3",
            //     "fontStyle": "bold"
            // },
            "property": {   //属性
                "foreground": "#737d04",
                "fontStyle": "bold"
            },
            "macro": {      //宏
                "foreground": "#ed2700",
                "fontStyle": "bold"
            },
            "function": {   //函数
                "foreground": "#007c4a",
                "fontStyle": "italic bold"
            },
            "variable.global": { //全局变量
                "foreground": "#870082",
                "fontStyle": "bold"
            },
            "variable.local": { //局部变量
                "foreground": "#038b4b",
                "fontStyle": "bold"
            },
        }
    },

    "workbench.colorCustomizations": {
        // 写在 Atom One Light  里面则只对该主题有效
        // "[Sea Green Theme]": 
        // {
            "editor.background": "#c5f3cb",  
            "sideBar.background": "#b8e4be",
            "activityBar.background": "#9cce9c", 
            // 终端前景背景色
            "terminal.foreground" : "#141416",
            "terminal.background" : "#a0ecd9",
  
            "editorIndentGuide.activeBackground":"#9ba4af",
            "editorBracketMatch.background": "#ff8a05a9",
            "editorBracketMatch.border": "#ff0000",
            "tab.activeBackground": "#c0d9f070",

            "titleBar.activeBackground": "#839eb870",

            //"editor.selectionHighlightBorder": "#94767c00",
            "editor.selectionHighlightBackground": "#fcde8d81",
           "editor.selectionBackground": "#00f853",//选中
           //"editor.selectionBackground": "#ff3232a9",//选中
            "editor.selectionForeground": "#3b58ff",
            "editor.lineHighlightBackground": "#5ff7a6b5",//光标所在行
            "editor.foldBackground": "#9ebfffcd",//折叠背景色
            
        // },
        "editorLineNumber.foreground": "#f19012",
       
    },
    "workbench.statusBar.feedback.visible": false,
    "workbench.colorTheme": "GitHub Light Colorblind (Beta)",
    "workbench.iconTheme": "eq-material-theme-icons-ocean",
    "workbench.startupEditor": "newUntitledFile",
    "cmake.configureOnOpen": true,

    

    "highlightwords.colors": [
        { "light": "#eeff00", "dark": "cyan" },
        { "light": "#15ffdc", "dark": "pink" },
        { "light": "#55ff2b", "dark": "lightgreen" },
        { "light": "#ef75ff", "dark": "magenta" },
        { "light": "#ffc675e6", "dark": "cornflowerblue" },
        { "light": "#dfff75da", "dark": "orange" },
        { "light": "#6ffffde9", "dark": "green" },
        { "light": "#6fadffcc", "dark": "red" }                                        
        
    ],
    "highlightwords.box": {
        "light": false,
        "dark": true
    },
    "highlightwords.defaultMode": {
        "default": 0
    },
    
    "highlightwords.showSidebar": {
        "default": true
    }

   
}

你可能感兴趣的:(其他,vscode,ide,编辑器)