我的vimrc文件
vim的一直被称为神器,确实有很多优点,但是vim到一键编译实在是一个大问题,网络上有很多配置文件,但是大多都是同一份文件到复制粘贴,不太好用。
经过这么长时间到摸索,我终于在自己到电脑上配置好了vim,下面粘贴一下我到vimrc文件。
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian. " Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
set nocompatible " Vim5 and later versions support syntax highlighting. Uncommenting the
" following enables syntax highlighting by default. "设置字符编码
:set encoding=utf-
:set fileencodings=ucs-bom,utf-,cp936
:set fileencoding=utf-
:set termencoding=utf- if has("syntax")
syntax on " 语法高亮
endif
colorscheme ron " elflord ron peachpuff default 设置配色方案,vim自带的配色方案保存在/usr/share/vim/vim72/colors目录下 " detect file type
filetype on
filetype plugin on " If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark " Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"have Vim load indentation rules and plugins according to the detected filetype
filetype plugin indent on
endif " The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though. "set ignorecase " 搜索模式里忽略大小写
"set smartcase " 如果搜索模式包含大写字符,不使用 'ignorecase' 选项。只有在输入搜索模式并且打开 'ignorecase' 选项时才会使用。
set autowrite " 自动把内容写回文件: 如果文件被修改过,在每个 :next、:rewind、:last、:first、:previous、:stop、:suspend、:tag、:!、:make、CTRL-] 和 CTRL-^命令时进行;用 :buffer、CTRL-O、CTRL-I、'{A-Z0-9} 或 `{A-Z0-9} 命令转到别的文件时亦然。
set autoindent " 设置自动对齐(缩进):即每行的缩进值与上一行相等;使用 noautoindent 取消设置
set smartindent " 智能对齐方式
set tabstop= " 设置制表符(tab键)的宽度
set softtabstop= " 设置软制表符的宽度
set shiftwidth= " (自动) 缩进使用的4个空格
set cindent " 使用 C/C++ 语言的自动缩进方式
set cinoptions={,1s,t0,n-,p2s,(03s,=.5s,>1s,=1s,:1s "设置C/C++语言的具体缩进方式
"set backspace=2 " 设置退格键可用
set showmatch " 设置匹配模式,显示匹配的括号
set linebreak " 整词换行
set whichwrap=b,s,<,>,[,] " 光标从行首和行末时可以跳到另一行去
"set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes) "使用鼠标
set number " Enable line number "显示行号
"set previewwindow " 标识预览窗口
set history= " set command history to 50 "历史记录50条 "--状态行设置--
set laststatus= " 总显示最后一个窗口的状态行;设为1则窗口数多于一个的时候显示最后一个窗口的状态行;0不显示最后一个窗口的状态行
set ruler " 标尺,用于显示光标位置的行号和列号,逗号分隔。每个窗口都有自己的标尺。如果窗口有状态行,标尺在那里显示。否则,它显示在屏幕的最后一行上。 "--命令行设置--
set showcmd " 命令行显示输入的命令
set showmode " 命令行显示vim当前模式 "--find setting--
set incsearch " 输入字符串就显示匹配点
set hlsearch "设置一键编译
map <F5> :call CompileRunGcc()<CR>
imap <F5> <ESC>:call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
exec "cd %:p:h"
if &filetype == 'c'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'java'
exec "!javac %"
exec "!java %<"
elseif &filetype == 'sh'
:!./%
endif
endfunc "设置pathonen插件可用
execute pathogen#infect() " About NERDTree
noremap :<F2> NERDTreeToggle
autocmd vimenter * if !argc() | NERDTree | endif "open a NERDTree automatically when vim starts up if no files were specified
autocmd bufenter * if (winnr("$") == && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif " TagBar 自动生成参数和方法
" Then the F8 key will toggle the Tagbar window.
nmap :<F8> TagbarToggle "syntastic 保存检查代码时候传入参数
let g:syntastic_java_javac_args="-cp ../../lib:../../bin -sourcepath ../../bin -Djava.ext.dirs=../../lib -d ../../bin" " 关于Java自动文件补全插件
autocmd Filetype java set omnifunc=javacomplete#Complete
autocmd Filetype java set completefunc=javacomplete#CompleteParamsInf
这里只是我的电脑里面到配置,个人不保证在其他人到电脑里也好用。
引用成神到一句话:工具都是用出来到,不是学出来的。
所以如果想用好vim,还是要在平时多多到使用,然后遇到不方便到东西就google,慢慢到就会越用越好用了。
加油。
引用了大神关于一键编译到配置:http://www.voidcn.com/blog/u010734277/article/p-6021225.html。
我的vimrc文件的更多相关文章
- Linux上 .vimrc文件
在Linux上面对VIM编辑器的格式的设置通常可以提升工作效率,下面对工作机器上的.vimrc文件的内容进行一总结,以备后续的查询 set smarttab set tabstop=4 set shi ...
- .vimrc文件配置及航意
1. vimrc文件常见语句释义 设定 tab 的位置 :set tabstop=4 输入 tab 时自动将其转化为空格 :set expandtab ...
- 个人vim配置(.vimrc文件分享)
syntax enable syntax on colorscheme desert set nu! set nowrap set nobackup set backspace= set tabsto ...
- Linux 下 Vi 配置文件 .vimrc 文件
Linux 下 Vi 配置文件 .vimrc 文件 配置 vim 的方法是在用户主目录下建立个.vimrc文件,我一般使用root帐户,所以就在/root/下建立一个.vimrc文件:vi /root ...
- Vim的行号、语法显示等设置(.vimrc文件的配置)以及乱码解决
在终端下使用vim进行编辑时,默认情况下,编辑的界面上是没有显示行号.语法高亮度显示.智能缩进 等功能的.为了更好的在vim下进行工作,需要手动设置一个配置文件:.vimrc.在启动vim时,当前用户 ...
- Vim插件及.vimrc文件的配置
关于Vim的配置基本是在.vimrc文件中完成的,该文件一般放在用户目录下. 今天安装了插件管理器Pathogen和python自动补全的插件pydiction,其中Pathogen需要事先创建两个文 ...
- Vim---配置实用的.vimrc文件
配置自己电脑的vim,配置一个根据个人习惯使用的.vimrc文件.我的有以下功能等,读者可以根据自己的 个人喜好去配置自己的vim. 1.自动插入文件头 ,新建C.C++源文件时自动插入表头:包括文件 ...
- .vimrc文件配置及含意
1. vimrc文件常见语句释义 设定 tab 的位置 :set tabstop=4 输入 tab 时自动将其转化为空格 :set expandtab ...
- vim 配置.vimrc文件
下面这个.vimrc文件是根据公司里的一个前辈配置的,这里记录下,方便以后使用.它的功能,其实跟网上很多.vimrc配置的相比,还是小儿科.我记录下来,主要还是因为自己已经习惯了这个工作环境跟快捷键. ...
随机推荐
- SqlServer数据库1433端口问题1
在本地使用telnet ip 1433 命令测试数据库1433端口是否打开,总是提示错误,根据网上查找资料总结了如下两点思路供参考,欢迎指正! (1)第一种情况可能是"Telnet客户端& ...
- a<<=n
a<<=n等价于a=a<<na<<n表示a左移n位(二进制)等价于a乘以2的n次方 a<<=n的含义就是,a等于a乘以2的n次方
- 手写Json转换
在做项目的时候总是要手动将集合转换成json每次都很麻烦,于是就尝试着写了一个公用的方法,用于转换List to json: using System; using System.Collection ...
- DotNetBar ComboBoxEx
DotNetBar ComboBoxEx using System; using System.ComponentModel; using System.Drawing; using System.R ...
- Handler(2)
andriod提供了Handler 和 Looper 来满足线程间的通信.Handler先进先出原则.Looper类用来管理特定线程内对象之间的消息交换(MessageExchange). 1)Loo ...
- Java Nio Socket通讯
Server端: #############服务器端连接请求处理############### public class MultiplexerServer implements Runnable { ...
- iOS_Objective-C測试
1. iOS中程序正常载入UIViewControlle时,下面四个方法哪个最先运行? A.viewVillAppear B.viewDidLoad C.viewDidAppear D.viewWil ...
- JavaScript 数组去重并统计重复元素出现的次数
1.方法一 var arr = [1, 2, 3, 1, 2, 4]; function arrayCnt(arr) { var newArr = []; for(var i = 0; i < ...
- 机器学习系列(8)_读《Nature》论文,看AlphaGo养成
作者:viewmode=contents">龙心尘 && viewmode=contents">寒小阳 时间:2016年3月. 出处:http://bl ...
- macOS中安装docker
如官方文档中所说: 1.点击进入boot2docker/osx-installer release页面. 2.在下载页面中点击 Boot2Docker-x.x.x.pkg 来下载 Boot2Docke ...