vimrc同步文档
vimrc
if has("syntax")
syntax on
endif
set nocompatible "取消vi 兼容模式
"{{{ paste mode f6,f7
:map <F6> :set paste<CR>
:map <F7> :set nopaste<CR>
:imap <F6> <C-O>:set paste<CR>
:imap <F7> <nop>
:set pastetoggle=<F6>
"}}}
"{{{ fold
set foldenable " 开始折叠
set foldmethod=syntax " 设置语法折叠
set foldcolumn=0 " 设置折叠区域的宽度
setlocal foldlevel=0 " 设置折叠层数
"set foldopen=all "光标到达折叠快时,自动打开
set foldclose=all " 离开代码块后,自动折叠
" 用空格键来开关折叠
nnoremap <space> zi
"}}}
set mouse=v "可视模式
set mouse=a " Enable mouse usage (all modes) 启用鼠标方便翻页,移动光标
set showmatch " Show matching brackets.
"set ignorecase " Do case insensitive matching
"set smartcase " Do smart case matching
set nobackup "no backup
set autoread " 设置当文件被改动时自动载入
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set nu "show line number
set ruler "show cursor site in right below
set tabstop=4 " 统一缩进为4
set shiftwidth=4
set incsearch " 输入字符串就显示匹配点
set hlsearch " 高亮度搜寻
set autoindent "自动缩进
set cindent
set completeopt=longest,menu
set completeopt=preview,menu "代码补全
"{{{start----- 自动补全 -----------------
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {<CR>}<ESC>O
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
"}}} "end--------------------------------
"----- 打开文件类型检测-----------------
filetype plugin indent on
au BufNewFile,BufRead *.h set filetype=h
"start---------- definition SetTitle() ------------------------------------
autocmd BufNewFile *.cpp,*.c,*.h,*.sh,*.java exec ":call SetTitle()"
func SetTitle()
if &filetype == 'sh'
call setline(1,"\#########################################################################")
call append(line("."), "\# File Name: ".expand("%"))
call append(line(".")+1, "\# Author: ims")
call append(line(".")+2, "\# Created Time: ".strftime("%c"))
call append(line(".")+3, "\#########################################################################")
call append(line(".")+4, "\#!/bin/bash")
call append(line(".")+5, "")
else
call setline(1, "/*************************************************************************")
call append(line("."), " > File Name: ".expand("%"))
call append(line(".")+1, " > Author: ims")
call append(line(".")+2, " > Created Time: ".strftime("%c"))
call append(line(".")+3, " ************************************************************************/")
call append(line(".")+4, "")
endif
if &filetype == 'cpp'
call append(line(".")+5, "#include<iostream>")
call append(line(".")+6, "using namespace std;")
call append(line(".")+7, "")
call append(line(".")+8, "int main()")
call append(line(".")+9, "{")
call append(line(".")+10, "\t")
call append(line(".")+11, "\treturn 0;")
call append(line(".")+12, "}")
endif
if &filetype == 'h'
let tem= expand("%")
let lens= strlen(tem)
let substr = strpart(tem,0,lens-2)
let headstr = toupper(substr).'_H'
call append(line(".")+5, '#ifndef '.headstr)
call append(line(".")+6, '#define '.headstr)
call append(line(".")+7, "")
call append(line(".")+8, " ")
call append(line(".")+9, "#endif")
set filetype=cpp
endif
if &filetype == 'c'
call append(line(".")+5, "#include<stdio.h>")
call append(line(".")+6, "")
call append(line(".")+7, "")
call append(line(".")+8, "int main()")
call append(line(".")+9, "{")
call append(line(".")+10, "\t")
call append(line(".")+11, "\treturn 0;")
call append(line(".")+12, "}")
endif
normal 12G"
endfunc
au BufRead *.h set filetype=cpp
"end----------- SetTitle() --------------------------------
"start------- set title of file of .py ----------
autocmd BufNewFile *.py exec ":call SetTitleOfFilePy()"
func SetTitleOfFilePy()
call setline(1,"\#! /usr/bin/python3.5")
call append(line("."), "\# -*- coding: UTF-8 -*-")
call append(line(".")+1, "\####################################################################")
call append(line(".")+2, "\# File Name: ".expand("%"))
call append(line(".")+3, "\# Author: ims")
call append(line(".")+4, "\# Created Time: ".strftime("%c"))
call append(line(".")+5, "\####################################################################")
call append(line(".")+6, "")
call append(line(".")+7, "")
normal 9G
endfunc
"end--------------------------------------------
"start------运行.c/.cpp/.java/.sh文件-----------------
nnoremap <F4> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
exec "!g++ % -o %<"
exec "! ./%<"
elseif &filetype == 'cpp'
exec "!g++ % -std=c++11 -o %<"
exec "! ./%<"
elseif &filetype == 'java' :
exec "!javac %"
exec "!java %<"
elseif &filetype == 'sh'
exec "!chmod +x %"
:!./%
endif
endfunc
"end------------------------------------------
"start------运行.py 文件 <F4> ----------------
nnoremap <F3> :call RunPy()<CR>
func! RunPy()
exec "w"
exec "!chmod +x %"
:!./%
endfunc
"end-----------------------------------
"{{{ cscope setting
if has("cscope")
set csprg=/usr/bin/cscope
set csto=1
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
endif
set csverb
endif
"}}}
"{{{ CtrlP Settings
" two setting can prevent change of ctrlp_working_path
set noautochdir
let g:ctrlp_working_path_mode = 0
"}}}
"{{{ map ctags,srcExpl,NerdTree:F8,F9,F10,F12
" Open and close the taglist.vim separately
nnoremap <F9> :TrinityToggleTagList<CR>
" Open and close the srcexpl.vim separately
nnoremap <F10> :TrinityToggleSourceExplorer<CR>
" Open and close the NERD_tree.vim separately
nnoremap <F12> :TrinityToggleNERDTree<CR>
" Open and close all the three plugins on the same time
"nnoremap <F12> :TrinityToggleAll<CR>
"}}}
"add command from tutor
:let mapleader = "\\"
:let maplocalleader = "\\"
"{{{ my shortcut key
:nnoremap <localleader>q :q<cr>
:nnoremap <localleader>qq :q!<cr>
:nnoremap <localleader>wq :wq<cr>
:nnoremap <localleader>wa :wa<cr>
:nnoremap <localleader>qa :qa<cr>
:nnoremap <localleader>s :%s/
:nnoremap <localleader>sh :ConqueTerm bash <cr>
:nnoremap <localleader>shs :ConqueTermSplit bash<cr>
:nnoremap <localleader>shv :ConqueTermVSplit bash<cr>
:nnoremap <localleader>sht :ConqueTermTab bash<cr>
:nnoremap <localleader>y "+y<cr>
:nnoremap <localleader>yy "+yy<cr>
:nnoremap <localleader>yw "+yw<cr>
:nnoremap <localleader>/ :/\<\>
:nnoremap <localleader>? :?\<\>
:inoremap <c-d> <esc>ddo
:nnoremap <localleader>ev :vsplit$MYVIMRC<cr>
:nnoremap <localleader>ms :vsplit $VIMRUNTIME/colors/ims.vim<cr>
:nnoremap <localleader>sv :source$MYVIMRC<cr>
:inoremap jk <esc>
:nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel
:nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lel
:autocmd FileType cpp nnoremap <buffer> <localleader>c I//<esc>
:autocmd FileType python nnoremap <buffer> <localleader>c I#<esc>
:autocmd FileType python :iabbrev <buffer> if if()<left>
:autocmd FileType cpp :iabbrev <buffer> for for(int i=0; i< ; i++)<esc>7h
:autocmd FileType c :iabbrev <buffer> for for(int i=0; i< ; i++)<esc>7h
"}}}
"{{{ cscope cs find
:nnoremap <c-@> :cs f
"}}}
"{{{ format text
nmap <tab> V>
nmap <s-tab> V<
vmap <tab> >gv
vmap <s-tab> <gv
"}}}
"sdvc{{{
set keywordprg=sdcv\ -u\ 朗道英汉字典5.0
function! Mydict()
let retstr=system('sdcv '.expand("<cword>"))
windo if expand("%")=="dict-win" |q!|endif
30vsp dict-win
setlocal buftype=nofile bufhidden=hide noswapfile
1s/^/\=retstr/
1
endfunction
nnoremap F :call Mydict()<CR>
"use sdcv instead man
:set keywordprg=sdcv
"}}}
"{{{ minibufexplore settings
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
let g:bufExplorerMaxHeight=3
"}}}
"{{{ Colors Settings
colorscheme ims
set guifont=Consolas:h13:cANSI
"}}}
set clipboard+=unnamedplus
ims.vim
" Vim color file modify from industrial
" Maintainer: ims
let colors_name = "ims"
" Remark: "industry" stands for 'industrial' color scheme. In industrial
" HMI (Human-Machine-Interface) programming, using a standard color
" scheme is mandatory in many cases (in traffic-lights for example):
" LIGHT_RED is 'Warning'
" LIGHT_YELLOW is 'Attention'
" LIGHT_GREEN is 'Normal'
" LIGHT_MAGENTA is 'Warning-Attention' (light RED-YELLOW)
" LIGHT_CYAN is 'Attention-Normal' (light YELLOW-GREEN).
" BLACK is Dark-High-Contrast Background for maximum safety.
" BLUE is Shade of BLACK (not supposed to get attention).
"
" Industrial color scheme is by nature clear, safe and productive.
" Yet, depends on the file type's syntax, it might appear incorrect.
" Reset to dark background, then reset everything to defaults:
set background=dark
highlight clear
if exists("syntax_on")
syntax reset
endif
" First set Normal to regular white on black text colors:
hi Normal ctermfg=LightGray ctermbg=233 guifg=#dddddd guibg=Black
" Syntax highlighting (other color-groups using default, see :help group-name):
hi Comment cterm=NONE ctermfg=DarkCyan gui=NONE guifg=#00aaaa "包括非活动 buf explore 文件名
hi Constant cterm=NONE ctermfg=LightCyan gui=NONE guifg=#00ffff
hi Identifier cterm=NONE ctermfg=LightMagenta gui=NONE guifg=#ff00ff
hi Function cterm=NONE ctermfg=LightGreen gui=NONE guifg=#00ff00
hi Statement cterm=NONE ctermfg=White gui=bold guifg=#ffffff
hi PreProc cterm=NONE ctermfg=Yellow gui=NONE guifg=#ffff00
hi Type cterm=NONE ctermfg=LightGreen gui=bold guifg=#00ff00
hi Special cterm=NONE ctermfg=Yellow gui=NONE guifg=#ff0000 "包括活动 buf explore 文件名
hi Delimiter cterm=NONE ctermfg=Yellow gui=NONE guifg=#ffff00
hi Statement cterm=bold ctermfg=green "system function
hi StatusLine cterm=none ctermfg=DarkCyan ctermbg=234 guifg=blue guibg=darkgray gui=none
hi StatusLineNC cterm=none ctermfg=235 ctermbg=235 guifg=black guibg=darkgray gui=none
hi VertSplit cterm=none ctermfg=DarkCyan ctermbg=234 guifg=black guibg=LightRed gui=none
hi CursorLine cterm=none ctermbg=235
hi CursorColumn cterm=NONE ctermbg=black ctermfg=green guibg=NONE guifg=NONE
set cul
"set cuc
hi LineNr ctermfg=DarkCyan ctermbg=234
hi MatchParen ctermfg=16 ctermbg=208 cterm=bold
hi ModeMsg ctermfg=red " color of insert
hi MoreMsg ctermfg=229
hi Operator ctermfg=Yellow
hi Directory ctermfg=118 cterm=bold
hi Error ctermfg=219 ctermbg=89
hi ErrorMsg ctermfg=199 ctermbg=16 cterm=bold
hi Exception ctermfg=118 cterm=bold
hi Float ctermfg=135
hi FoldColumn ctermfg=67 ctermbg=16
hi Folded ctermfg=67 ctermbg=16
hi Function ctermfg=118
hi Identifier ctermfg=208
hi Ignore ctermfg=244 ctermbg=232
hi IncSearch ctermfg=Yellow ctermbg=red
hi Keyword ctermfg=161 cterm=bold
hi Label ctermfg=229 cterm=none
hi Macro ctermfg=193
hi SpecialKey ctermfg=81
hi Type ctermfg=118 cterm=none
hi Structure ctermfg=118 cterm=none
hi Macro ctermfg=161 cterm=bold
hi PreCondit ctermfg=161 cterm=bold
hi StorageClass ctermfg=208
"hi Tag ctermfg=161
hi Title ctermfg=166
hi Todo ctermfg=231 ctermbg=232 cterm=bold
"test
augroup hightlightFun
autocmd!
" hilight function name
autocmd BufNewFile,BufRead,BufWrite * :syntax match cfunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>[^()]*)("me=e-2
autocmd BufNewFile,BufRead,BufWrite * :syntax match cfunctions "\<[a-zA-Z_][a-zA-Z_0-9]*\>\s*("me=e-1
hi cfunctions ctermfg=81 "(这一行就是给函数名加颜色的)
autocmd BufNewFile,BufRead,BufWrite * :syntax match operators "[=\*\&\%\-\>\<\+]"
autocmd BufNewFile,BufRead,BufWrite * :syntax match operators "\<WORD32\>"
autocmd BufNewFile,BufRead,BufWrite * :syntax match operators "\<WORD16\>"
autocmd BufNewFile,BufRead,BufWrite * :syntax match operators "\<BYTE\>"
hi operators ctermfg=DarkCyan "
augroup END
:function SetLocalStatusLine()
: setlocal statusline =%f
setlocal statusline +=%2*%r%*
setlocal statusline +=%=%y
setlocal statusline +=%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\"+\":\"\").\"]\"}
setlocal statusline +=[%{&ff}][a:%03.3b]
setlocal statusline +=[r:%l/%2*%L%*,c:%c]
setlocal statusline +=%1*%m%*
setlocal statusline +=%3*[%p%%]%*
hi User1 cterm=bold ctermfg=1 ctermbg=234
hi User2 cterm=none ctermfg=11 ctermbg=234
hi User3 cterm=none ctermfg=10 ctermbg=234
set laststatus=2
:endfunction
augroup filetype_statusline
autocmd!
autocmd FileType c call SetLocalStatusLine()
autocmd FileType cpp call SetLocalStatusLine()
autocmd FileType python call SetLocalStatusLine()
augroup END
set showcmd
"vim -R file 只读
"vim -M 不能修改模式
"Cursor光标
"ErrorMsg命令行中的错误提示
"Folded折叠行
"LineNr行号
"NonText非文本区(控制字符和一些特殊字符和编辑器空白区等)
"Normal编辑区一般文本的前景和背景色
"Search搜索
"StatusLine状态行
"Visual圈选区
hi Search cterm=none ctermfg=red ctermbg=185
hi Visual cterm=none ctermbg=239
vimrc同步文档的更多相关文章
- 从Mac的Finder中访问你的iCloud文档
[从Mac的Finder中访问你的iCloud文档] 从OS X 10.7.2开始,iCloud就深入Mac当中,我们也可以在Finder中访问储存在iCloud中的文件,甚至当你拥有多台Mac的时候 ...
- ToShowDoc拯救不想写文档的你
ToShowDoc拯救不想写文档的你 写注释已经够折磨开发者了,显然天天curd的我们再去写文档岂不是分分种要被逼疯. 我想每个人都有这种经历 加了一个参数文档忘了更新 参数名更改文档忘了更新 删掉一 ...
- 使用 python 创建&更改 word 文档
使用 python 修改 word 文档 说明:这个需求是老师想要一个自动识别 word 文档中指定位置的分数,并填入相应表格. 使用库 python-docx 的官方文档地址是:python-doc ...
- 制作一个文档同步工具,自动同步到gitee中。。。
之所以要做这个工具是为了让自己可以随时用电脑时能记录日常工作或生活.一般只需要简单记录下就行了.这样我在家里的和公司里的记录都能同步看到. 这样后期整理的时候看到几个关键词就能想起来具体的事情,有的也 ...
- 马克飞象 Markdown 使用和学习
第三方学习网站 http://sspai.com/25137https://maxiang.io/ 使用工具:有道云笔记 https://note.youdao.com/ 新建时使用Mardown类型 ...
- #第一用Markdown编辑器#
Markdown初次使用 This is a simple Markdown editor based on 'Markdown' it's * italic * style. it's also _ ...
- 转贴: 更改Outlook2013数据文件的位置
转自: 老田博客 近日体验了一下微软OFFICE 2013 说实话 除了与skydriver深度整合实现云同步文档外 其他的功能对我这样的『Light User』实在是大材小用 wps足够了 在使用过 ...
- 从idea到ipo
**************************************************************************************************** ...
- 开始使用Mac OS X——写给Mac新人
本文转自博客园:http://www.cnblogs.com/chijianqiang/archive/2011/08/03/2126593.html 写这篇文档的原因有两个,一.身边使用Mac的朋友 ...
随机推荐
- TensorFlow+Keras 03 TensorFlow 与 Keras 介绍
1 TensorFlow 架构图 1.1 处理器 TensorFlow 可以在CPU.GPU.TPU中执行 1.2 平台 TensorFlow 具备跨平台能力,Windows .Linux.Andro ...
- 12C - PDB archive file
在unplug一个pdb的时候,如果将扩展名定义为.pdb,oracle就会创建一个.pdb归档文件.包含pdb数据文件和xml元数据文件的压缩文件.创建archive file之后,就不用分开拷贝数 ...
- 1、金融之关于BIAS
一.☆BIAS(1)什么是BIAS☆ BIAS[指标介绍] BIAS乖离率也称为Y值,是用股价指数与移动平均线的比值关系,来描述股票价格与移动平均线之间的偏离程度.乖离率功能主要是通过测算股 ...
- [转]正则表达式的先行断言(lookahead)和后行断言(lookbehind)
正则表达式的先行断言和后行断言一共有4种形式: (?=pattern) 零宽正向先行断言(zero-width positive lookahead assertion) (?!pattern) 零宽 ...
- BizTalk RosettaNet解决方案之Loopback
本教程使用 BizTalk Accelerator for RosettaNet (BTARN) 在一台计算机上模拟本组织与合作伙伴组织之间的流程实施情况. 创建本组织 “BizTalk <版本 ...
- dajpper使用教程
1.表结构 2.程序对应的实体类 3.基本操作 3.1 插入 123456789 public int Insert(Person person, string _ConnString){ using ...
- 如何在phpstorm中查看yaf框架源码
1.到github下载yaf框架的doc 下载链接 https://github.com/elad-yosifon/php-yaf-doc/archive/master.zip 2.解压zip包 3. ...
- Airtest iOS测试环境部署
[本文出自天外归云的博客园] 简介 这个Airtest IDE是通过iOS-Tagent来操作iPhone的,你可以在Airtest IDE里录制脚本来实现自动化操作iPhone 前提 1. 得有个i ...
- CPU与GPU性能的比较报告
运行时间分析 不同的模型在cpu和gpu下的时间差异较大,一般来说gpu会比cpu快5-20倍.我们选用了最常用的inception v3的分类模型,输入图片尺寸为:3x299x299. GPU 在一 ...
- plsql 通过修改配置文件的方式实现数据库的连接
查看oracle的安装位置: XP系统: 开始>>所有程序>>>Oracle-OraDb10g_home1>>>配置和移植工具>>>右 ...