Skip to content

Instantly share code, notes, and snippets.

@jk2K
Last active August 22, 2018 09:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jk2K/73fbd70950f3f3a74499 to your computer and use it in GitHub Desktop.
Save jk2K/73fbd70950f3f3a74499 to your computer and use it in GitHub Desktop.
Vim配置文件 .vimrc
"不兼容vi
set nocompatible
"让删除键更好用
set backspace=2
"不创建撤销文件
set noundofile
"取消自动备份
set nobackup
"自动缩进
set autoindent
"制表符占4个空格
set tabstop=4
"默认缩进4个空格大小
set shiftwidth=4
" On pressing tab, insert 4 spaces, 方便 git diff
set expandtab
"粘贴格式切换
set pastetoggle=<F2>
"显示当前行数
set ruler
"启用语法高亮
syntax enable
"配置Vundle
filetype off
set rtp+=$HOME/.vim/bundle/Vundle.vim
call vundle#begin()
"可更新vundle
Plugin 'gmarik/Vundle.vim'
"solarized配色方案
Plugin 'altercation/vim-colors-solarized'
"树形目录
Plugin 'scrooloose/nerdtree'
"语法检查
Plugin 'scrooloose/syntastic'
"文字替换
Plugin 'tpope/vim-surround'
"html, css快速编写
Plugin 'mattn/emmet-vim'
"generate toc for markdown
Plugin 'mzlogin/vim-markdown-toc'
"高亮 nginx 配置文件
Plugin 'nginx.vim'
au BufRead,BufNewFile /Users/lee/Code/Sites/servers/* if &ft == '' | setfiletype nginx | endif
"格式化 JSON
Plugin 'elzr/vim-json'
"代码高亮 YAML
Plugin 'stephpy/vim-yaml'
call vundle#end()
filetype plugin indent on
"配置 altercation/vim-colors-solarized
set background=dark
"如果是有gui界面,则启用颜色主题,否则取消颜色主题
if has("gui_running")
colorscheme solarized
endif
"配置 scrooloose/nerdtree
nmap <F3> :NERDTreeToggle<CR>
"<F2>键隐藏显示菜单
set guioptions-=m
set guioptions-=T
map <silent> <F2> :if &guioptions =~# 'm' <Bar>
\set guioptions-=m <Bar>
\else <Bar>
\set guioptions+=m <Bar>
\endif <CR>
"对于python用空格键替换制表符tab
autocmd FileType python setlocal et sta sw=2 sts=2
"禁止文本文件自动换行
autocmd FileType text setlocal textwidth=0
set nocompatible
" Enable Ctrl + c and Ctrl + v for copy and paste in gvim
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+pa
"设置字体类型和大小
set guifont=Consolas:h12:cANSI
set encoding=utf-8
set fileencodings=utf-8
set termencoding=utf-8
set fileencoding=utf-8
"解决consle输出乱码
language messages zh_CN.utf-8
:nnoremap <A-a> <C-a>
:nnoremap <A-x> <C-x>
"不创建撤销文件
set noundofile
"取消自动备份
set nobackup
"自动缩进
set autoindent
"制表符占4个空格
set tabstop=4
"默认缩进4个空格大小
set shiftwidth=4
" On pressing tab, insert 4 spaces, 方便 git diff
set expandtab
"粘贴格式切换
set pastetoggle=<F12>
"显示当前行数
set ruler
"启用语法高亮
syntax enable
"配置Vundle
filetype off
set rtp+=$HOME/.vim/bundle/Vundle.vim
call vundle#begin()
"可更新vundle
Plugin 'VundleVim/Vundle.vim'
"solarized配色方案
Plugin 'altercation/vim-colors-solarized'
"树形目录
Plugin 'scrooloose/nerdtree'
"语法检查
Plugin 'scrooloose/syntastic'
"文字替换
Plugin 'tpope/vim-surround'
"html, css快速编写
Plugin 'mattn/emmet-vim'
"generate toc for markdown
Plugin 'mzlogin/vim-markdown-toc'
"高亮 nginx 配置文件
Plugin 'nginx.vim'
au BufRead,BufNewFile D:/codes/sites/laradock/nginx/sites/* if &ft == '' | setfiletype nginx | endif
"格式化 JSON
Plugin 'elzr/vim-json'
"代码高亮 YAML
Plugin 'stephpy/vim-yaml'
call vundle#end()
filetype plugin indent on
"配置 altercation/vim-colors-solarized
set background=dark
"如果是有gui界面,则启用颜色主题,否则取消颜色主题
if has("gui_running")
colorscheme solarized
endif
"配置 scrooloose/nerdtree
nmap <F3> :NERDTreeToggle<CR>
"<F2>键隐藏显示菜单
set guioptions-=m
set guioptions-=T
map <silent> <F2> :if &guioptions =~# 'm' <Bar>
\set guioptions-=m <Bar>
\else <Bar>
\set guioptions+=m <Bar>
\endif <CR>
"对于python用空格键替换制表符tab
autocmd FileType python setlocal et sta sw=2 sts=2
"禁止文本文件自动换行
autocmd FileType text setlocal textwidth=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment