gvim 二进制_GVim配置文件_vimrc
let mapleader = ";" " 比较习惯用;作为命令前缀,右手小拇指直接能按到" 把空格键映射成:
nmap :" 快捷打开编辑vimrc文件的键盘绑定
map ee :e $HOME/.vimrcautocmd! bufwritepost *.vimrc source $HOME/.vimrc" ^z快速进入shell
nmap :shellinoremapn
" 判断操作系统
if (has("win32") || has("win64") || has("win32unix"))
let g:isWin= 1
elselet g:isWin= 0endif" 判断是终端还是gvim
if has("gui_running")
let g:isGUI= 1
elselet g:isGUI= 0endif
set nocompatible" 关闭兼容模式
syntax enable " 语法高亮
filetype plugin on " 文件类型插件
filetype indent on
set shortmess=atI " 去掉欢迎界面
set autoindent
autocmd BufEnter*:syntax sync fromstart
set nu" 显示行号
set showcmd " 显示命令
set lz " 当运行宏时,在命令执行完成之前,不重绘屏幕
set hid " 可以在没有保存的情况下切换buffer
set backspace=eol,start,indent
set whichwrap+=,h,l " 退格键和方向键可以换行
set incsearch " 增量式搜索
set nohlsearch"set hlsearch "高亮搜索
set ignorecase" 搜索时忽略大小写
set magic " 额,自己:h magic吧,一行很难解释
set showmatch " 显示匹配的括号
set nobackup " 关闭备份
set nowb
set noswapfile" 不使用swp文件,注意,错误退出后无法恢复
set lbr " 在breakat字符处而不是最后一个字符处断行
set ai " 自动缩进
set si " 智能缩进
set cindent " C/C++风格缩进
set wildmenu
set nofen
set fdl=10
" tab转化为4个字符
set expandtab
set smarttab
set shiftwidth=4set tabstop=4
" 不使用beep或flash
set vb t_vb=set background=dark
set t_Co=256colorscheme xoria256
set history=400 " vim记住的历史操作的数量,默认的是20
set autoread " 当文件在外部被修改时,自动重新读取
set mouse=n " 在所有模式下都允许使用鼠标,还可以是n,v,i,c等
"在gvim中高亮当前行
if(g:isGUI)
set cursorline
colorscheme wombat
hi cursorline guibg=#333333hi CursorColumn guibg=#333333
"set guifont=Consolas\ 10
"set guifontwide=Consolas\ 10
set guifont=DejaVu\ Sans\ Mono\ 10set gfw=DejaVu\ Sans\ Mono\ 10
" 不显示toolbar
set guioptions-=T" 不显示菜单栏
"set guioptions-=m
endif" 设置字符集编码,默认使用utf8
if(g:isWin)
let&termencoding=&encoding " 通常win下的encoding为cp936
set fileencodings=utf8,cp936,ucs-bom,latin1elseset encoding=utf8
set fileencodings=utf8,gb2312,gb18030,ucs-bom,latin1
endif" 状态栏
set laststatus=2 " 总是显示状态栏
highlight StatusLine cterm=bold ctermfg=yellow ctermbg=blue" 获取当前路径,将$HOME转化为~
function!CurDir()
let curdir= substitute(getcwd(), $HOME, "~", "g")returncurdir
endfunction
set statusline=[%n]\ %f%m%r%h\ \|\ \ pwd:\ %{CurDir()}\ \ \|%=\|\ %l,%c\ %p%%\ \|\ ascii=%b,hex=%b%{((&fenc==\"\")?\"\":\"\ \|\ \".&fenc)}\ \|\ %{$USER}\ @\ %{hostname()}\
" 第80列往后加下划线"au BufWinEnter * let w:m2=matchadd('Underlined', '\%>' . 80 . 'v.\+', -1)
" 根据给定方向搜索当前光标下的单词,结合下面两个绑定使用
function!VisualSearch(direction) range
let l:saved_reg= @" execute "normal! vgvy"let l:pattern= escape(@", '\\/.*$^~[]')
let l:pattern = substitute(l:pattern, "\n$", "", "")if a:direction == 'b'execute"normal ?" . l:pattern . ""
elseexecute"normal /" . l:pattern . ""endif
let @/ =l:pattern
let @" = l:saved_reg
endfunction" 用 */# 向 前/后 搜索光标下的单词
vnoremap * :call VisualSearch('f')vnoremap # :call VisualSearch('b')
" 在文件名上按gf时,在新的tab中打开"map gf :tabnew
" 用c-j,k在buffer之间切换
nn :bnnn :bp
" Bash(Emacs)风格键盘绑定
imap imap
"imap d0i"imap d$i "与自动补全中的绑定冲突"从系统剪切板中复制,剪切,粘贴
map "+y
map "+x
map "+p
" 恢复上次文件打开位置
set viminfo='10,\"100,:20,%,n~/.viminfo
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif" 删除buffer时不关闭窗口
command! Bclose call BufcloseCloseIt()
function! BufcloseCloseIt()
let l:currentBufNum= bufnr("%")
let l:alternateBufNum= bufnr("#")ifbuflisted(l:alternateBufNum)
buffer #elsebnext
endifif bufnr("%") ==l:currentBufNumnewendififbuflisted(l:currentBufNum)
execute("bdelete! ".l:currentBufNum)
endif
endfunction" 快捷输入" 自动完成括号和引号
inoremap 1 ():let leavechar=")"i
inoremap2 []:let leavechar="]"i
inoremap3 {}:let leavechar="}"i
inoremap4 {o}:let leavechar="}"O
inoremapq '':let leavechar="'"i
inoremapw "":let leavechar='"'i" 插件窗口的宽度,如TagList,NERD_tree等,自己设置
let s:PlugWinSize = 25
" taglist.vim" http://www.vim.org/scripts/script.php?script_id=273" t 打开TagList窗口,窗口在右边
nmap t :TlistToggle
"let Tlist_Ctags_Cmd = '/usr/bin/ctags'
let Tlist_Show_One_File = 0let Tlist_Exit_OnlyWindow= 1let Tlist_Use_Right_Window= 1let Tlist_File_Fold_Auto_Close= 1let Tlist_GainFocus_On_ToggleOpen= 0let Tlist_WinWidth=s:PlugWinSize
let Tlist_Auto_Open= 0let Tlist_Display_Prototype= 0
"let Tlist_Close_On_Select = 1
" OmniCppComplete.vim" http://www.vim.org/scripts/script.php?script_id=1520
set completeopt=menu
let OmniCpp_ShowPrototypeInAbbr= 1let OmniCpp_DefaultNamespaces= ["std"] " 逗号分割的字符串
let OmniCpp_MayCompleteScope = 1let OmniCpp_ShowPrototypeInAbbr= 0let OmniCpp_SelectFirstItem= 2
" c-j自动补全,当补全菜单打开时,c-j,k上下选择
imap pumvisible()?"\":"\"imap pumvisible()?"\":"\"
" f:文件名补全,l:行补全,d:字典补全,]:tag补全
imap imapimapimap
" NERD_commenter.vim" http://www.vim.org/scripts/script.php?script_id=1218" Toggle单行注释/“性感”注释/注释到行尾/取消注释
map cc ,cmapcs ,cs
mapc$ ,c$
mapcu ,cu" NERD tree" http://www.vim.org/scripts/script.php?script_id=1658
let NERDTreeShowHidden = 1let NERDTreeWinPos= "left"let NERDTreeWinSize=s:PlugWinSize
nmapn :NERDTreeToggle
" DoxygenToolkit.vim" http://www.vim.org/scripts/script.php?script_id=987" 暂时没有使用
" 更新ctags和cscope索引" href: http://www.vimer.cn/2009/10/把vim打造成一个真正的ide2.html" 稍作修改,提取出DeleteFile函数,修改ctags和cscope执行命令
map :call Do_CsTag()function!Do_CsTag()
let dir=getcwd()"先删除已有的tags和cscope文件,如果存在且无法删除,则报错。
if ( DeleteFile(dir, "tags") )returnendifif ( DeleteFile(dir, "cscope.files") )returnendifif ( DeleteFile(dir, "cscope.out") )returnendifif(executable('ctags'))
silent! execute "!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ."endifif(executable('cscope') && has("cscope") )if(g:isWin)
silent! execute "!dir /s/b *.c,*.cpp,*.h,*.java,*.cs >> cscope.files"
elsesilent! execute "!find . -iname '*.[ch]' -o -name '*.cpp' > cscope.files"endif
silent! execute "!cscope -b"execute"normal :"
if filereadable("cscope.out")
execute"cs add cscope.out"endif
endif" 刷新屏幕
execute "redr!"endfunction
function!DeleteFile(dir, filename)iffilereadable(a:filename)if(g:isWin)
let ret= delete(a:dir."\\".a:filename)elselet ret= delete("./".a:filename)
endifif (ret != 0)
echohl WarningMsg| echo "Failed to delete ".a:filename |echohl Nonereturn 1
else
return 0endif
endifreturn 0endfunction" cscope 绑定
if has("cscope")
set csto=1set cst
set nocsverbif filereadable("cscope.out")
cs add cscope.out
endif
set csverb" s: C语言符号 g: 定义 d: 这个函数调用的函数 c: 调用这个函数的函数
" t: 文本 e: egrep模式 f: 文件 i: include本文件的文件
nmap ss :cs find s =expand(""):copennmapsg :cs find g =expand("")nmapsc :cs find c =expand(""):copennmapst :cs find t =expand(""):copennmapse :cs find e =expand(""):copennmapsf :cs find f =expand(""):copennmapsi :cs find i ^=expand("")$:copennmapsd :cs find d =expand(""):copenendif" Quick Fix 设置
map :cwmap :cpmap :cn
" Buffers Explorer (需要genutils.vim)" http://vim.sourceforge.net/scripts/script.php?script_id=42" http://www.vim.org/scripts/script.php?script_id=197
let g:bufExplorerDefaultHelp=0 " Do not show default help.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
let g:bufExplorerSortBy='mru' " Sort by most recently used.
let g:bufExplorerSplitRight=0 " Split left.
let g:bufExplorerSplitVertical=1 " Split vertically.
let g:bufExplorerSplitVertSize = s:PlugWinSize " Split width
let g:bufExplorerUseCurrentWindow=1 " Open in new window.
autocmd BufWinEnter \[Buf\ List\] setl nonumber
nmapb :BufExplorer
" Vimwiki配置
let g:vimwiki_list = [{'path': '~/Dropbox/MyWiki/my_site/',
\'path-html': '~/Dropbox/MyWiki/my_site_html/',
\'html-header': '~/Dropbox/MyWiki/templates/header.tpl',
\'html-footer': '~/Dropbox/MyWiki/templates/footer.tpl'}]
let g:vimwiki_camel_case=0let wiki={}
let wiki.path= '~/Dropbox/MyWiki/my_site/'let wiki.nested_syntaxes= {'python': 'python', 'c++': 'cpp'}
let g:vimwiki_list=[wiki]"pythoncomplete配置
autocmd filetype python set omnifunc=pythoncomplete#Complete
gvim 二进制_GVim配置文件_vimrc相关推荐
- gvim 二进制_vim/gvim学习
一.VIM的历史 1976年左右Bill Joy开发了vi,他也是伯克利大学的毕业生,后来他跟其他人一起成立了Sun Microsystems公司并成为了Sun的首席科学家.一开始Bill开发了ex, ...
- gvim使用之配置_vimrc
使用技巧 % 可以让光标从它当前所在的括号跳转到与它相匹配的括号上去, 对花括号和 圆括号, 方括号都有效, 常用于手工检查括号是否匹对. 标记行再随时返回被标记的位置. m char (MARK) ...
- Linux二进制导出配置文件,Go打包二进制文件的实现
背景 众所周知,go语言可打包成目标平台二进制文件是其一大优势,如此go项目在服务器不需要配置go环境和依赖就可跑起来. 操作 需求:打包部署到centos7 笔者打包环境:mac os 方法:进入m ...
- windows上搭建python+gvim开发环境
参照了 http://www.cnblogs.com/xd502djj/archive/2010/09/16/1827683.html ,发现有些问题,所以修改了一些. Vim as Python I ...
- GVim中以十六进制方式打开文件
在windows下,有时我们想用GVim以十六进制形式来打开一个文件,下面就是不错的方法,将它作为一个右键菜单方式加入: 1. 将"GVim Hex"加入到右键菜单, 将以下内容添 ...
- gvim(win7版)和vundle,配置各种插件
博客链接:https://blog.csdn.net/sinat_28617733/article/details/102149185 本项中使用的所有插件:gvim,git,curl,vundle, ...
- Windows gvim安装插件
文章目录 1 Vundle 1.1 安装前准备 1.2 安装Vundle 1.3 编辑 _vimrc 1.4 插件安装示例 1.4.1 安装nerd comment 1.4.2 nerd commen ...
- Windows环境下 Gvim 安装 Vundle/Ctags/taglist
目录 一.安装Vundle for Windows 1.安装Git 2.安装Curl 3.安装Vundle 二.ctags下载与安装 1.生成Tag文件 2.代码的快速浏览 三.Taglist下载和安 ...
- GVIM编辑器的配置
Gvim编辑器的配置: 1. 在Gvim编辑器的配置文件中注释信息是使用"开始的 2. 配置 " 设置行号的显示 set nu " 设置字体的样式和字体的大小 set g ...
最新文章
- android如何展示富文本_android高仿今日头条富文本编辑(发布文章)
- 人性漫画:打工与创业的残酷区别……
- 重磅 | MIT启动IQ计划:研究人类智能,让全世界的机构共同合作
- windows搭建gcc开发环境(msys2) objdump
- latex 常用小结
- Linux GCC用法
- oracle中使用sys_connect_by_path进行表中行值连接
- python练习12
- java单例设计模式_Java设计模式之单例模式详解
- Android7.0 emui主题,全新EMUI5.0基于Android7.0 天生快,一生快!
- OpenShift 4 - DevSecOps (2) - 修复 RHACS 发现的安全隐患
- 骑行GPS导航套件:多普达D600+夏新GPS-166+灵图天行者9配合,伴我骑行千里
- Python3 OOP(一) 类和实例
- 一本通1261:【例9.5】城市交通路网
- MicroPython ESP32 读取DS18B20温度数据
- ios ipa文件分析
- 关于微信投票活动存在微信人工刷票数的情况解析
- 想做抖音手工号,没有思路创意怎么办?分析大V总结经验
- 产品经理常用的方法论有哪些
- dlib 面部表情跟踪