VersionControl 这个好用 最主要的是可以显示当前代码和已经commit的代码的区别
例如
左边亮眼的原谅色显示了代码加了这几行
安装很简单
1 2 [[layers]] name = "VersionControl"
git git和VersionControl会有点冲突
看喜欢用哪个了
这默认的加号颜色也太……
不过这样看起来比较没有违和感倒是真的
同样的
1 2 [[layers]] name = "git"
快捷键
功能描述
SPC g s
打开 git status 窗口
SPC g S
stage 当前文件
SPC g U
unstage 当前文件
SPC g c
打开 git commit 窗口
SPC g p
执行 git push
SPC g d
打开 git diff 窗口
SPC g A
git add 所有文件
SPC g b
打开 git blame 窗口
SPC g h a
stage current hunk
SPC g h r
undo cursor hunk
SPC g h v
preview cursor hunk
Chinese 中文插件
1 2 3 4 5 vim_help_language = "cn" [[layers]] name = "chinese"
Cscope 主要用来看函数定义
安装依赖
apt install cscope cscope-el
neovim命令模式下
:echo has("cscope")
如果输出1
就是已经有了支持
1 2 [[layers]] name = "cscope"
快捷键
功能描述
SPC m c =
Find assignments to this symbol
SPC m c i
建立当前项目 cscope 索引
SPC m c u
更新所有项目 cscope 索引
SPC m c c
列出某个方法调用的所有函数
SPC m c C
列出某个方法被哪些函数调用
SPC m c d
查询 symbol 的定义处
SPC m c r
查询 symbol 的引用
SPC m c f
搜索文件
SPC m c F
列出 include 某个文件的所有文件
SPC m c e
搜索正则表达式
SPC m c t
搜索文本
C/C++ Python 配置 参考:
安装依赖:
apt install -y clang libclang-dev clang-tools-8 && update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-8 100
apt install clang-format
pip install flake8 isort yapf autoflake coverage
看看自己的clang是什么版本
clang -v
然后pip安装对应版本的clang
pip install clang==x.x.x
配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 [[layers]] name = "lang#c" enable_clang_syntax_highlight = true clang_executable = "/usr/bin/clang" libclang_path = "/usr/lib/llvm-3.8/lib/" [layer.clang_std] c = "c11" cpp = "c++1z" objc = "c11" objcpp = "c++1z" [[layers]] name = "format" [[layers]] name = "lsp" filetypes = [ "c" , "cpp" ] [layers.override_cmd] c = ["clangd" ] [[layers]] name = "lang#python" format_on_save = 1 python_file_head = [ '#!/usr/bin/env python' , '# -*- coding: utf-8 -*-' , '' , '' ]
重启neovim自动安装
cd ~/.cache/vimfiles/repos/github.com/autozimu/LanguageClient-neovim
bash install.sh
参考:
ubuntu 1604 需要编译安装 ubuntu >= 1804 直接 apt 安装即可
sudo apt install global
or
1 2 3 4 5 6 tar xvf global-6.6.x.tar.gz cd global-6.6.x ./configure --with-exuberant-ctags=/usr/bin/ctags make sudo make install cp gtags.conf ~/.globalrc
然后安装这两个包
sudo apt-get install exuberant-ctags python-pygments
配置环境变量
echo export GTAGSLABEL=ctags >> ~/.profile
在 init.toml 中加入
1 2 3 4 5 [[layers]] name = "tags" [[layers]] name = "gtags" gtagslabel = "ctags"
快捷键
快捷键
功能描述
SPC m g c
新建 tag 数据库
SPC m g u
手动更新 tag 数据库
SPC m g f
列出数据库中所涉及到的文件
SPC m g d
查找 definitions
SPC m g r
查找 references
返回用 vim 自带的 ctrl+o 即可
更新后的配置文件 ~/.SpaceVim.d/init.toml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 [options] colorscheme = "molokai" colorscheme_bg = "dark" enable_guicolors = true statusline_separator = "arrow" statusline_inactive_separator = "arrow" buffer_index_type = 4 enable_tabline_filetype_icon = true enable_statusline_mode = true filemanager = "defx" filetree_direction = "left" bootstrap_before = "myspacevim#before" vim_help_language = "cn" [[layers]] name = 'autocomplete' auto-completion-return-key-behavior = "complete" auto-completion-tab-key-behavior = "smart" [[layers]] name = 'shell' default_position = 'bottom' default_height = 30 [[layers]] name = "colorscheme" [[layers]] name = "denite" [[layers]] name = "chinese" [[layers]] name = "cscope" [[layers]] name = "tags" [[layers]] name = "gtags" gtagslabel = "ctags" [[layers]] name = "git" [[layers]] name = "lang#c" enable_clang_syntax_highlight = true clang_executable = "/usr/bin/clang" libclang_path = "/usr/lib/llvm-x.x.x/lib/" [layer.clang_std] c = "c11" cpp = "c++1z" objc = "c11" objcpp = "c++1z" [[layers]] name = "lang#go" [[layers]] name = "format" [[layers]] name = "lsp" filetypes = [ "c" , "cpp" ] [layers.override_cmd] c = ["clangd" ] [[layers]] name = "lang#python" format_on_save = 0 python_file_head = [ '#!/usr/bin/env python' , '# -*- coding: utf-8 -*-' , '' , '' ] [[layers]] name = "debug" [[custom_plugins]] name = "Shougo/deoplete.nvim" merged = false [[custom_plugins]] name = "tbodt/deoplete-tabnine" merged = false [[custom_plugins]] name = "vim-python/python-syntax" merged = false [[custom_plugins]] name = "sebdah/vim-delve"
~/.SpaceVim.d/autoload/myspacevim.vim
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 function! myspacevim #before() abort let g:deoplete #enable_at_startup = 1 vnoremap <C-X> vnoremap <S-Del> vnoremap <C-C> vnoremap <C-Insert> let g:python_highlight_all = 1 augroup fmt autocmd! autocmd BufWritePre * undojoin | Neoformat augroup END endfunction
~/.clang-format
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 BasedOnStyle: Google Language: Cpp ColumnLimit: 80 IndentWidth: 4 TabWidth: 4 UseTab: Never IndentCaseLabels: true BreakBeforeBraces: Attach AlignEscapedNewlinesLeft: false AllowShortFunctionsOnASingleLine: false AlignTrailingComments: true SpacesBeforeTrailingComments: 2 PenaltyReturnTypeOnItsOwnLine: 200 AllowAllParametersOfDeclarationOnNextLine: false AllowShortIfStatementsOnASingleLine: false AllowShortLoopsOnASingleLine: false BinPackParameters: false BreakBeforeBinaryOperators: true BreakBeforeTernaryOperators: true ContinuationIndentWidth: 4