vim + youcompleteme + vimspector

vim + youcompleteme + vimspector

#gcc 版本切换
sudo update-alternatives --config gcc

Your C++ compiler does NOT fully support C++17.

sudo apt install build-essential
sudo apt-get install g+±8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g+±7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g+±8

pip3 install pathtools
pip install pathtools

cd ~/.vim/plugged/YouCompleteMe
python3 install.py --clangd-completer

Plug “ycm-core/YouCompleteMe”
" ===
" === youcompleteme 对nvim支持不完整 nvim推荐coc.nvim
" ===
".ycm_extra_conf.py 是否提示加载1确认 0不需要确认
let g:ycm_confirm_extra_conf = 0

" 除/Documents/目录之外拒绝加载/目录内的.ycm_extra_conf.py文件
" 在例表前面的优先级高
let g:ycm_extra_conf_globlist = [’/Documents/*’,’!/*’]


vimspector 调式插件
nvim
Plug ‘puremourning/vimspector’,{‘do’:’./install_gadget.py --force-enable-rust -enable-python --enable-go --enable-bash --enable-c’}

vim
Plugin ‘puremourning/vimspector’,{‘do’:’./install_gadget.py --force-enable-rust -enable-python --enable-go --enable-bash --enable-c’}

放在c++工程根目录.vimspector.json
{
“configurations”: {
“cpp:launch”: {
“adapter”: “vscode-cpptools”,
“configuration”: {
“name”: “cpp:launch”,
“stopAtEntry”: true,
“type”: “ccpgdb”,
“request”: “launch”,
“program”: “ w o r k s p a c e R o o t / m a i n " , " a r g s " : [ ] , " c w d " : " {workspaceRoot}/main", "args": [], "cwd": " workspaceRoot/main","args":[],"cwd":"{workspaceRoot}”,
“environment”: [],
“externalConsole”: true,
“MIMode”: “gdb”,
“breakpointers”: {
“exception”: {
“cpp_throw”: “Y”,
“cpp_catch”: “N”
}
}
}
}
}
}

" ===
" === vimspector
" ===
let g:vimspector_enable_mappings = ‘HUMAN’
function! s:read_template_into_buffer(template)
" has to be a function to avoid the extra space fzf#run insers otherwise
execute ‘0r ~/.vim/vimspector_json/’.a:template
endfunction
command! -bang -nargs=* LoadVimSpectorJsonTemplate call fzf#run({
\ ‘source’: ‘ls -1 ~/.vim/vimspector_json’,
\ ‘down’: 20,
\ ‘sink’: function(‘read_template_into_buffer’)
\ })
" %:p:h返回当前调试源文件所在的目录
" 如果没有%:p:h时.vimspector.json会被默认存到vim/nvim启动目录
" ~$nvim test/main.cpp 没有%:p:h时则返回~/.vimspector.json 如果有 %:p:h/.vimspector.json返回~/test/.vimspector.json
noremap vs :tabe %:p:h/.vimspector.json:LoadVimSpectorJsonTemplate
sign define vimspectorBP text=🛑 texthl=Normal
sign define vimspectorBPDisabled text=🚫 texthl=Normal
sign define vimspectorPC text=👉 texthl=SpellBad

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值