当前位置:首页 >> 技术栈专业化分层 >> 【VIM安装ctags cscope】,北京800

【VIM安装ctags cscope】,北京800

cpugpu芯片开发光刻机 技术栈专业化分层 5
文件名:【VIM安装ctags cscope】,北京800 【VIM安装ctags cscope】

一、安装软件包

sudo passwd rootsudo apt install cmake python2-dev python3-dev build-essential cmake flex bison -ysudo apt install universal-ctags cscope vim git -ysudo apt install python-is-python3 -ysudo apt-get install build-essential libncurses-dev bison flex libssl-dev

二、下载VIM插件管理器

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

vim ~/.vimrc

" ==============vim基本配置==============set guifont=Monospace\ 14set nu! " 显示行号syntax enablesyntax oncolorscheme desertset autowrite " 自动保存set foldmethod=syntaxset foldlevel=100 " 启动vim时不要自动折叠代码set textwidth=80set formatoptions+=tset cindentset smartindentset noerrorbellsset showmatchset nobackup set noswapfile" set cursorline" disable noremap <Up> <Nop>noremap <Down> <Nop>noremap <Left> <Nop>noremap <Right> <Nop>" remap control + arrow key to select windowsnoremap <C-Down> <C-W>jnoremap <C-Up> <C-W>knoremap <C-Left> <C-W>hnoremap <C-Right> <C-W>lnoremap <C-J> <C-W>jnoremap <C-K> <C-W>knoremap <C-H> <C-W>hnoremap <C-L> <C-W>l" ==============Vundle插件管理==============" Vundle manageset nocompatible " be iMproved, requiredfiletype off " required" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" let Vundle manage Vundle, requiredPlugin 'VundleVim/Vundle.vim'Plugin 'Valloric/YouCompleteMe'Plugin 'scrooloose/nerdtree'" Plugin 'majutsushi/tagbar' " Tag bar"Plugin 'Xuyuanp/nerdtree-git-plugin'Plugin 'jistr/vim-nerdtree-tabs'Plugin 'vim-airline/vim-airline' | Plugin 'vim-airline/vim-airline-themes' " Status line"Plugin 'jiangmiao/auto-pairs'Plugin 'mbbill/undotree'Plugin 'gdbmgr'Plugin 'scrooloose/nerdcommenter'Plugin 'Yggdroot/indentLine' " Indentation level"Plugin 'bling/vim-bufferline' " Buffer line""Plugin 'kepbod/quick-scope' " Quick scopePlugin 'yianwillis/vimcdoc'Plugin 'nelstrom/vim-visual-star-search'Plugin 'ludovicchabant/vim-gutentags'Plugin 'w0rp/ale'Plugin 'mbbill/echofunc'Plugin 'Yggdroot/LeaderF', { 'do': './install.sh' }" All of your Plugins must be added before the following linecall vundle#end() " requiredfiletype plugin indent on " required" ==============YCM==============let g:ycm_server_python_interpreter='/usr/bin/python'let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'" YCM 查找定义let mapleader=','nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>let g:ycm_collect_identifiers_from_tags_files = 1set completeopt=menu,menuone let g:ycm_add_preview_to_completeopt = 0 " 关闭函数原型提示let g:ycm_show_diagnostics_ui = 0 " 关闭诊断信息let g:ycm_server_log_level = 'info'let g:ycm_min_num_identifier_candidate_chars = 2 " 两个字符触发 补全let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 收集let g:ycm_complete_in_strings=1noremap <c-z> <NOP>let g:ycm_key_invoke_completion = '<c-z>' " YCM 里触发语义补全有一个快捷键let g:ycm_max_num_candidates = 15 " 候选数量let g:ycm_semantic_triggers = {\ 'c,cpp,python,java,go,erlang,perl': ['re!\w{2}'],\ 'cs,lua,javascript': ['re!\w{2}'],\ }" ===========gutentags=============" 搜索工程目录的标志,碰到这些文件/目录名就停止向上一级目录递归let g:gutentags_project_root = ['.root', '.svn', '.git', '.hg', '.project', '.gitignore']" 添加ctags额外参数,会让tags文件变大" let g:gutentags_ctags_extra_args = ['--fields=+niazlS', '--extra=+q']let g:gutentags_ctags_extra_args = ['--fields=+lS']" let g:gutentags_ctags_extra_args += ['--c++-kinds=+px']" let g:gutentags_ctags_extra_args += ['--c-kinds=+px']if isdirectory("kernel/") && isdirectory("mm/")let g:gutentags_file_list_command = 'find arch/arm/ mm/ kernel/ include/ init/ lib/'endif" =======echodoc 显示函数参数===========" ctags -R --fields=+lS ."======= NetRedTree=========autocmd StdinReadPre * let s:std_in=1autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endiflet NERDTreeWinSize=20"let NERDTreeShowLineNumbers=1let NERDTreeAutoCenter=1let NERDTreeShowBookmarks=1let g:winManagerWindowLayout='TagList'nmap wm :WMToggle<cr>" ======ALE静态语法检测========let g:ale_sign_column_always = 1let g:ale_sign_error = '✗'let g:ale_sign_warning = 'w'let g:ale_statusline_format = ['✗ %d', '⚡ %d', '✔ OK']let g:ale_echo_msg_format = '[%linter%] %code: %%s'let g:ale_lint_on_text_changed = 'normal'let g:ale_lint_on_insert_leave = 1"let g:airline#extensions#ale#enabled = 1let g:ale_c_gcc_options = '-Wall -O2 -std=c99'let g:ale_cpp_gcc_options = '-Wall -O2 -std=c++14'let g:ale_c_cppcheck_options = ''let g:ale_cpp_cppcheck_options = ''" ========airline状态栏========= let g:airline#extensions#tabline#enabled = 1let g:airline_section_b = '%-0.10{getcwd()}'let g:airline_section_c = '%t'let g:airline#extensions#tagbar#enabled = 1let g:airline_section_y = ''"--------------------------------------------------------------------------------" cscope:建立数据库:cscope -Rbq; F5 查找c符号; F6 查找字符串; F7 查找函数定义; F8 查找函数谁调用了,"--------------------------------------------------------------------------------if has("cscope")set csprg=/usr/bin/cscopeset csto=1set cstset nocsverb" add any database in current directoryif filereadable("cscope.out")cs add cscope.outendifset csverbendif:set cscopequickfix=s-,c-,d-,i-,t-,e-nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>"nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>"F5 查找c符号; F6 查找字符串; F7 查找函数定义; F8 查找函数谁调用了,nmap <silent> <F5> :cs find s <C-R>=expand("<cword>")<CR><CR> :botright copen<CR><CR> nmap <silent> <F6> :cs find t <C-R>=expand("<cword>")<CR><CR> :botright copen<CR><CR>"nmap <silent> <F7> :cs find g <C-R>=expand("<cword>")<CR><CR> nmap <silent> <F7> :cs find c <C-R>=expand("<cword>")<CR><CR> :botright copen<CR><CR>"--------------------------------------------------------------------------------" 自动加载ctags: ctags -Rif filereadable("tags")set tags=tagsendif"--------------------------------------------------------------------------------" global:建立数据库"--------------------------------------------------------------------------------if filereadable("GTAGS")set cscopetagset cscopeprg=gtags-cscopecs add GTAGSau BufWritePost *.c,*.cpp,*.h silent! !global -u &endif

 使用以下命令安装

