编辑器配置 vscode / Sublime Text

vscode配置

vscode技巧和常用插件: https://www.jianshu.com/p/402a9dddc2ab

颜色主题:Monokai

https://code.visualstudio.com/docs/languages/cpp

c++配置

https://www.zhihu.com/question/30315894/answer/154979413

扩展项:C/C++, C++ Intellisense

.vscode目录下配置文件c_cpp_properties.json, launch.json,tasks.json

F5编译运行,防止窗口直接退出:http://www.cnblogs.com/islety/p/9771782.html

Ctrl + shift + B:编译

F10:查看定义

Ctrl + /:注释或取消注释

 

以下个人配置

c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "macFrameworkPath": [
                "/System/Library/Frameworks",
                "/Library/Frameworks"
            ]
        },
        {
            "name": "Linux",
            "includePath": [
                "/usr/include",
                "/usr/local/include",
                "${workspaceRoot}"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/usr/include",
                    "/usr/local/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
        {
            "name": "Win32",
            "includePath": [
                "C:/Program Files (x86)/MinGW/include",
                "C:/Program Files (x86)/MinGW/lib/gcc/mingw32/4.9.2/include",
                "${workspaceRoot}"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE"
            ],
            "intelliSenseMode": "msvc-x64",
            "browse": {
                "path": [
                    "C:/Program Files (x86)/MinGW/include",
                    "C:/Program Files (x86)/MinGW/lib/gcc/mingw32/4.9.2/include",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "cStandard": "c11",
            "cppStandard": "c++17"
        },
        {
            "name": "VS",
            "intelliSenseMode": "msvc-x64",
            "compilerPath": "C:/Program Files (x86)/MinGW/bin/g++.exe",
            "includePath": [
                "D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
                "D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/atlmfc/include/*",
                "C:/Program Files (x86)/Windows Kits/8.1/Include/um",
                "C:/Program Files (x86)/Windows Kits/8.1/Include/shared",
                "C:/Program Files (x86)/Windows Kits/8.1/Include/winrt",
                "${workspaceFolder}"
            ],
            "defines": [],
            "browse": {
                "path": [
                    "D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
                    "D:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/atlmfc/include/*",
                    "C:/Program Files (x86)/Windows Kits/8.1/Include/um",
                    "C:/Program Files (x86)/Windows Kits/8.1/Include/shared",
                    "C:/Program Files (x86)/Windows Kits/8.1/Include/winrt",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            },
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}
View Code

launch.json

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/${fileBasenameNoExtension}.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": true,    
            "MIMode": "gdb",
            "miDebuggerPath": "C:\\Program Files (x86)\\MinGW\\bin\\gdb.exe",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": false
                }
            ],
            "preLaunchTask": "Compile"
        }
    ]
}
View Code

tasks.json

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Compile", // 任务名称,与launch.json的preLaunchTask相对应
            "command": "g++", // 要使用的编译器
            "args": [
                "${file}",
                "-o", // 指定输出文件名,不加该参数则默认输出a.exe
                "${fileDirname}/${fileBasenameNoExtension}.exe",
                "-g", // 生成和调试有关的信息
                "-Wall", // 开启额外警告
                "-static-libgcc", // 静态链接
                "-std=c++14", // C语言最新标准为c11,或根据自己的需要进行修改
            ], // 编译命令参数
            "type": "shell",
            "group": {
                "kind": "build",
                "isDefault": true // 设为false可做到一个tasks.json配置多个编译指令,需要自己修改本文件,我这里不多提
            },
            "presentation": {
                "echo": true,
                "reveal": "always", // 在“终端”中显示编译信息的策略,可以为always,silent,never。具体参见VSC的文档
                "focus": false, // 设为true后可以使执行task时焦点聚集在终端,但对编译c和c++来说,设为true没有意义
                "panel": "shared" // 不同的文件的编译信息共享一个终端面板
            }
            // "problemMatcher":"$gcc" // 如果你不使用clang,去掉前面的注释符,并在上一条之后加个逗号。照着我的教程做的不需要改(也可以把这行删去)
        }
    ]
}
View Code

 

 Go配置

https://www.liwenzhou.com/posts/Go/00_go_in_vscode/

ubuntu下的Go环境搭建:

中文版 https://go-zh.org/doc/

英文版 https://golang.google.cn/doc/

Go项目搭建

https://www.cnblogs.com/myseochina/p/6671088.html

http://docs.studygolang.com/doc/code.html#Workspaces

======================================================================================================================

 

本想找个Win下的markdown编辑环境,广而杂,选择了Sublime,安装完插件后,输入markdown文本内容,alt + M 浏览器预览。

sublime配置:http://blog.csdn.net/qwb492859377/article/details/50906823

参考后的Build System

{  
    "encoding": "utf-8",  
    "working_dir": "$file_path",  
    "shell_cmd": "g++ -Wall -std=c++11 \"$file_name\" -o \"$file_base_name\"",  
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",  
    "selector": "source.c++",  
   
    "variants":   
    [  
        {     
        "name": "Run Normal",  
            "shell_cmd": "start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""  
        },  
        {     
        "name": "Build And Run",  
            "shell_cmd": "g++ -Wall -std=c++11 \"$file\" -o \"$file_base_name\" -O2 && start cmd /c \"\"${file_path}/${file_base_name}\" & pause\""  
        }  
    ]  
}  
View Code

将上述代码命名为G++.sublime-build后,退出sublime重进,选择Build System选项选择G++,则ctrl+shfit+B跳出配置,一个编译,一个运行,还有一个编译并运行。ctrl+B以上次的选项进行操作。

备用sublime学习链接:

http://www.jianshu.com/p/d1b9a64e2e37

https://www.zybuluo.com/king/note/47271

posted @ 2017-08-15 19:18  我在地狱  阅读(1192)  评论(0编辑  收藏  举报