在ubuntu下搭建简单的代码浏览环境
来源:互联网 发布:在国外注册域名 编辑:程序博客网 时间:2024/05/22 03:47
在~/下新建.vimrc文件
如果我的代码路径为 ~/public/m8916
文件内容
"ctags 文件工程添加配置
set tags=~/public/m8916/tags
"cscope 文件工程添加配置,cs生成的cscope.out文件在哪个路径就填写哪个路径,不然不能导入所有次级目录下的代码
cs a /home/你的用户名/public/m8916/cscope.out /home/你的用户名/public/m8916
"cscope的配置
if has("cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
if filereadable("cscope.out")
cs add cscope.out
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
set cscopequickfix=s-,c-,d-,i-,t-,e-
"配置cs的快捷键搜索功能,按下Ctrl+对应字母快捷搜索,例如 光标移动到要搜索的字符串位置按下Ctrl+s
nmap <C-\>s :scs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :scs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :scs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :scs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :scs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :scs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :scs find d <C-R>=expand("<cword>")<CR><CR>
"添加中文帮助文档配置
set helplang=cn
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936
set fileencoding=utf-8
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
language messages zh_CN.utf-8
"VIM的配置
"高亮显示匹配括号
set showmatch
"显示行号
set number
"语法高亮
set syntax=on
"搜索忽略大小写
set ignorecase
"搜索字符高亮
set hlsearch
set incsearch
"行内替换
set gdefault
"Tlist 配置
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
let Tlist_Auto_Open=1
let g:winManagerWindowLayout='FileExplorer|Taglist'
noremap <F6> :!ctags -R<CR>
noremap <F8> :TlistToggle<CR>
"""""按照普通文本编辑器标准设置诸多快捷键"""""
if exists("g:skip_loading_mswin") && g:skip_loading_mswin
finish
endif
"设置'cpoptions'到Vim默认
if 1 " only do this when compiled with expression evaluation
let s:save_cpo = &cpoptions
endif
set cpo&vim
"按照windows方式操作。例如Shift+向左箭头选择从右到左的文本,Shift+向由箭头选择从左到右的文本
behave mswin
" backspace and cursor keys wrap to previous/next line
set backspace=indent,eol,start whichwrap+=<,>,[,]
"按backspace键往前删除
vnoremap <BS> d
"按ctrl+X组合键剪切,但是我的ctrl+X键不能剪切,我将其改为Shift+X了
vnoremap <S-X> "+x
vnoremap <S-Del> "+x
"按ctrl+C组合键复制
vnoremap <C-C> "+y
vnoremap <C-Insert> "+y
"按ctrl+V或Shift+Insert组合键粘贴
map <C-V> "+gP
map <S-Insert> "+gP
cmap <C-V> <C-R>+
cmap <S-Insert> <C-R>+
exe 'inoremap <script> <C-V> <C-G>u' . paste#paste_cmd['i']
exe 'vnoremap <script> <C-V> ' . paste#paste_cmd['v']
imap <S-Insert> <C-V>
vmap <S-Insert> <C-V>
"按ctrl+Q组合键退出
noremap <C-Q> <C-V>
"按ctrl+S组合键保存
noremap <C-S> :update<CR>
vnoremap <C-S> <C-C>:update<CR>
inoremap <C-S> <C-O>:update<CR>
if !has("unix")
set guioptions-=a
endif
"按ctrl+Z组合键撤销
noremap <C-Z> u
inoremap <C-Z> <C-O>u
"按ctrl+Y组合键重做
noremap <C-Y> <C-R>
inoremap <C-Y> <C-O><C-R>
"按ctrl+A组合键全选
noremap <C-A> gggH<C-O>G
inoremap <C-A> <C-O>gg<C-O>gH<C-O>G
cnoremap <C-A> <C-C>gggH<C-O>G
onoremap <C-A> <C-C>gggH<C-O>G
snoremap <C-A> <C-C>gggH<C-O>G
xnoremap <C-A> <C-C>ggVG
"按ctrl+tab组合键切换窗口
noremap <C-Tab> <C-W>w
inoremap <C-Tab> <C-O><C-W>w
cnoremap <C-Tab> <C-C><C-W>w
onoremap <C-Tab> <C-C><C-W>w
"按ctrl+F组合键关闭窗口
noremap <C-F4> <C-W>c
inoremap <C-F4> <C-O><C-W>c
cnoremap <C-F4> <C-C><C-W>c
onoremap <C-F4> <C-C><C-W>c
"恢复'cpoptions'
set cpo&
if 1
let &cpoptions = s:save_cpo
unlet s:save_cpo
endif
"""""按ctrl+G键自动缩进美化代码"""""
noremap <C-G> <Esc>gg=G<CR>
inoremap <C-G> <C-O> <Esc>gg=G<CR>
以上就是在ubuntu上配置VIM和GVIM的设置参数
- 在ubuntu下搭建简单的代码浏览环境
- Android 环境在ubuntu下的搭建
- CTS在ubuntu下的环境搭建
- Ubuntu下C代码单元测试环境CUnit的搭建
- Android 在Ubuntu下的开发环境的搭建
- JAVA开发环境在Ubuntu 10.04下的搭建
- 如何在ubuntu下搭建arm的集成开发环境
- 在ubuntu下搭建Android的开发环境
- java在Ubuntu下的开发环境搭建
- Vim浏览linux kernel代码的环境搭建
- 在Ubuntu下搭建Glut开发环境
- 在ubuntu 下搭建 android开发环境
- 在ubuntu下搭建android开发环境
- 在ubuntu下搭建Android开发环境
- 在ubuntu下搭建python开发环境
- 在Ubuntu下搭建eclipse开发环境
- 简简单单在ubuntu下搭建opencv环境
- 在Ubuntu Server下搭建LAMP环境
- 图像检索服务器编写问题记录——添加线程池
- Deep learning
- sublime text2 设置默认浏览器
- 关于使用腾讯 Bugly 平台 Tinker开源热修复框架的 项目集成
- [Vijos1283] 佳佳的魔杖
- 在ubuntu下搭建简单的代码浏览环境
- C++中的locale设置 (即系统区域设置)
- Dalvik虚拟机相关的可执行程序
- QueryRunner执行update插入语句异常
- LeetCode 189---Rotate Array
- C#接口的意义
- Python 机器学习
- 微信为什么不丢消息?
- pip安装