vim:PluginInstall

三、编译安装YouCompelte

apt install build-essential cmake vim-nox python3-devcd ~/.vim/bundle/YouCompleteMe编译安装YouCompeltecd ~/.vim/bundle/YouCompleteMe~/.vim/bundle/YouCompleteMe$ ./install.py --clang-completer~/.vim/bundle/YouCompleteMe/third_party/ycmd/examples$ cp .ycm_extra_conf.py ~/.vim

四、工具链

wget https://snapshots.linaro.org/gnu-toolchain/12.2-2023.04-1/aarch64-linux-gnu/gcc-linaro-12.2.1-2023.04-x86_64_aarch64-linux-gnu.tar.xzexport PATH=$PATH:/opt//opt/gcc-linaro-12.2.1-2023.04-x86_64_aarch64-linux-gnu/binexport CROSS_COMPILE=aarch64-linux-gnu-

五:编译Linux kernel

sudo apt-get install gcc g++sudo apt-get install libncurses5-dev sudo apt-get install build-essentialsudo apt-get install kernel-package sudo apt-get install libssl-devsudo apt-get install libc6-dev sudo apt-get install bin86sudo apt-get install flex sudo apt-get install bison sudo apt-get install qttools5-dev sudo apt-get install libelf-devgit clone https://mirrors.tuna.tsinghua.edu.cn/git/linux.git或git clone https://mirrors.tuna.tsinghua.edu.cn/git/linux-stable.gitmake ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfigmake ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j8ake ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- tags cscope TAGS -j8

协助本站SEO优化一下,谢谢!
关键词不能为空
同类推荐
«    2026年1月    »
1234
567891011
12131415161718
19202122232425
262728293031
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
文章归档
网站收藏
友情链接