当前位置: 首页 > 工具软件 > SpaceVim > 使用案例 >

SpaceVim C++开发环境

曾丰茂
2023-12-01

以前都是使用vscode远程开发,但是经常涉及到工作目录的切换且经常打开7,8个vscode,非常占资源,所以考虑使用vim+ycm+clangd+lsp来搭建一个类似vscode的可视化编程工具,这种搭建方式有空了再写,偶然间有看到spacevim,基本属于开箱即用的东西

SPACE 主页 主页 | SpaceVim, 既有中文也有英文

安装:

参考网站中的安装方式即可

配置

因为我使用了clang+llvm+cmake 的compile_commands.json的编译方式,所以使用了lsp和ycm的代码高亮,自动补全功能,且支持跳转

贴上我的配置文件

# All SpaceVim option below [option] section
[options]
    # set spacevim theme. by default colorscheme layer is not loaded,
    # if you want to use more colorscheme, please load the colorscheme
    # layer
    colorscheme = "dracula"
    colorscheme_bg = "dark"
    # Disable guicolors in basic mode, many terminal do not support 24bit
    # true colors
    enable_guicolors = false
    # Disable statusline separator, if you want to use other value, please
    # install nerd fonts
    statusline_separator = "nil"
    statusline_iseparator = "bar"
    buffer_index_type = 4
    windows_index_type = 3
    enable_tabline_filetype_icon = false
    enable_statusline_mode = false
    statusline_unicode = false
    # Enable vim compatible mode, avoid changing origin vim key bindings
    vimcompatible = true
    default_indent = 4

# Enable autocomplete layer
[[layers]]
name = 'autocomplete'
autocomplete_method = 'ycm'
auto_completion_return_key_behavior = "complete"
auto_completion_tab_key_behavior = "cycle"

[[layers]]
name = 'shell'
default_position = 'top'
default_height = 30

[[layers]]
        name = "lsp"
        filetypes = ["c", "cpp"]
        [layers.override_cmd]
                c = ["clangd", "--limit-results=5"]
                cpp = ["clangd", "--limit-results=5"]

[[layers]]
        name = 'lang#c'
        clang_executable = "clang"
        enable_clang_syntax_hightlight = true
        [layer.clang_std]
                c = "c11"
                cpp = "c++1z"
                objc = "c11"
                objcpp = "c++1z"

 类似资料: