Skip to content

Instantly share code, notes, and snippets.

@simlegate
Last active December 16, 2015 08:08
Show Gist options
  • Save simlegate/5403670 to your computer and use it in GitHub Desktop.
Save simlegate/5403670 to your computer and use it in GitHub Desktop.
Vim configuration
" 定义
set number
colo desert
set guifont=DejaVu\ Sans\ Mono\ 14
syntax enable
syntax on
set autoindent
"显示当前的行号列号:
set ruler
"在状态栏显示正在输入的命令
set showcmd
" insert del
set whichwrap=b,s,<,>,[,]
" 开启高亮显示结果
set hlsearch
" 屏蔽vi的键盘用法
set nocompatible
set backspace=eol,start,indent
" 隐藏不常用到的工具条
" set guioptions-=T
" 高亮当前行
" set cursorline
" imap <tab> <Esc>
" map <tab> <Esc>
set runtimepath^=~/.vim/bundle/ctrlp.vim
"inoremap $1 ()<esc>i
set noet
"Toggle Menu and Toolbar
set guioptions-=m
set guioptions-=T
" 隐藏左侧滚动条
set guioptions-=L
" 隐藏右侧滚动条
set guioptions-=r
map <silent> <F2> :if &guioptions =~# 'T' <Bar>
\set guioptions-=T <Bar>
\set guioptions-=m <bar>
\else <Bar>
\set guioptions+=T <Bar>
\set guioptions+=m <Bar>
\endif<CR>
set laststatus&
"自动补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
: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
" 针对不同的文件类型加载对应的插件
filetype plugin on
" 启动自动补全
filetype plugin indent on
"打开文件类型检测, 加了这句才可以用智能补全
set completeopt=longest,menu
" 设置当文件被改动时自动载入
set autoread
"自动保存
" set autowrite
" 在处理未保存或只读文件的时候,弹出确认
set confirm
" 通过使用: commands命令,告诉我们文件的哪一行被改变过
set report=0
" 去掉输入错误的提示声音
set noeb
"共享剪贴板
" set clipboard=unnamedplus
" set clipboard+=unnamed
set clipboard=unnamed
" 关掉智能补全时的预览窗口
set completeopt=longest,menuone
let g:sztool_home="~/.vim/sztools/"
"##### auto fcitx ###########
let g:input_toggle = 1
function! Fcitx2en()
let s:input_status = system("fcitx-remote")
if s:input_status == 2
let g:input_toggle = 1
let l:a = system("fcitx-remote -c")
endif
endfunction
function! Fcitx2zh()
let s:input_status = system("fcitx-remote")
if s:input_status != 2 && g:input_toggle == 1
let l:a = system("fcitx-remote -o")
let g:input_toggle = 0
endif
endfunction
set ttimeoutlen=150
"退出插入模式
autocmd InsertLeave * call Fcitx2en()
"进入插入模式
"autocmd InsertEnter * call Fcitx2zh()
"##### auto fcitx end ######
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType ruby,eruby let g:rubycomplete_buffer_loading = 1
autocmd FileType ruby,eruby let g:rubycomplete_rails = 1
autocmd FileType ruby,eruby let g:rubycomplete_classes_in_global = 1
set history=700
set nobackup
set nowb
set noswapfile
"set the indent width
set shiftwidth=2
set smartindent " 开启新行时使用智能自动缩进
set fileencodings=utf-8
set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8
" 禁止方向键
noremap <Up> <nop>
noremap <Down> <nop>
noremap <Left> <nop>
noremap <Right> <nop>
" 空格显示中横线
set list
set listchars=tab:--,trail:-
" ============================================
" NeoBundle Ultimate Vim package manager
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#rc(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
NeoBundleFetch 'Shougo/neobundle.vim'
" Recommended to install
" After install, turn shell ~/.vim/bundle/vimproc, (n,g)make -f your_machines_makefile
NeoBundle 'Shougo/vimproc'
" My Bundles here:
"
" Note: You don't set neobundle setting in .gvimrc!
" Original repos on github
NeoBundle 'tpope/vim-rails'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'vim-scripts/VimClojure'
NeoBundle 'slim-template/vim-slim'
NeoBundle 'plasticboy/vim-markdown'
NeoBundle 'pangloss/vim-javascript'
NeoBundle 'zenorocha/dracula-theme'
NeoBundle 'msanders/snipmate.vim'
NeoBundle 'kien/ctrlp.vim'
NeoBundle 'mileszs/ack.vim'
" NeoBundle 'vim-scripts/taglist.vim'
filetype plugin indent on " Required!
" Installation check.
NeoBundleCheck
" ============================================
" Clojure for vim
" let vimclojure#WantNailgun = 1
let vimclojure#NailgunClient = "/usr/local/bin/ng"
let g:vimclojure#HighlightBuiltins = 1
" 每次点击Tab键,增加的缩进将被转化为4个空格
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment