vim 配置文件 .vimrc 脚本(Linux,Mac OS都可以用)
来源:互联网 发布:关于大数据的毕业设计 编辑:程序博客网 时间:2024/06/10 04:10
==========================================
” Filename : .vimrc
” Author : 弈心逐梦 yixzm
” Email : dreamstone_xiaoqw@163.com
” Create : 2013-04-09 参考网络资料,开始学习
” Repair : 2013-07-04 优化出认为满意的脚本
” Repair : 2016-08-01 多年后,再次探究优化
” Repair : 2017-08-31 根据现有使用习惯,总结
” Repair : 2017-09-19 Markdown编辑器重新整理
==========================================
显示行号
set nu
显示相对行号(方便使用ndd,nyy等命令)
set relativenumber
注:相对行号的设置vim7.2版本默认不可用。
自动缩进(auto),智能缩进(smart),C格式缩进
set aiset siset ci
table键缩进长度,换行缩进长度
set ts=4set sw=4
每行显示的字数
set textwidth=79
开启终端色(这个没感觉有什么用)
set shortmess=atIif &term=="xterm" set t_Co=8 set t_Sb=^[[4%dm set t_Sf=^[[3%dmendif
开启语法高亮(即编程语言关键字彩色显示)
syntax enablesyntax on
重要!!!在Mac电脑中,缺少
syntax on
会导致关键字不显示颜色
显示横、纵坐标的光标
set cursorlineset cursorcolumn
状态栏
set cmdheight=2set laststatus=2
光标距离底行的距离,体验很不错
set scrolloff=5
可以使用鼠标。在远程telnet或ssh的场景下也有效。
set mouse=a set selection=exclusiveset selectmode=mouse,key
搜索时不区分大小写
set incsearch
不生成.swp文件
set nobackupset nowbset report=0
” Autoadd
set nocp
设置颜色风格
colorscheme default
颜色风格可换知乎大V推荐的款式:slate、evening、desert、koehler等
取消高亮,否则会经常出现色块
set nohls
插件
filetype plugin onfiletype plugin indent onset tags+=tagsset autochdirset history=50
" inoremap ' ''<Esc>i " inoremap " ""<Esc>i " inoremap < <><Esc>i " inoremap ( ()<Esc>i " inoremap [ []<Esc>i " inoremap { {<CR>}<Esc>O
这几行是自动添加匹配的括号,现在不怎么写C++代码,所以我自己也不开启。
“===============================================================================
“分隔线:此后的内容尽量不加,时间久没有用了,我自己平时也基本用不上。
“===============================================================================
"-- omnicppcomplete setting --set completeopt=menu,previewset completeopt-=previewset completeopt=longest,menulet OmniCpp_MayCompleteDot = 1 " autocomplete with .let OmniCpp_MayCompleteArrow = 1 " autocomplete with ->let OmniCpp_MayCompleteScope = 1 " autocomplete with ::let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included fileslet OmniCpp_ShowPrototypeInAbbr = 1" show function prototype in popup windowlet OmniCpp_GlobalScopeSearch=1let OmniCpp_DisplayMode=1let OmniCpp_DefaultNamespaces=["std"]function Myadd() inoremap ' ''<Esc>i inoremap " ""<Esc>i inoremap < <><Esc>i inoremap ( ()<Esc>i inoremap [ []<Esc>i inoremap { {<CR>}<Esc>O inoremap > <c-r>=ClosePair('>')<CR> inoremap ) <c-r>=ClosePair(')')<CR> inoremap ] <c-r>=ClosePair(']')<CR>"" inoremap } <c-r>=CloseBracket('}')<CR> inoremap " <c-r>=QuoteDelim('"')<CR> inoremap ' <c-r>=QuoteDelim("'")<CR>endfunctionfunction Mydel() inoremap ' ' inoremap " " inoremap < < inoremap ( ( inoremap [ [ inoremap { {endfunctionfunction ClosePair(char) if getline('.')[col('.') - 1] == a:char return "\<Right>" else return a:char endifendffunction CloseBracket() if match(getline(line('.') + 1), '\s*}') < 0 return "\<CR>}" else return "\<Esc>j0f}a" endifendffunction QuoteDelim(char) let line = getline('.') let col = col('.') if line[col - 2] == "\\" "Inserting a quoted quotation mark into the string return a:char elseif line[col - 1] == a:char "Escaping out of the string return "\<Right>" else "Starting a string return a:char.a:char."\<Esc>i" endifendfunction" Colorconfig" Templetes""autocmd BufRead,BufNewFile *.h set filetype=c""let g: C_SourceCodeExtensions = 'h c cp ...'" :help c-support-comm-framelet g:SuperTabDefaultCompletionType="context"" Inoremapinoremap <F7> <Esc>:call Myadd()<CR>ainoremap <F8> <Esc>:call Mydel()<CR>ainoremap <F2> <Esc>:TlistOpen<CR>ainoremap <F3> <Esc>:TlistClose<CR>a" Defaultcall Myadd()
“=========================================================
“`
- vim 配置文件 .vimrc 脚本(Linux,Mac OS都可以用)
- vim 配置文件 .vimrc 脚本(Linux,Mac OS都可以用)
- linux vim 配置文件.vimrc
- Vim配置文件(.vimrc)
- vim 配置文件vimrc(二)
- vim配置文件 .vimrc
- vim配置文件例子(.vimrc)
- vim配置文件.vimrc
- vim配置文件 .vimrc
- VIM配置文件vimrc
- vim配置文件vimrc
- vim 配置文件 .vimrc
- VIM配置文件样本(~/.vimrc)
- Vim配置文件.vimrc
- vim配置文件.vimrc
- vim配置文件.vimrc
- VIM配置文件 .vimrc
- VIM配置文件vimrc
- 剑指offer——46.扑克牌顺子
- Android动画之逐帧动画(FrameAnimation)详解
- trim()在IE8和谷歌浏览器中的不同
- Active X控件在IE上自动下载并注册
- 链表的归并排序算法
- vim 配置文件 .vimrc 脚本(Linux,Mac OS都可以用)
- Android--Paint与Canvas用法
- Android垃圾回收算法
- C#根据条件设置datagridview行的颜色
- 《深入理解mybatis原理》 MyBatis事务管理机制
- Android动画之逐帧动画(Frame Animation)实例详解
- 数据结构与算法总结
- SpringMVC与Struct2的区别
- TCP---三次握手四次挥手