vimrc 配置
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below. If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.
" 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.
runtime! debian.vim
" 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 compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
syntax on
endif
" 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("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
" 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 showcmd " Show (partial) command in status line.
"set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
"set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set autowriteall
"set mouse=a " Enable mouse usage (all modes)
"~/.vimrc
" YouCompleteMe
set runtimepath+=~/.vim/bundle/YouCompleteMe
let g:ycm_collect_identifiers_from_tags_files = 1 " 开启 YCM 基于标签引擎
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释与字符串中的内容也用于补全
let g:syntastic_ignore_files=[".*\.py$"]
let g:ycm_seed_identifiers_with_syntax = 1 " 语法关键字补全
let g:ycm_complete_in_comments = 1
let g:ycm_confirm_extra_conf = 0
let g:ycm_key_list_select_completion = ['<c-n>', '<Down>'] " 映射按键, 没有这个会拦截掉tab, 导致其他插件的tab不能用.
let g:ycm_key_list_previous_completion = ['<c-p>', '<Up>']
let g:ycm_complete_in_comments = 1 " 在注释输入中也能补全
let g:ycm_complete_in_strings = 1 " 在字符串输入中也能补全
let g:ycm_collect_identifiers_from_comments_and_strings = 1 " 注释和字符串中的文字也会被收入补全
let g:ycm_global_ycm_extra_conf='~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_show_diagnostics_ui = 0 " 禁用语法检查
inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>" | " 回车即选中当前项
nnoremap <c-j> :YcmCompleter GoToDefinitionElseDeclaration<CR>| " 跳转到定义处
"let g:ycm_min_num_of_chars_for_completion=2 " 从第2个键入字符就开始罗列匹配项
let g:ycm_server_python_interpreter='/usr/bin/python2.7'
let g:ycm_global_ycm_extra_conf='~/.vim/.ycm_extra_conf.py'
set nocompatible " be iMproved
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
"let Vundle manage Vundle
" required!
Bundle 'indentLine/indentLine'
Bundle 'scrooloose/syntastic'
Bundle 'gmarik/vundle'
" My bundles here:
"
" original repos on GitHub
Bundle 'tpope/vim-fugitive'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'tpope/vim-rails.git'
" vim-scripts repos
Bundle 'L9'
Bundle 'FuzzyFinder'
" non-GitHub repos
Bundle 'git://git.wincent.com/command-t.git'
" Git repos on your local machine (i.e. when working on your own plugin)
Bundle 'file:///Users/gmarik/path/to/plugin'
" ...
Bundle 'Valloric/YouCompleteMe'
filetype plugin indent on " required!
"javacomplete
setlocal omnifunc=javacomplete#Complete
autocmd Filetype java set omnifunc=javacomplete#Complete
autocmd Filetype java set completefunc=javacomplete#CompleteParamsInf
inoremap <buffer> <C-X><C-U> <C-X><C-U><C-P>
inoremap <buffer> <C-S-Space> <C-X><C-U><C-P>
autocmd Filetype java,javascript,jsp inoremap <buffer> . .<C-X><C-O><C-P>
"增加横线
"autocmd InsertLeave * se nocul " 用浅色高亮当前行
"autocmd InsertEnter * se cul " 用浅色高亮当前行
set cursorline
"highlight CursorLine guibg=lightblue ctermbg=lightgray
"去掉注释看不清的效果
colorscheme desert
"tab 键显示竖线
"set list lcs=tab:\|\
let g:indentLine_char='|'
let g:indentLine_enabled = 1
"let g:indentLine_setColors = 0
" Source a global configuration file if available
filetype plugin indent on
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif
set fileencodings=utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
set fileformats=unix
"set encoding=prc
set encoding=utf-8
"
"显示行号
set number
"修改vim的tab,使其占4个空格
set tabstop=4
set tags=tags
set tags+=./tags "add current directory's generated tags file
set tags+=/usr/tags "add current directory's generated tags file
set laststatus=2
set softtabstop=4
set shiftwidth=4
set cindent
"set ff
set autowrite
set ruler
set previewwindow " 标识预览窗口
set showcmd " 命令行显示输入的命令
set showmode " 命令行显示vim当前模式
"--find setting--
set incsearch " 输入字符串就显示匹配点
" 设置状态栏的颜色
highlight StatusLine cterm=bold ctermfg=yellow ctermbg=Darkblue
function! CurDir()
let curdir = substitute(getcwd(), $HOME, "~", "g")
return curdir
endfunction
set statusline=[%n]\ %f%m%r%h\ \|\ format:\ %{&fileformat}\ \|\ \ pwd:\ %{CurDir()}\ \ \|%=\|\ %l,%c\ %p%%\ \|\ ascii=%b,hex=0x%B%{((&fenc==\"\")?\"\":\"\ \|\ \".&fenc)}\ \|\ %{$USER}\ @\ %{hostname()}\
if &term=="xterm"
set t_Co=8
set t_Sb=^[[4%dm
set t_Sf=^[[3%dm
endif
"进行版权声明的设置
"添加或更新头
map <F4> :call TitleDet()<cr>'s
function AddTitle()
call append(line("."),"/*=============================================================================")
call append(line(".")+1,"#")
call append(line(".")+2,"# Author: dantezhu - dantezhu@vip.qq.com")
call append(line(".")+3,"#")
call append(line(".")+4,"# QQ : 327775604")
call append(line(".")+5,"#")
call append(line(".")+6,"# Last modified: ".strftime("%Y-%m-%d %H:%M"))
call append(line(".")+7,"#")
call append(line(".")+8,"# Filename: ".expand("%:t"))
call append(line(".")+9,"#")
call append(line(".")+10,"# Description: ")
call append(line(".")+11,"#")
call append(line(".")+12,"=============================================================================*/")
" echohl WarningMsg | echo "Successful in adding the copyright." | echohl None
endfunction
"更新最近修改时间和文件名
function UpdateTitle()
normal m'
execute '/# *Last modified:/s@:.*$@\=strftime(":\t%Y-%m-%d %H:%M")@'
normal ''
normal mk
execute '/# *Filename:/s@:.*$@\=":\t\t".expand("%:t")@'
execute "noh"
normal 'k
echohl WarningMsg | echo "Successful in updating the copy right." | echohl None
endfunction
"判断前10行代码里面,是否有Last modified这个单词,
"如果没有的话,代表没有添加过作者信息,需要新添加;
"如果有的话,那么只需要更新即可
function TitleDet()
call AddTitle()
return
let n=1
"默认为添加
while n < 10
let line = getline(n)
if line =~ '^\#\s*\S*Last\smodified:\S*.*$'
call UpdateTitle()
return
endif
let n = n + 1
endwhile
call AddTitle()
endfunction
vimrc 配置的更多相关文章
- vimrc配置-新建文件时自动生成文件头
vimrc配置-新建文件时自动生成文件头 auto add file header autocmd BufNewFile *.py 0r /home/zxkletters/.vim/vim_te ...
- Linux大棚版vimrc配置
Linux大棚版vimrc配置—V2.0版本,如下: [shell] $cat .vimrc “== “Author :roc “Website:roclinux.cn “Version:2.0 “= ...
- vimrc配置
"=========================================================================" DesCRiption 适合 ...
- 我在linux中使用的vundle 和 vimrc配置
set nocompatible filetype off set rtp+=~/.vim/bundle/vundle/ call vundle#rc() Plugin 'gmarik/vundle' ...
- 我的.vimrc配置
termux平台下,通过pkg update && pkg upgrade && pkg install vim来获得vim.可是,当我配置.vimrc时发现如果我每在 ...
- vim的vimrc配置
windows "# modified by Neoh set helplang=cn "使用中文帮助文档 set encoding=utf-8 "查看utf-8格式的帮 ...
- cygwin下的vim 的vimrc配置
1.一直接照 vim 在linux的配置使用 cygwin下的 vi. vim --version 之后,出现了帮助...
- Vimrc配置以及Vim的常用操作
""""""""""""""""&quo ...
- 我的vimrc配置
fankcoder@fankcoder:~$ cat ~/.vimrclet Tlist_Auto_Highlight_Tag=1 let Tlist_Auto_Open=1 let Tlist_Au ...
- vimrc 配置支持backspace
在vimrc中添加: set nocompatible set backspace=indent,eol,start
随机推荐
- Mysql学习---基础操作学习2
基本数据类型 Mysql基本数据类型:二进制,数值[整数,小数].字符串[定长,变长]. 二进制数据.时间和枚举集合 bit[(M)] 二进制位(101001),m表示二进制位的长度(1-64),默认 ...
- std::vector的内存释放
先上一段代码 using namespace std; class A{ public: ~A(){ cout << "deconstruct"; }; }; #inc ...
- 四、HTTP和HTTPS的区别
1:简介 超文本传输协议HTTP协议被用于在Web浏览器和网站服务器之间传递信息.HTTP协议以明文方式发送内容,不提供任何方式的数据加密,如果攻击者截取了Web浏览器和网站服务器之间的传输报文,就可 ...
- 2018.09.23模拟总结(T2)
T1,T3我就不说啦,反正也不会.主要想讲的是T2. T2用了一个神奇的算法:折半搜索. 因为这个坑爹的数据范围告诉我们暴搜或是状压会TLE,而一半刚好能卡过去. 折半搜索其实跟暴搜没什么区别,就是折 ...
- LVS的DR模式负载均衡
参考项目:http://www.cnblogs.com/along21/p/7833261.html#auto_id_3 LVS的DR模式实现负载均衡 1.环境 lvs-server :192.168 ...
- 学习openGL一——配置环境
openGL支持很多语言,C#, Java, Python, 和Lua.如果你没有使用C/C++,你必须下载和安装一个openGL包或库. 如果你使用了C/C++,你必须先建立一个编译环境,visua ...
- 关于JWT.NET
1.JWT的概念: JWT全称是Json Web Token,是一种用于双方之间传递安全信息的简洁的.URL安全的表述性声明规范.JWT作为一个开放的标准( RFC 7519 ),定义了一种简洁的,自 ...
- 根据身份证获取地址(mysql)
e Encoding : Date: :: */ ; -- ---------------------------- -- Table structure for `s_area_code` -- - ...
- react系列(零)安装
安装 在最初的阶段,可以使用在线编辑的网站来学习React基本的语法. 从 Hello World 开始,可以在Codepen,或者codesandbox上进行编写. 当然,也可以使用npm或者yar ...
- App升级iOS7体会
本文转自App升级iOS7体会. xcode5 GM版已经发布,虽然还是pre-release版,但离最终版不远了.对于没有用到新特性的app面临的最大问题就是UI的变化.Apple提供了UI Tra ...