yum update sudo yum -y install ncurses-devel flex bison openssl openssl-devel elfutils elfutils-libelf-devel gmp-devel dwarves zstd dejagnu texinfo patch gcc g++ git autoconf gettext-devel automake ctags cscope
sudo apt update sudo apt upgrade sudo apt install -y vim git gcc g++ make auditd cmake flex autoconf automake libtool dh-autoreconf pkg-config bison libelf-dev libncurses-dev libssl-dev libcap-dev libbfd-dev libgmp-dev texinfo iperf arping dejagnu ctags cscope
vimid
#!/bin/sh find $(pwd) -name "*.h" -o -name "*.c" -o -name "*.S" -o -name "*.s" -o -name "*.cpp" -o -name "*.cc" >cscope.files #find -L $(pwd) -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.S" -o -name "*.s" | xargs realpath > cscope.files #find -L $(pwd) -name "*.h" -o -name "*.c" -o -name "*.cpp" -o -name "*.S" -o -name "*.s" | xargs readlink -f > cscope.files #find $(pwd) -name "*.[cpp|h|c|S]" >cscope.files cscope -Rbq -i cscope.files ctags -R *
vimrc
fedora@bogon:~$ cat .vimrc " All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by " the call to :runtime you can find below. If you wish to change any of those " settings, you should do it in this file (/etc/vim/vimrc), since debian.vim " will be overwritten everytime an upgrade of the vim packages is performed. " It is recommended to make changes after sourcing debian.vim since it alters " the value of the 'compatible' option. " This line should not be removed as it ensures that various options are " properly set to work with the Vim-related packages available in Debian. runtime! debian.vim " Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc. " This happens after /etc/vim/vimrc(.local) are loaded, so it will override " any settings in these files. " If you don't want that to happen, uncomment the below line to prevent " defaults.vim from being loaded. " let g:skip_defaults_vim = 1 " Uncomment the next line to make Vim more Vi-compatible " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous " options, so any other options should be set AFTER setting 'compatible'. "set compatible " Vim5 and later versions support syntax highlighting. Uncommenting the next " line enables syntax highlighting by default. "syntax on " If using a dark background within the editing area and syntax highlighting " turn on this option as well "set background=dark " Uncomment the following to have Vim jump to the last position when " reopening a file au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif " Uncomment the following to have Vim load indentation rules and plugins " according to the detected filetype. "filetype plugin indent on " The following are commented out as they cause vim to behave a lot " differently from regular Vi. They are highly recommended though. "set showcmd " Show (partial) command in status line. "set showmatch " Show matching brackets. "set ignorecase " Do case insensitive matching "set smartcase " Do smart case matching "set incsearch " Incremental search "set autowrite " Automatically save before commands like :next and :make "set hidden " Hide buffers when they are abandoned "set mouse=a " Enable mouse usage (all modes) " Source a global configuration file if available if filereadable("/etc/vim/vimrc.local") source /etc/vim/vimrc.local endif " https://vimjc.com/vimrc.html and https://vimjc.com/vimrc-config.html syntax enable syntax on set nocompatible set number set backspace=2 "set tabstop=4 set shiftwidth=4 set autowrite set ruler " show the current row and column " set number " show line numbers " set nowrap set showcmd " display incomplete commands " set showmode " display current modes " set showmatch " jump to matches when entering parentheses " set matchtime=2 " tenths of a second to show the matching parenthesis " set laststatus=2 set hlsearch " highlight searches " set incsearch " do incremental searching, search as you type " "加上此项会使ctags跳转变慢 "set ignorecase " ignore case when searching " "set smartcase " no ignorecase if Uppercase char present " set encoding=utf8 set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030 set cursorcolumn set cursorline "set paste set mouse=a "打开鼠标模式 "set mouse=v "可是模式下是用鼠标,使用鼠标复制内容到剪切板,可在vim命令行中使用set mouse=a/v进行切换 "set selection=exclusive "set selectmode=mouse,key map <F3> :set nonu mouse=v<CR> map <F4> :set nu mouse=a<CR> map <F5> :set paste<CR> map <F6> :set nopaste<CR> "--ctags setting-- " 按下F5重新生成tag文件,并更新taglist "map <F5> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR> :TlistUpdate<CR> "imap <F5> <ESC>:!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR> :TlistUpdate<CR> "两个一起用,ctags自动寻找tags文件,默认当前路径,其次是父路径,依次向上递归,tags后的;是必须有的 set tags=tags; set autochdir "set tags+=./tags "add current directory's generated tags file "set tags+=. "set tags+=/home/lhcc/work/tools/kexec.git "--taglist setting-- "不同时显示多个文件的tag,只显示当前文件的 let Tlist_Show_One_File=1 "如果taglist窗口是最后一个窗口,则退出vim let Tlist_Exit_OnlyWindow=1 "可以用F8打开或关闭Taglist nnoremap <F8> :TlistToggle<CR> "--NERDTree setting-- "文件列表栏显示在右边 let NERDTreeWinPos='right' "按键盘上的F9就可以显示和隐藏NERDTree的文件浏览了 noremap <F9> :NERDTreeToggle<CR> "--cscope setting-- if has("cscope") set csprg=/usr/bin/cscope " set csto=0 " set cst set nocst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb endif "如果有多个匹配项,cscope会弹出窗口显示多个匹配项,输入数字即可跳转到对应匹配项。而设 "置cscope结果输出到quickfix后,cscope只会显示第一个匹配项,如果想要查看其它匹配项,需要输入cw, "进入quickfix的窗口进行查看。 "set cscopequickfix=s-,c-,d-,i-,t-,e- "另外追加如下两行可以使用Ctrl-n / Ctrl-P 跳转到后一项和前一项纪录。 nmap <C-n> :cnext<CR> nmap <C-p> :cprev<CR> 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 :vert scs find s <C-R>=expand("<cword>")<CR><CR> nmap <C-_>g :vert scs find g <C-R>=expand("<cword>")<CR><CR> nmap <C-_>c :vert scs find c <C-R>=expand("<cword>")<CR><CR> nmap <C-_>t :vert scs find t <C-R>=expand("<cword>")<CR><CR> nmap <C-_>e :vert scs find e <C-R>=expand("<cword>")<CR><CR> nmap <C-_>f :vert scs find f <C-R>=expand("<cfile>")<CR><CR> nmap <C-_>i :vert scs find i <C-R>=expand("<cfile>")<CR><CR> nmap <C-_>d :vert scs find d <C-R>=expand("<cword>")<CR><CR>