- 浏览: 13564 次
最新评论
Vim Setting
2010年12月05日
"{{{ set mouse=a noremap :make noremap :make clean;make noremap :!cvs up nnoremap @=((foldclosed(line('.')) 0) ? 'zc' : 'zo') if has("multi_byte") set encoding=utf-8 set fileencoding=chinese set fileencodings=ucs-bom,utf-8,chinese endif set wrap set nu set ts=4 set sw=4 set ru set hls set is set sm set cin set cino=:0g0t0(sus "set visualbell " visual bell instead of beeping "set browsedir =current " which directory to use for the file browser set smartcase set incsearch " use incremental search set nowrap " do not wrap lines set nowritebackup "}}} "------------------------------------------------- ------------------------------ " Change the working directory to the directory containing the current file "------------------------------------------------- ------------------------------ ""{{{ if has("autocmd") autocmd BufEnter * :lchdir %:p:h endif "has("autocmd") ""}}} "------------------------------------------------- ----------------------------- "下面是作为一个编程者的个人设置
"------------------------------------------------- -----------------------------
"简单配置
"{{{
set hlsearch
syntax on
colorscheme elflord
set autoread " read open files again when changed outside Vim
set autowrite " write a modified buffer on each :next , ...
"可用来改动补全时采用的方式
:set wildmode=list:full
"可用来改动补全时采用的方式
"可用来取得菜单式的匹配列表
:set wildmenu
"可用来取得菜单式的匹配列表
"关闭自动备份
set nobackup
"关闭自动备份
"关闭交换文件
set nocp
"关闭交换文件
"显示匹配的括号([{和}])
set showmatch
"显示匹配的括号([{和}])
"关闭遇到错误时的声音提示
set noerrorbells
set novisualbell
"关闭遇到错误时的声音提示
"使用空格来替换tab
"set expandtab
"使用空格来替换tab
"在vim编辑器下方显示命令
set showcmd
"在vim编辑器下方显示命令
"当文件在外部被修改,自动更新该文件
filetype indent on
"当文件在外部被修改,自动更新该文件
"}}}
"简单配置
"自己定义函数或函数头文件
"{{{
"ctrl+F12 或 ctrl+F11:生成tags
"vim -t sys_open : 就可以到sys_open 的定义出
"--c++-kinds=+p : 为C++文件增加函数原型的标签
"--fields=+iaS : 在标签文件中加入继承信息(i)、类成员的访问控制信息(a)、以及函数的指纹(S)
"--extra=+q : 为标签增加类修饰符。注意,如果没有此选项,将不能对类成员补全 map :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q . "map :!ctags -R --c-kinds=+p --fields=+iaS --extra=+q . map :!ctags -R . set tags+=./tags "}}} "自己定义函数或函数头文件
"vim折叠功能
"折叠方式,可用选项 'foldmethod' 来设定折叠方式:set fdm=***"{{{
"有 6 种方法来选定折叠:
"manual 手工定义折叠
"indent 更多的缩进表示更高级别的折叠
"expr 用表达式来定义折叠
"syntax 用语法高亮来定义折叠
"diff 对没有更改的文本进行折叠
"marker 对文中的标志折叠
"常用的折叠快捷键
"zf 创建折叠 (marker 有效)
"zo 打开折叠
"zO 对所在范围内所有嵌套的折叠点展开
"zc 关闭当前折叠
"zC 对所在范围内所有嵌套的折叠点进行折叠
"[z 到当前打开的折叠的开始处。
"]z 到当前打开的折叠的末尾处。
"zM 关闭所有折叠 (我喜欢)
"zr 打开所有折叠
"zR 循环地打开所有折叠 (我喜欢)
"zE 删除所有折叠
"zd 删除当前折叠
"zD 循环删除 (Delete) 光标下的折叠,即嵌套删除折叠
"za 若当前打开则关闭,若当前关闭则打开
"zA 循环地打开/关闭当前折叠
"zj 到下一折叠的开始处
"zk 到上一折叠的末尾
"set fdm=marker
"set foldmethod=indent
"要想在{ } 代码块中折叠,按空格键
"syntax 与 c.vim 中的 \cc 注释功能冲突
set fdm=marker
"}}}
"vim折叠功能
"completeopt 弹出菜单 输入字母实现即时的过滤和匹配
""{{{
"关掉智能补全时的预览窗口 (Scratch)
" menu 使用弹出菜单来显示可能的补全
" longest 只插入匹配的最长公共文本
"set completeopt=menuone,menu,longest,preview
set completeopt=menu,longest
"filetype plugin on
"set ofu=syntaxcomplete#Complete
"
filetype plugin indent on
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#Complete
if has("autocmd") && exists("+omnifunc")
autocmd Filetype *
\ if &omnifunc == "" | \ setlocal omnifunc=syntaxcomplete#Complete | \ endif endif let g:rubycomplete_buffer_loading = 1 let g:rubycomplete_classes_in_global = 1 "let g:rubycomplete_rails = 1 " ""}}} "completeopt 弹出菜单 输入字母实现即时的过滤和匹配
"C库函数参数Scratch显示
"1.先下载glibc库 "{{{
"2.解压到/usr/src中
"3.执行:ctags -R --c-kinds=f
"4.ctrl+x ctrl+o
"one 添加c库函数定义数据库
"set tags+=/usr/src/glibc/tags
"two 添加linux 源码 函数定义数据库
set tags+=/usr/src/linux/tags
"}}}
"C库函数参数Scratch显示
"C库类型定义,函数声明,宏定义等
"1.cd /usr/include/ "{{{
"2.执行:ctags -R --c-kinds=+pxd
"3.使用:ctrl+x ctrl+]
"set tags+=/usr/include/tags
"}}}
"C库类型定义,函数声明,宏定义等
"单词列表匹配
"{{{
"ctrl+x ctrl+k
set dictionary+=/usr/share/dict/wordlist.txt
set complete-=k complete+=k
"}}}
"单词列表匹配
"括号智能匹配
"{{{
:inoremap ( ()i
:inoremap ) =ClosePair(')')
:inoremap { {}i
:inoremap } =ClosePair('}')
:inoremap [ []i
:inoremap ] =ClosePair(']')
:inoremap " ""i
:inoremap " =ClosePair('"')
":inoremap i
":inoremap >=ClosePair('>')
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\"
else
return a:char
endif
endf
"}}}
"括号智能匹配 "让autocomlpop 支持snipMate.vim
"将下面fun写到snipMate.vim"{{{
"fun! GetSnipsInCurrentScope()
" let snips = {}
" for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
" call extend(snips, get(s:snippets, scope, {}), 'keep')
" call extend(snips, get(s:multi_snips, scope, {}),'keep')
" endfor
" return snips
"endf
"set g:acp_behaviorSnipmateLength=1
"}}}
"让autocomlpop 支持snipMate.vim
"tab智能完成 使用实际的tab 需要shift+tab
"{{{
"ctrl + c 可以中断正在查找
function! Smart_TabComplete()
let line = getline('.') " curline
let substr = strpart(line, -1, col('.')+1) " from start to cursor
let substr = matchstr(substr, "[^ \t]*$") " word till cursor
if (strlen(substr)==0) " nothing to match on empty string
return "\"
endif
let has_period = match(substr, '\.') != -1 " position of period, if any
let has_slash = match(substr, '\/') != -1 " position of slash, if any
if (!has_period && !has_slash)
return "\\" " existing text matching
elseif ( has_slash )
return "\\" " file matching
else
return "\\" " plugin matching
endif
endfunction
"inoremap =Smart_TabComplete()
"}}}
"tab智能完成 使用实际的tab 需要shift+tab
"gf 命令 go file 到该文件去
"{{{
"set path+=/home/linux/u-boot-1.3.1/include/
"set path+=/usr/src/linux-headers-2.6.27-7/include/
"set path+=/usr/src/linux/include/
"}}}
"gf 命令 go file 到该文件去
"----------------------
"利用 插件 丰富 功能
"----------------------
"使用 autocomplpop.vim 插件
""{{{ " 1. 下载 autocomplpop.vim 后,放到Vim文件目录下的plugin目录中
" 2. 增加智能提示触发命令
" 3. 加入PHP的全能提示触发命令
if !exists('g:AutoComplPop_Behavior')
let g:AutoComplPop_Behavior = {}
let g:AutoComplPop_Behavior['php'] = []
call add(g:AutoComplPop_Behavior['php'], {'command': "\\",'pattern': printf('\(->\|::\|\$\)\k\{%d,}$', 0),'repeat': 0,})
endif
""}}}
"使用 autocomplpop.vim 插件
"加速你的补全 -- 插件: SuperTab 使用上面的,可以关闭这个
"{{{
"设置按下后默认的补全方式, 默认是,
"现在改为. 关于的补全方式,
"还有其他的补全方式, 你可以看看下面的一些帮助:
":help ins-completion
":help compl-omni
" 0 - 不记录上次的补全方式
" 1 - 记住上次的补全方式,直到用其他的补全命令改变它
" 2 - 记住上次的补全方式,直到按 ESC 退出插入模式为止
"let g:SuperTabRetainCompletionType=2
"let g:SuperTabDefaultCompletionType=""
"}}}
"加速你的补全 -- 插件: SuperTab 使用上面的,可以关闭这个
"OmniCppComplete : C/C++ omni-completion with ctags database
""{{{
let OmniCpp_NamespaceSearch = 1
let OmniCpp_GlobalScopeSearch = 1
let OmniCpp_ShowAccess = 1
let OmniCpp_ShowPrototypeInAbbr = 1 " show function parameters
let OmniCpp_MayCompleteDot = 1 " autocomplete after .
let OmniCpp_MayCompleteArrow = 1 " autocomplete after ->
let OmniCpp_MayCompleteScope = 1 " autocomplete after ::
let OmniCpp_DefaultNamespaces = ["std", "_GLIBCXX_STD"]
"automatically open and close the popup menu / preview window
au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif
"set completeopt=menuone,menu,longest,preview
"自定义快捷键
inoremap pumvisible()?"\":"\"
inoremap pumvisible()?"\\\":"\"
inoremap pumvisible()?"\\\":"\"
inoremap pumvisible()?"\":"\"
"inoremap pumvisible()?"\":"\"
"inoremap pumvisible()?"\":"\"
"=================================
"注意:tab 是选择下一项, shift+tab 是选择上一项
"=================================
"上面的映射都是在插入模式下的映射,解释如下
"如果下拉菜单弹出,回车映射为接受当前所选项目,否则,仍映射为回车
"如果下拉菜单弹出,CTRL-J映射为在下拉菜单中向下翻页。否则映射为CTRL-X CTRL-O
"如果下拉菜单弹出,CTRL-K映射为在下拉菜单中向上翻页,否则仍映射为CTRL-K
"如果下拉菜单弹出,CTRL-U映射为CTRL-E,即停止补全,否则,仍映射为CTRL-U
"如果下拉菜单弹出,CTRL-P映射为在下拉菜单中表示上一项。
"如果下拉菜单弹出,CTRL-N映射为在下拉菜单中表示下一项。 ":set omnifunc ? 查看设置的补全插件
"autocmd FileType cpp set omnifunc=omni#cpp#complete#Main
""}}}
"OmniCppComplete : C/C++ omni-completion with ctags database
"教你高效地浏览源码 -- 插件: TagList
""{{{
"在taglist窗口中,可以使用下面的快捷键:
" 跳到光标下tag所定义的位置,用鼠标双击此tag功能也一样
"o 在一个新打开的窗口中显示光标下tag
" 显示光标下tag的原型定义
"u 更新taglist窗口中的tag
"s 更改排序方式,在按名字排序和按出现顺序排序间切换
"x taglist窗口放大和缩小,方便查看较长的tag
"+ 打开一个折叠,同zo
"- 将tag折叠起来,同zc
"* 打开所有的折叠,同zR
"= 将所有tag折叠起来,同zM
"[[ 跳到前一个文件
"]] 跳到后一个文件
"q 关闭taglist窗口
" 显示帮助
"使用 :Tlist
":help taglist.txt ( ~/.vim/doc/taglist.txt )
"
"快捷键
map :TlistToggle
noremap :Tlist
noremap :TlistSync
"快捷键
"
"设定Linux系统中ctags程序的位置
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
"设定Linux系统中ctags程序的位置
"
"不同时显示多个文件的tag,只显示当前文件的
"let Tlist_Show_One_File=1
"不同时显示多个文件的tag,只显示当前文件的
"
"如果taglist窗口是最后一个窗口,则退出vim
let Tlist_Exit_OnlyWindow=1
"如果taglist窗口是最后一个窗口,则退出vim
"
"在右侧窗口中显示taglist窗口
let Tlist_Use_Right_Window = 1
"在右侧窗口中显示taglist窗口
"
"在左侧窗口中显示taglist窗口
"let Tlist_Use_Left_Window = 1
"在左右侧窗口中显示taglist窗口
"
" 缺省情况下,在双击一个tag时,才会跳到该tag定义的位置
let Tlist_Use_SingleClick= 1
" 缺省情况下,在双击一个tag时,才会跳到该tag定义的位置
"
"在启动VIM后,自动打开taglist窗口
"let Tlist_Auto_Open=1
"在启动VIM后,自动打开taglist窗口
" "taglist始终解析文件中的tag,不管taglist窗口有没有打开
"let Tlist_Process_File_Always=1
"taglist始终解析文件中的tag,不管taglist窗口有没有打开
"
"同时显示多个文件中的tag时,可使taglist只显示当前文件tag,其它文件的tag都被折叠起来
let Tlist_File_Fold_Auto_Close=1
"同时显示多个文件中的tag时,可使taglist只显示当前文件tag,其它文件的tag都被折叠起来
""}}}
"教你高效地浏览源码 -- 插件: TagList
"当查看源码是使用 -- 插件 : Cscope
"是否使用 quickfix 窗口来显示 cscope 结果"{{{
set cscopequickfix=s-,c-,d-,i-,t-,e-
"0 或 s 查找本 C 符号(可以跳过注释)
"1 或 g 查找本定义
"2 或 d 查找本函数调用的函数 --可以到函数的定义处
"3 或 c 查找调用本函数的函数 --该函数被谁调用
"4 或 t 查找本字符串
"6 或 e 查找本 egrep 模式
"7 或 f 查找本文件
"8 或 i 查找包含本文件的文件
"ctrl + o 可以返回
nmap s :cs find s =expand("")
nmap g :cs find g =expand("")
nmap c :cs find c =expand("")
nmap t :cs find t =expand("")
nmap e :cs find e =expand("")
nmap f :cs find f =expand("")
nmap i :cs find i ^=expand("")$
nmap d :cs find d =expand("")
"使用方法
"生成一个 cscope 的数据库
"1.cd /usr/src/linux/
"2.cscope -Rbq
"cs add /usr/src/linux/cscope.out /usr/src/linux/
"reset : 重新初始化所有连接. 用法 : cs reset
"
"1.下载cscope包 http://cscope.sourceforge.net/
"2.安装cscope A../configure B.make C.make install
"3.修改set csprg 位置:/usr/bin/cscope
"4.F3
"5.测试(1)cscope find g 函数名 (2) cscope find c 函数名
"6. :cw 显示多个结果
"
"下面是shell脚本,放到源码目录下运行
"#!/bin/sh
"find . -name "*.h" -o -name "*.c" -o -name "*.cc" > cscope.files
"cscope -bkq -i cscope.files
"ctags -R
"上面是shell脚本,放到源码目录下运行
"
"下面是对cscope -Rbkq 的解释
"-R: 在生成索引文件时,搜索子目录树中的代码
"-b: 只生成索引文件,不进入cscope的界面
"-k: 在生成索引文件时,不搜索/usr/include目录
"-q: 生成cscope.in.out和cscope.po.out文件,加快cscope的索引速度
"下面是对cscope -Rbkq 的解释
"
"-------------当前使用 快键---------- "noremap :!./vitags.sh:cs reset noremap :! cscope -Rbq:cs reset " "cscope和ctags的兼容问题
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
set cscopetag
endif
"cscope和ctags的兼容问题
":help if_cscop.txt
":cs show
"}}}
"当查看源码是使用 -- 插件 : Cscope
"利用c.vim插件实现,下载后解压到~/.vim中
"1.添加文件头注释(自动完成)"{{{
"2.添加c函数(标准模式执行\if, 再输入函数名)
"3.添加main函数(标准模式执行\im)
"4.添加函数注释 (标准模式执行\cfu)
"5.添加注释框架 (标准模式执行\cfr)
"6.添加头文件 (标准模式执行\p<包含头文件或 \p"包含头文件)
"7.添加宏定义 (标准模式执行\pd)
"8.添加代码片段
"(标准模式执行\nr,需在~/.vim/c-support/codesnippets/中加入存放代码的文件)
filetype plugin on
"}}}
"利用c.vim插件实现,下载后解压到~/.vim中
"----------------------
"利用 插件 丰富 功能
"----------------------
" 临时
""{{{
"set tags+=/home/linux/u-boot-1.3.1/tags
"set tags+=/usr/src/linux-headers-2.6.27-7/include/
"noremap :set tags+=/usr/src/linux/tags
"noremap :set tags=./tags
noremap :cs add /usr/src/linux/cscope.out /usr/src/linux/
""}}}
" 临时
发表评论
-
meego开发的学习路线
2012-01-20 12:17 596meego开发的学习路线 201 ... -
如何编写PHP扩展
2012-01-20 12:17 751如何编写PHP扩展 2010年0 ... -
转载 gcc一般用法
2012-01-20 12:17 683转载 gcc一般用法 2011年01月13日 生成特定格 ... -
自己动手编写嵌入式Bootloader之(3)
2012-01-20 12:17 636自己动手编写嵌入式Bootloader之(3) 2011年0 ... -
python
2012-01-19 16:59 1294python 2011年10月10日 dive into ... -
Python,简单的力量
2012-01-19 16:59 921Python,简单的力量 2010年 ... -
实例教程:1小时学会Python
2012-01-19 16:59 727实例教程:1小时学会Pytho ... -
python sys
2012-01-19 16:59 705python sys 2011年05月09日 ... -
乡土菜
2012-01-17 06:44 783乡土菜 2011年12月18日 涓 -
vc socket api建立TCP连接(包括域名解析)并收发数据的代码模板
2012-01-16 05:25 1785vc socket api建立TCP连接( ... -
使用NSStream来实现Socket
2012-01-16 05:25 711使用NSStream来实现Socket 2011年03月03 ... -
select函数
2012-01-16 05:25 678select函数 2011年12月31日 原文:http ... -
《ASCE1885的网络编程》---Winsock APIの套接口I/O处理函数
2012-01-16 05:25 1031《ASCE1885的网络编程》---Winsock APIの套 ... -
C# Socket通信三大问题详解
2012-01-16 05:25 1168C# Socket通信三大问题详解 2009年09月20日 ...
相关推荐
vim setting, vim设置,描述一定要长,描述一定要长
vim setting in windows
:改善 vim 对 js 的高亮和语法支持。 :直接拷贝的,并修改、添加了对 self 的支持。 :语法检查。 :检查python代码是否符合 pep8规范。 :插件管理。 : indent improved : zen coding in vim, a tutorial is here ...
vim myvimrepo(old vim setting)相关设定说明$\vim\vimrc Your personal vimrc. $\vim\viminfo Dynamic info for 'viminfo'. 记录你编辑过的档案$\vim\vimfiles\ftplugin*.vim 'Filetype plugins 你要加入的套件' $\...
这是我自己一直使用VIM 的一些设置, 仅供参考
7. Setting up connection information |dbext-connect| 7.1 Connection Parameters |dbext-connect-parameters| 7.2 Prompting for Parameters |dbext-connect-prompting| 7.3 Connection profiles |dbext-...
NULL 博文链接:https://anonymousstone.iteye.com/blog/1120809
vim配置相关 .vimrc coc-settings 各种插件
" --fold setting --- set foldmethod=syntax "用语法高亮来定义折叠 set foldlevel=100 "启动vim时不要自动折叠代码 set foldcolumn=5 "设置折叠栏宽度 常用命令: za 打开/关闭在光标下的折叠 zA 循环地打开/关闭...
Monokai 主题从 Textmate 到 Vim。
设置: 在您的主目录中添加文件夹“ vim”,文件夹“ tags”,文件“ vimrc”,文件“ ycm_extra_conf.py”(cd〜) 将名称“ vim”,“标签”,“ vimrc”,“ ycm_extra_conf.py”修改为“ .vim”,“标签”,....
Sublime-Like-Vim 这个存储库使 Sublime-Text-like-Vim 环境...下载此存储库并执行 vim-setting.py。 如果它返回“Completed Sublime-Like-Vim 安装没有错误”。 留言,都搞定了。 您可以在安装后删除下载的文件。
- 在 vscode-vim 插件的 setting.json 中设置 ``` "vim.useSystemClipboard": true, "vim.autoSwitchInputMethod.enable": true, "vim.autoSwitchInputMethod.defaultIM": "1033", "vim....
服务器规范片段 这是vim 片段。 从上 。 要求 安装 文德尔 设置包管理器 为设置包 ... " setting example let g: neosnippet #snippets_directory = [ \' ~/.vim/snippets', \' ~/.vim/bundle/
vimplugin-cli 用于管理vim插件的CLI 支持: 用法: Usage: vimplugin [options] [command] Options: -V, --version output the version number ... customize [plugin] Open/Edit a plugin setting help [cmd
vim有编辑器之神的称谓,本资源就是设置脚本,插件安装管理
BoxSetting:我的编辑器设置-Vim,Tmux和ITERM:confetti_ball::party_popper:
布尔cVimrc设置通过命令'set' + <SETTING>启用,并通过命令'set' + no<SETTING>禁用(例如, set regexp和set noregexp ) 布尔cVimrc设置可以通过添加“!”来求逆。到最后 其他设置使用=定义,用作分隔符,并以let...
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' 设置Python3路径 export PYTHON...
Pycharm使用记录新建文件模板的使用新建测试文件新建Python脚步文件时点击下面的下拉框即可与vim快捷键冲突设置在File->Setting->Vim