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的朋友 ...
随机推荐
-
BZOJ 4614 【Wf2016】 Oil
题目链接:Oil 感觉同时几线作战有点吃不消啊-- 这道题有一个显然的结论,那就是最优的直线一定过某条线段的端点. 仔细想想很有道理.如果最终的直线没有过线段的端点的话,那么这条直线就一定可以平移,直 ...
-
SQL Server安全概念简析
I. 登录名与用户名 登录名: 访问数据库服务器的账户.登录名可以登录到服务器,但不能直接访问数据库内容.数据库连接串中的用户名应配置为登录名.每个登录名的定义存放在master数据库的syslogi ...
-
linux监控nmon和analyser的使用
测试压力的时候使用linux一个简单的监控工具nmon,不仅可以实时监测,也可以生成文件以图标样式展现,小巧实用 安装nmon nmon实际上是个tarball直接解压到所要放置的目录,然后直接运行就 ...
-
HDU 4035Maze(概率DP)
HDU 4035 Maze 体会到了状态转移,化简方程的重要性 题解转自http://blog.csdn.net/morgan_xww/article/details/6776947 /** dp ...
-
left join 和 left outer join 有什么区别?
left join 是left outer join的简写,left join默认是outer属性的.outer join则会返回每个满足第一个(顶端)输入与第二个(底端)输入的联接的行.它还返回任何 ...
-
python中__del__使用方法
创建对象后,python解释器默认调用__init__()方法.当删除一个对象时,python解释器也会默认调用一个方法,这个方法为__del__()方法.在python中,对于开发者来说很少会直接销 ...
-
Rhino模型制作——京东狗(练习网格切割)
我最近做了一个京东狗的模型,我先把渲染好的模型给大家看一下. 别看这个模型很复杂,其实京东狗的模型是网上找的,我只是做了一个上面的洞.不过我告诉大家Rhino的下载地址:http://www.xuex ...
-
Centos下添加静态路由(临时和永久有效)的操作记录
公司IDC机房服务器上部署了一套外网LB环境,默认配置的是外网ip的路由地址,由于要和其他内网机器通信,所以需要配置内网ip的路由地址.整个操作过程,记录如下,以供以后参考学习: 1)内网网卡绑定 [ ...
-
crt key转p12, jks p12互转,windows生成jks,
crt key转p12, jks p12互转,windows生成jks, 摘自:https://blog.csdn.net/u010801696/article/details/86546191 20 ...
-
详说Flask、Django、Pyramid三大主流 Web 框架
前言 目前随着 Python 在大数据.云计算.人工智能方面的热度,Python Web 应该也会被更多企业了解使用. Python Web 框架千万种,没必要都去了解和学习,身边总有人说高手都用 F ...