目录

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同步文档的更多相关文章

  1. 从Mac的Finder中访问你的iCloud文档

    [从Mac的Finder中访问你的iCloud文档] 从OS X 10.7.2开始,iCloud就深入Mac当中,我们也可以在Finder中访问储存在iCloud中的文件,甚至当你拥有多台Mac的时候 ...

  2. ToShowDoc拯救不想写文档的你

    ToShowDoc拯救不想写文档的你 写注释已经够折磨开发者了,显然天天curd的我们再去写文档岂不是分分种要被逼疯. 我想每个人都有这种经历 加了一个参数文档忘了更新 参数名更改文档忘了更新 删掉一 ...

  3. 使用 python 创建&更改 word 文档

    使用 python 修改 word 文档 说明:这个需求是老师想要一个自动识别 word 文档中指定位置的分数,并填入相应表格. 使用库 python-docx 的官方文档地址是:python-doc ...

  4. 制作一个文档同步工具,自动同步到gitee中。。。

    之所以要做这个工具是为了让自己可以随时用电脑时能记录日常工作或生活.一般只需要简单记录下就行了.这样我在家里的和公司里的记录都能同步看到. 这样后期整理的时候看到几个关键词就能想起来具体的事情,有的也 ...

  5. 马克飞象 Markdown 使用和学习

    第三方学习网站 http://sspai.com/25137https://maxiang.io/ 使用工具:有道云笔记 https://note.youdao.com/ 新建时使用Mardown类型 ...

  6. #第一用Markdown编辑器#

    Markdown初次使用 This is a simple Markdown editor based on 'Markdown' it's * italic * style. it's also _ ...

  7. 转贴: 更改Outlook2013数据文件的位置

    转自: 老田博客 近日体验了一下微软OFFICE 2013 说实话 除了与skydriver深度整合实现云同步文档外 其他的功能对我这样的『Light User』实在是大材小用 wps足够了 在使用过 ...

  8. 从idea到ipo

    **************************************************************************************************** ...

  9. 开始使用Mac OS X——写给Mac新人

    本文转自博客园:http://www.cnblogs.com/chijianqiang/archive/2011/08/03/2126593.html 写这篇文档的原因有两个,一.身边使用Mac的朋友 ...

随机推荐

  1. 【php】php5.0以上,instanceof 用法

    1.instanceof php官网:http://php.net/manual/zh/language.operators.type.php 2.instanceof 用于确定一个 PHP 变量是否 ...

  2. [转] 分组排序取前N条记录以及生成自动数字序列,类似group by后 limit

    前言:        同事的业务场景是,按照cid.author分组,再按照id倒叙,取出前2条记录出来.        oracle里面可以通过row_number() OVER (PARTITIO ...

  3. 使用 GeoIP2 获取 IP 的地理位置

    1. 准备工作 数据库 : 解析 IP 地理位置的的数据库来自 GeoLite2 开源数据库:https://dev.maxmind.com/geoip/geoip2/geolite2/ . C 语言 ...

  4. WCF-Oracel适配器针对UDT的使用配置与注意事项

    配置方法 1.针对Oracle UDT 的数据类型需要在开发过程中手动配置生成的DLL位置和Key位置,Visual Studio->添加生成项目->Add Adapter Metadat ...

  5. AWS免费套餐服务器部署NETCORE网站

    之前的linode充了5美元,一个月就用完了,还是创建的最便宜的服务器的!!! 以前一直想用用aws的所谓的免费套餐服务器的,现在linode过期了,可以试着用用了 下面是我的操作流程,包含错误及解决 ...

  6. 两台linux服务器各有两个不同的用户 其中一个服务器可以无密码登录服务器

    服务器A:普通用户USERA 服务器B:普通用户USERB 把USERA的公钥写入服务器B用户USERB的authorized_keys中 USERA能普能用户登录然后服务器A,然后再登录服务器B: ...

  7. Thymeleaf模版--子页面单独引入CSS、JS文件

    https://blog.csdn.net/u010392801/article/details/80465800 ****************************************** ...

  8. windows 上搭建gitblit

    https://www.cnblogs.com/ucos/p/3924720.htmlhttps://www.cnblogs.com/sumuncle/p/6362697.htmlhttp://www ...

  9. Tomcat 配置详解/优化方案(转)

    转载地址:https://blog.csdn.net/cicada688/article/details/14451541/ Service.xml Server.xml配置文件用于对整个容器进行相关 ...

  10. [转]剑指offer之Java源代码

    一.引言 <剑指offer>可谓是程序猿面试的神书了,在面试中帮了我很多,大部分面试的算法题都会遇到原题或者是类似的题.但是书上的代码都是C版的,我在这里整理了一份Java版的代码供大家学 ...