linux cscope界面,Linux cscope代码阅读工具配置

1 cscope

1.1 软件安装

apt-get install cscope

1.2 ~/.vimrc Settings

1.2.1 Cscope Settings

Copy the following comment to ~/.vimrc

以下的"(左双引号)后面的表示注释

例如:" add any database in current directory

if has("cscope")

set csprg=/usr/bin/cscope

set csto=0

set cst

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

1.2.2 Remember Last Location

Copy the following comment to ~/.vimrc

if has("autocmd")

au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")

\| exe "normal g'\"" | endif

endif

1.2.3 Syntax Color off

Copy the following comment to ~/.vimrc

以下的"(左双引号)后面的表示注释

例如:"4 space, not Tab

hi comment ctermfg=6

syntax off

"4 space, not Tab

set tabstop=4

autocmd FileType c,cpp,h,java set shiftwidth=4 | set expandtab

1.2.4 Show the Whitespace

Copy the following comment to ~/.vimrc

以下的"(左双引号)后面的表示注释

例如:" whitespace

" whitespace

highlight whitespaceEOF ctermbg=red guibg=red

match whitespaceEOF /\s\+$/

1.3 不显示shell提示符前面过长的文件路径

@ ~/.bashrc Setting

Copy the following comment to ~/.bashrc

13db26b30ec313c405a433bfe47b8981.png

1.4 Support CPP and Java

# find ./ -name *.cpp > cscope.files

# find ./ -name *.hpp >> cscope.files

# find ./ -name *.c >> cscope.files

# find ./ -name *.h >> cscope.files

# find ./ -name *.java >> cscope.files

# cscope –kbRq

1.5 Vim快捷键

选中多行,复制,粘贴:Shift + v, y, p

选中多列,复制,粘贴:Ctrl + v, y, p

函数跳转:Ctrl + ]

函数跳转返回:Ctrl + o

跳到第一行: :0

跳到最后一行: :$

比较:vimdiff  file1 file2

vimdiff 2个窗口互相跳转:ctrl + 按2次w键

vim以16进制查看文件:”: %!xxd”

字符串替换::%s/oldstring/newstring/g

查找谁调用symbol::cs find c 查找symbol出现的地方::cs find s 查找指定的文件::cs find f

2 taglist

2.1 Download taglist.vim from Internet

需要注册账号

2.2 Install

2.2.1 ~/.vimrc Setting

Copy the following comment to ~/.vimrc

以下的"(左双引号)后面的表示注释

例如:" show Tlist always

" show Tlist always

let Tlist_Show_One_File=1

let Tlist_Exit_OnlyWindow=1

let Tlist_Auto_Open=1

let Tlist_WinWidth=30

2.2.2 taglist.vim

mkdir ~/.vim/plugin

cp taglist.vim ~/.vim/plugin

2.2.3 taglist快捷键

跳到左边函数list窗口:ctrl + 按2次w键

跳到右边源码窗口:选择函数,按回车键

当左边函数list窗口被关闭时,可以在vim中用如下命令打开:“:TlistOpen”

需要关闭左边函数list窗口时,可以在vim中用如下命令关闭:“:TlistClose”

或者使用 ” ctrl + 按2次w键“ 跳转到左边窗口,然后输入如下命令:“:q”

3 sed - Stream Editor

3.1 Linux命令之sed批量替换字符串操作

使用的格式如下:

sed -i "s/oldstring/newstring/g" `grep oldstring -rl path`

其中,oldstring是待被替换的字符串,newstring是待替换oldstring的新字符串,grep操作主要是按照所给的路径查找oldstring,path是所替换文件的路径;

-i选项是直接在文件中替换,不在终端输出;

-r选项是所给的path中的目录递归查找;

-l选项是输出所有匹配到oldstring的文件;

4 tmux

4.1 安装工具

在ubuntu系统中使用sudo apt-get install tmux安装tmux工具

4.2 使用工具

输入命令tmux使用工具

-上下分屏:ctrl + b  再按 "

-左右分屏:ctrl + b  再按 %

-切换屏幕:ctrl + b  再按o

-关闭一个终端:ctrl + b  再按x

-上下分屏与左右分屏切换: ctrl +b  再按空格键

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值