折腾了一天 在https://keelii.github.io/2016/06/13/awsome-window-vimrc/的基础上进行了一些改动

" ------------------------------
" Name: vimrc for windows
" Author: hanhao
" Email: keeliizhou@gmail.com
" ------------------------------ " Startup {{{
filetype indent plugin on augroup vimrcEx
au! autocmd FileType text setlocal textwidth=78 augroup END " vim 文件折叠方式为 marker
augroup ft_vim
au! autocmd FileType vim setlocal foldmethod=marker " 打开文件总是定位到上次编辑的位置
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif augroup END
augroup END
" }}} " General {{{
"实时搜索
set incsearch set ignorecase set cul
set nocompatible
set nobackup
set noswapfile
set history=1024
set tags=tags;
set autochdir
set whichwrap=b,s,<,>,[,]
set nobomb
set backspace=indent,eol,start whichwrap+=<,>,[,]
" Vim 的默认寄存器和系统剪贴板共享
set clipboard+=unnamed
" 设置 alt 键不映射到菜单栏
set winaltkeys=no
" }}} " Lang & Encoding {{{
set fileencodings=utf-8,gbk2312,gbk,gb18030,cp936
set encoding=utf-8
set langmenu=zh_CN
let $LANG = 'en_US.UTF-8'
"language messages zh_CN.UTF-8
" }}} " GUI {{{
colorscheme Tomorrow-Night source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"set cursorline
set hlsearch
set number
" 窗口大小
set lines=35 columns=140
" 分割出来的窗口位于当前窗口下边/右边
set splitbelow
set splitright
"不显示工具/菜单栏
set guioptions-=T
set guioptions-=m
set guioptions-=L
set guioptions-=r
set guioptions-=b
"使用内置 tab 样式而不是 gui
set guioptions-=e
" set nolist
set listchars=trail:.,extends:>,precedes:<
set guifont=Inconsolata:h12:cANSI set statusline=%f
set statusline+=%m
set statusline+=\ %{fugitive#head()}
set statusline+=%=
set statusline+=%{''.(&fenc!=''?&fenc:&enc).''}
set statusline+=/
set statusline +=%{&ff} "file format
set statusline+=\ -\ " Separator
set statusline+=%l/%L
set statusline+=[%p%%]
set statusline+=\ -\ " Separator
set statusline +=%1*\ %y\ %* " }}} " Format {{{
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set foldmethod=indent
syntax on
" }}} " Keymap {{{
let mapleader="," nmap <leader>s :source $MYVIMRC<cr>
nmap <leader>e :e $MYVIMRC<cr> nmap <leader>tn :tabnew<cr>
nmap <leader>tc :tabclose<cr>
nmap <leader>th :tabp<cr>
nmap <leader>tl :tabn<cr> " 移动分割窗口
nmap <C-j> <C-W>j
nmap <C-k> <C-W>k
nmap <C-h> <C-W>h
nmap <C-l> <C-W>l "tab => space
nmap tt :%s/\t/ /g<CR> " 正常模式下 alt+j,k,h,l 调整分割窗口大小
nnoremap <M-j> :resize +5<cr>
nnoremap <M-k> :resize -5<cr>
nnoremap <M-h> :vertical resize -5<cr>
nnoremap <M-l> :vertical resize +5<cr> " 插入模式移动光标 alt + 方向键
inoremap <M-j> <Down>
inoremap <M-k> <Up>
inoremap <M-h> <left>
inoremap <M-l> <Right> " IDE like delete
inoremap <C-BS> <Esc>bdei nnoremap vv ^vg_
" 命令模式下的行首尾
cnoremap <C-a> <home>
cnoremap <C-e> <end> imap <C-v> "+gP
vmap <C-c> "+y
vnoremap <BS> d
vnoremap <C-C> "+y
vnoremap <C-Insert> "+y
imap <C-V> "+gP
map <S-Insert> "+gP
cmap <C-V> <C-R>+
cmap <S-Insert> <C-R>+ exe 'inoremap <script> <C-V>' paste#paste_cmd['i']
exe 'vnoremap <script> <C-V>' paste#paste_cmd['v'] " 打开当前目录 windows
nmap <silent> <leader>ex :!start explorer %:p:h<CR> " 打开当前目录CMD
nmap <silent> <leader>cmd :!start cmd /k cd %:p:h<cr> let NERDTreeBookmarksFile = $VIM . '/NERDTreeBookmarks' " 复制当前文件/路径到剪贴板
nmap ,fn :let @*=substitute(expand("%"), "/", "\\", "g")<CR>
nmap ,fp :let @*=substitute(expand("%:p"), "/", "\\", "g")<CR> "设置切换Buffer快捷键"
nnoremap <C-left> :bn<CR>
nnoremap <C-right> :bp<CR> map <Esc><Esc> :w<CR>
map <F3> :NERDTreeToggle<CR> map <F5> :call CompileRun()<CR>
map <F6> :call Run()<CR>
map <C-F5> :call Debug()<CR>
"map <F9> :Tlist<CR>
map <F9> :WMToggle<cr>
" Define compile & run {{{
func CompileRun() exec "w" "C program if &filetype == 'c' exec "!gcc % -o %<"
exec "! %<"
"c++ program elseif &filetype == 'cpp' exec "!g++ % -o %<"
exec "! %<" "Java program elseif &filetype == 'java' exec "!javac %" endif endfunc "End Defind CompileRun
" }}}
"Define Run Function {{{ func Run() if &filetype == 'c' || &filetype == 'cpp' exec "!%<.exe" elseif &filetype == 'java' exec "!java %<" endif endfunc
"End Define Run Function
"}}}
"Define Debug Function,To Debug program {{{ func Debug() exec "w" "C program if &filetype == 'c' exec "!gcc % -g -o %<.exe" exec "!gdb %<.exe" elseif &filetype == 'cpp' exec "!g++ % -g -o %<.exe" exec "!gdb %<.exe" "Java program elseif &filetype == 'java' exec "!javac %" exec "!jdb %<" endif endfunc "End Defind Debug
"}}}
" }}} " Plugin {{{
filetype off set rtp+=$VIM/vimfiles/bundle/Vundle.vim
call vundle#begin('$VIM/vimfiles/bundle') " ----- Vundle ----- {{{
Plugin 'VundleVim/Vundle.vim'
" }}}
" ----- NerdTree ----- {{{
Plugin 'scrooloose/nerdtree' let NERDTreeIgnore=['.idea', '.vscode', 'node_modules', '*.pyc']
let NERDTreeBookmarksFile = $VIM . '/NERDTreeBookmarks'
let NERDTreeMinimalUI = 1
let NERDTreeBookmarksSort = 1
let NERDTreeShowLineNumbers = 0
let NERDTreeShowBookmarks = 1
let g:NERDTreeWinPos = 'right'
let g:NERDTreeDirArrowExpandable = ' '
let g:NERDTreeDirArrowCollapsible = ' '
nmap <leader>n :NERDTreeToggle <cr>
if exists('g:NERDTreeWinPos')
autocmd vimenter * NERDTree C:\repo
endif
" }}}
" ----- Multiple-cursors ----- {{{
Plugin 'terryma/vim-multiple-cursors'
" }}}
" ----- Tabular ----- {{{
Plugin 'godlygeek/tabular'
" }}}
" ----- Markdown ----- {{{
Plugin 'plasticboy/vim-markdown'
" }}}
" ----- Airline ----- {{{
"Plugin 'vim-airline/vim-airline'
"Plugin 'vim-airline/vim-airline-themes'
"set laststatus=2
"if !exists('g:airline_symbols')
"let g:airline_symbols = {}
"endif
"let g:airline_theme='tomorrow'
"let g:airline_powerline_fonts = 1
"let g:Powerline_symbols='fancy'
"let g:airline_symbols.branch = ''
"let g:airline_left_sep = '?'
"let g:airline_right_sep = '?'
"let g:airline#extensions#branch#enabled = 1
"let g:airline#extensions#branch#vcs_priority = ["git", "mercurial"]
"let g:airline_mode_map = {
"\ 'n' : 'N',
"\ 'i' : 'I',
"\ 'v' : 'V',
"\ }
"let g:airline#extensions#tabline#enabled = 1 " }}}
" ----- Ctrlp ----- {{{
Plugin 'kien/ctrlp.vim'
"let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:10,results:10'
"set wildignore+=*\\.git\\*,*\\tmp\\*,*.swp,*.zip,*.exe,*.pyc
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_custom_ignore = '\v\.(exe|so|dll)$'
let g:ctrlp_extensions = ['funky']
" }}}
" ----- Nerdcommenter ----- {{{
Plugin 'scrooloose/nerdcommenter'
" }}}
" ----- last_edit_marker ----- {{{
Plugin 'last_edit_marker.vim'
" }}}
" ----- Emmet ----- {{{
Plugin 'mattn/emmet-vim'
" }}}
" ----- SnipMate ----- {{{
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
" Replace your repo
Plugin 'keelii/vim-snippets'
" Allow for vimrc re-sourcing
let g:snipMate = get(g:, 'snipMate', {})
" }}}
" ----- Fugitive ----- {{{
Plugin 'tpope/vim-fugitive'
" }}}
" ----- Neocomplete ----- {{{
Plugin 'Shougo/neocomplete.vim'
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#enable_auto_select = 1
" Enable snipMate compatibility feature.
let g:neosnippet#enable_snipmate_compatibility = 1
" Tell Neosnippet about the other snippets
let g:neosnippet#snippets_directory=$VIM . '/vimfiles/bundle/vim-snippets/snippets' " Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
if !exists('g:neocomplete#sources#omni#input_patterns')
let g:neocomplete#sources#omni#input_patterns = {}
endif
" }}}
" ----- Auto-Pairs ----- {{{
Plugin 'Auto-Pairs'
" }}}
"----- WinManager ----- {{{
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr>
" }}} filetype on
call vundle#end()
" }}} " Function {{{
" Remove trailing whitespace when writing a buffer, but not for diff files.
" From: Vigil
" @see http://blog.bs2.to/post/EdwardLee/17961
function! RemoveTrailingWhitespace()
if &ft != "diff"
let b:curcol = col(".")
let b:curline = line(".")
silent! %s/\s\+$//
silent! %s/\(\s*\n\)\+\%$//
call cursor(b:curline, b:curcol)
endif
endfunction
autocmd BufWritePre * call RemoveTrailingWhitespace()
" }}}

windows下的_vimrc的更多相关文章

  1. Windows下gvim配置

    Windows下gvim配置原作地:http://hi.baidu.com/leemoncc/blog/item/a6be15cf40d7ab31b600c806.html 0.准备软件及插件. (a ...

  2. Windows下gvim的快捷键--“冒号+w+回车”真的很累人

    发现Windows下的gvim支持Ctrl+S保存,Ctrl+A全选,Ctrl+C复制,Ctrl+V粘贴,Ctrl+Z撤销 不过Ctrl+X貌似不太正常(可以剪切,但是不能粘贴) 可能要在安装目录下的 ...

  3. windows下安装tern for vim

    操作系统:windows8.1 64位 vim:gvim7.4   1.下载tern for vim,去官网直接下载,连接好像都是到github上(https://github.com/marijnh ...

  4. 第21月第9日 windows下使用vim+ctags+taglist

    1. windows下使用vim+ctags+taglist 最近在公司的同事指导下,学会使用这个东西编写代码,效率提高了不少.所以记录下来,方便大家使用. 1. 下载gvim74.exe文件,并安装 ...

  5. vim7.4版本在windows下的配置文件及所在位置

    1.vim在windows下默认首先会查找"_vimrc"文件,如果没有则会找".vimrc".造成这个原因是windows早期不支持以点开头的文件及目录.2. ...

  6. windows下的gvim和emmet 下载和安装 + "omnifunc is not set" solution?

    注意几个地方: 引导键是ctrl-y, 其他就是实际的操作键了, 如: n下一个插入点, N是上一个插入点(不是p), ctrl-y + i是自动为图片添加宽度和高度尺寸, 要点是要把光标移动到 im ...

  7. windows下的 gvim - su'blime text 的使用

    su'blime [s2'blaim] adj. n. 崇高的, 高尚的, 令人尊敬的; 壮丽的, 宏伟的; 出众的; 崇高的人, 壮丽的事物等等. a sublime mission. a subl ...

  8. windows下安装vundle

    windows下安装vundle ## 前言 windows下安装vundle和linux下稍微有些不一样,虽然官网给出了 安装说明,但是有些问题的. E117: Unknown function: ...

  9. Windows下将gvim8配置为Python IDE

    目录 1.准备工作 2.安装 3.配置 _vimrc 4.编写和编译运行程序 正文 Windows下将gvim配置为Python IDE 回到顶部 1.准备工作 将下面的安装包或者文件下载好 1) P ...

随机推荐

  1. laravel路由导出和参数加密

    路由导出 代码位置:\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteListCommand.php protected ...

  2. 西邮Linux兴趣小组第一次技术分享会

    2016年10月30日晚,西邮Linux兴趣小组技术分享会在西安邮电大学长安校区东区逸夫教学楼FF305室成功举办.200多名来自全校不同专业的15,16级同学参加了此次分享会. 分享会于20:00正 ...

  3. FAIL : Keyword 'BuiltIn.Log' expected 1 to 6 arguments, got 12(解决方法)

    RF运行关键字:Run Keyword If ,log输出报错"FAIL : Keyword 'BuiltIn.Log' expected 1 to 6 arguments, got 12. ...

  4. Maven下载、安装、配置

    简介 Maven是一个项目管理工具,主要用于Java平台的项目构建.依赖管理和项目生命周期管理. 当然对于我这样的程序猿来说,最大的好处就是对jar包的管理比较方便,只需要告诉Maven需要哪些jar ...

  5. [linux]centos7.4上升级python2版本到python3.6.5 【安装双版本,默认python3】

    版本声明 centos7.4 前言:linux上的python默认是版本2的,之前学django项目用的是3的版本 所以得升级下版本~ 1.下载python3.6.5 cd /usr/local/ w ...

  6. silky微服务业务主机简介

    目录 主机的概念 通用主机 web主机 业务主机类型 使用web主机构建微服务应用 使用通用主机构建微服务应用 构建具有websocket能力的微服务应用 构建网关 开源地址 在线文档 主机的概念 s ...

  7. es添加index template

    在kibana页面选择最下方的management--elasticsearch--Index Management--Index Management 选择create a template添加in ...

  8. dart系列之:dart类中的构造函数

    目录 简介 传统的构造函数 命名构造函数 构造函数的执行顺序 重定向构造函数 Constant构造函数 工厂构造函数 总结 简介 dart作为一种面向对象的语言,class是必不可少的.dart中所有 ...

  9. 🏆【Alibaba中间件技术系列】「RocketMQ技术专题」小白专区之领略一下RocketMQ基础之最!

    应一些小伙伴们的私信,希望可以介绍一下RocketMQ的基础,那么我们现在就从0开始,进入RocketMQ的基础学习及概念介绍,为学习和使用RocketMQ打好基础! RocketMQ的定位 Rock ...

  10. 菜鸡的Java笔记 - java 枚举

    枚举        枚举属于加强版的多例设计模式            多例设计模式与枚举        多例设计模式的本质在于构造方法的私有化.而后在类的内部产生若干个实例化对象,随后利用一个 st ...