参考链接注意. wsl 跟 window并不是一个环境。wslvscodeclangd 安装https://zhuanlan.zhihu.com/p/551978555首先在windows安装vscode安装远程wsl的工具clangd并且设置clangd插件安装简体中文插件搜chineseclangd生产索引可以在 ./scripts/clang-tools/gen_compile_commands.py跳转不了还需要再wsl安装lsp内核相关https://zhuanlan.zhihu.com/p/558286384只显示源文件点击设置-搜索files.exclude- “/.o**” 排除编译的过程文件https://worktile.com/kb/ask/573712.html设置clang启动相关怕配置https://zhuanlan.zhihu.com/p/558286384主要索引compile-commands索引文件--compile-commands-dir${workspaceFolder} --background-index --completion-styledetailed --header-insertionnever -loginfovim配置参考https://zhuanlan.zhihu.com/p/1909957971384984651安装 ctags,自动生产arch相关的tagsudo apt install exuberant-ctags -y cd debug_kernel/linux-6.12.28/ ls -l scripts/tags.sh make tags ARCHx86cscopesudo apt install cscope -y make cscope ARCHx86 ls -lh cscope*插件安装mkdir ~/.vim cd ~/.vim wget --content-disposition https://www.vim.org/scripts/download_script.php?src_id26062 wget --content-disposition https://www.vim.org/scripts/download_script.php?src_id19574 wget https://github.com/preservim/nerdtree/archive/refs/tags/7.1.3.zip unzip SrcExpl-6.0.zip unzip taglist_46.zip unzip 7.1.3.zip cp nerdtree-7.1.3/* . -ar rm SrcExpl-6.0.zip rm taglist_46.zip rm NERD_tree.zipvim 常用配置------------------------------------------------------------------------------------------------------- vim环境配置 ------------------------------------------------------------------------------------------------------- set nu line number set ai auto indent set ts4 tab size set bgdark backgroud color set mousea ------------------------------------------------------------------------------------------------------- ctags database path设置 ------------------------------------------------------------------------------------------------------- set tags/home/dd/linux/linux/tags ctags DB路径 ------------------------------------------------------------------------------------------------------- cscope database path设置 ------------------------------------------------------------------------------------------------------- set csprg/usr/bin/cscope cscope位置 set csto0 cscope DB search first set cst cscope DB tag DB search set nocsverb verbose off cscope DB 位置设置使用绝对路径 cs add /home/dd/linux/linux/cscope.out /home/dd/linux/linux set csverb verbose off ------------------------------------------------------------------------------------------------------- Tag List环境设置 ------------------------------------------------------------------------------------------------------- filetype on vim filetype on nmap F7 :TlistToggleCR F7 Key Tag List Toggling let Tlist_Ctags_Cmd /usr/bin/ctags ctags程序位置 let Tlist_Inc_Winwidth 0 window width change off let Tlist_Exit_OnlyWindow 0 tag/file完成选择时taglist window close off let Tlist_Auto_Open 0 vim开始时window open off let Tlist_Use_Right_Window 1 vim开始时window open off ------------------------------------------------------------------------------------------------------- Source Explorer环境设置 ------------------------------------------------------------------------------------------------------- nmap F8 :SrcExplToggleCR F8 Key SrcExpl Toggling nmap C-H C-Wh 向左侧窗口移动 nmap C-J C-Wj 向下端preview窗口移动 nmap C-K C-Wk 向上端窗口移动 nmap C-L C-Wl 向右侧窗口移动 let g:SrcExpl_winHeight 8 指定SrcExpl Windows高度 let g:SrcExpl_refreshTime 100 refreshing time 100ms let g:SrcExpl_jumpkey ENTER 跳转jump至相应定义definition let g:SrcExpl_gobackkey SPACE back let g:SrcExpl_isUpdateTags 0 tag file update off ------------------------------------------------------------------------------------------------------- NERD Tree环境设置 ------------------------------------------------------------------------------------------------------- let NERDTreeWinPos left NERD Tree位置左侧 nmap F9 :NERDTreeToggleCR F9 Key NERD Tree Toggling imap jj Esc noremap leadercs :cs find s noremap C-\s :cs find s C-Rexpand(cword)CRCR noremap C-\g :cs find g C-Rexpand(cword)CRCR noremap C-\c :cs find c C-Rexpand(cword)CRCR noremap C-\d :cs find d C-Rexpand(cword)CRCR noremap C-\t :cs find t C-Rexpand(cword)CRCR noremap C-\e :cs find e C-Rexpand(cword)CRCR noremap C-\f :cs find f C-Rexpand(cfile)CRCR noremap C-\i :cs find i C-Rexpand(cfile)CRCR if has(autocmd) au BufReadPost * if line(\) 1 line(\) line($) | exe normal! g\ | endif endif if has(clipboard) set clipboardunnamedplus else function! s:CopyOSC52(text) abort let l:b64 substitute(system(base64, a:text), \n, , g) let l:esc \Esc]52;c; . l:b64 . \x07 call chansend(v:stderr, l:esc) endfunction augroup osc52_yank autocmd! autocmd TextYankPost * \ if v:event.operator is# y v:event.regname is# | \ call s:CopyOSC52(getreg()) | \ endif augroup END endif