Skip to content

Instantly share code, notes, and snippets.

@zernel
Last active November 26, 2015 08:28
Show Gist options
  • Save zernel/00d7a7052264211712fe to your computer and use it in GitHub Desktop.
Save zernel/00d7a7052264211712fe to your computer and use it in GitHub Desktop.
My vim config with Neobundle
"set colortheme
"colorscheme autumn
"colorscheme blackboard
colorscheme asu1dark
" 启动gvim时窗口的大小
set lines=42 columns=170
" set font
"set guifont=Monaco:h15
"set guifont=Source\ Code\ Pro\ Regular:h15
set guifont=Source\ Code\ Pro\:h15
" set powerline
let g:Powerline_symbols = 'fancy'
if has("gui_macvim")
" Press Ctrl-Tab to switch between open tabs (like browser tabs) to
" the right side. Ctrl-Shift-Tab goes the other way.
noremap <C-Tab> :tabnext<CR>
noremap <C-S-Tab> :tabprev<CR>
" Switch to specific tab numbers with Command-number
noremap <D-1> :tabn 1<CR>
noremap <D-2> :tabn 2<CR>
noremap <D-3> :tabn 3<CR>
noremap <D-4> :tabn 4<CR>
noremap <D-5> :tabn 5<CR>
noremap <D-6> :tabn 6<CR>
noremap <D-7> :tabn 7<CR>
noremap <D-8> :tabn 8<CR>
noremap <D-9> :tabn 9<CR>
" Command-0 goes to the last tab
noremap <D-0> :tablast<CR>
endif
"NeoBundle Scripts-----------------------------
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" Add or remove your Bundles here:
NeoBundle 'Shougo/neosnippet.vim'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'flazz/vim-colorschemes'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'thoughtbot/vim-rspec'
NeoBundle 'rspec.vim'
NeoBundle 'ack.vim'
NeoBundle 'comments.vim'
NeoBundle 'ctrlp.vim'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'ervandew/supertab'
NeoBundle 'tpope/vim-bundler'
NeoBundle 'kchmck/vim-coffee-script'
NeoBundle 'tpope/vim-rails'
NeoBundle 'nathanaelkane/vim-indent-guides'
NeoBundle 'plasticboy/vim-markdown'
NeoBundle 'Lokaltog/vim-powerline'
NeoBundle 'vim-ruby/vim-ruby'
NeoBundle "MarcWeber/vim-addon-mw-utils"
NeoBundle "tomtom/tlib_vim"
NeoBundle "garbas/vim-snipmate"
NeoBundle 'honza/vim-snippets'
" You can specify revision/branch/tag.
NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' }
" Required:
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
"End NeoBundle Scripts-------------------------
" RSpec.vim mappings
let g:rspec_runner = "os_x_iterm" " Set iTerm instead of Terminal
map <Leader>t :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
"auto completed
"RUBY
let g:rubycomplete_buffer_loading = 1
let g:rubycomplete_classes_in_global = 1
let g:rubycomplete_rails = 1
"RUBY plugin
autocmd FileType ruby compiler ruby
"autocmd vimenter * if !argc() | NERDTree | endif
"autocmd VimEnter * NER
" 设定文件浏览器目录为当前目录
set bsdir=buffer
" 设置编码
set enc=utf-8
" 设置文件编码
set fenc=utf-8
" 设置文件编码检测类型及支持格式
set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
"显示行号
set number
"忽略大小写查找
set ic
" tab宽度
set tabstop=2
set cindent shiftwidth=2
set autoindent shiftwidth=2
" set 折叠
"set foldmethod=indent
" 打开文件默认不折叠
"set foldlevelstart=99
set nofoldenable
let g:vim_markdown_folding_disabled = 0
"set my leader
"let mapleader=","
"let g:mapleader=","
"tabs
map <leader>tn :tabnew<cr>
map <leader>te :tabedit
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
" 映射NERDTree插件
"let loaded_nerd_tree = 1
map <C-n> :NERDTreeToggle<CR>
"let NERDTreeQuitOnOpen = 1
let NERDChristmasTree=1
let g:NERDTreeWinSize = 25
"switch window
:map <leader>w <C-W>w
" 把 CTRL-S 映射为 保存,因为这个操作做得太习惯了
imap <C-S> <C-C>:w<CR>
"set zen coding
let g:user_zen_settings = {
\ 'php' : {
\ 'extends' : 'html',
\ 'filters' : 'c',
\ },
\ 'xml' : {
\ 'extends' : 'html',
\ },
\ 'haml' : {
\ 'extends' : 'html',
\ },
\ 'erb' : {
\ 'extends' : 'html',
\ },
\}
"set CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 2
"use in edit
imap <C-A> <C-C><c-p>
"use in none edit
:map <leader>t <c-p>
:map <leader>b :CtrlPBuffer<CR>
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.jpg,*.png,*.gif,*.jpeg,.DS_Store " MacOSX/Linux
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
" move lines up or down (command - D)
nmap <D-j> mz:m+<cr>`z
nmap <D-k> mz:m-2<cr>`z
vmap <D-j> :m'>+<cr>`<my`>mzgv`yo`z
vmap <D-k> :m'<-2<cr>`>my`<mzgv`yo`z
" Tab move lines left or right (c-Ctrl,s-Shift)
nmap <c-tab> v>
nmap <s-tab> v<
vmap <c-tab> >gv
vmap <s-tab> <gv
" tab navigation like zsh
:nmap <D-1> :tabprevious<CR>
:map <D-1> :tabprevious<CR>
imap <D-1> <Esc>:tabprevious<CR>i
:nmap <D-2> :tabnext<CR>
:map <D-2> :tabnext<CR>
imap <D-2> <Esc>:tabnext<CR>i
"""scss,sass
""au BufRead,BufNewFile *.scss set filetype=scss
""au BufRead,BufNewFile *.sass set filetype=scss
""
"""coffee script
""au BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable
""au BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab
""hi link coffeeSpaceError NONE
""hi link coffeeSemicolonError NONE
""hi link coffeeReservedError NONE
""map <leader>cf :CoffeeCompile watch vert<cr>
""ctags
"set tags+=~/gitdb/rails/tags
""auto completed
"" Disable AutoComplPop.
"let g:acp_enableAtStartup = 0
"
"
"" Enable omni completion.
"autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
"autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
"
"" Enable heavy omni completion.
"if !exists('g:neocomplcache_omni_patterns')
" let g:neocomplcache_omni_patterns = {}
"endif
"let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::'
"autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
"set powerline
set laststatus=2
"set guifont=Powerline
"set font=Source\ Code\ Pro\:h15
set nocompatible
set t_Co=256
let g:Powerline_cache_enabled = 1
" Highlight the search results
set hlsearch
map <D-r> :nohlsearch<cr>
" set color theme
"colorscheme blackboard
colorscheme busybee
set expandtab
map <leader>ct :!ctags -R .<CR>
map <leader>cp :CtrlPTag<CR>
" Never ever let Vim write a backup file! They did that in the 70’s.
" Use modern ways for tracking your changes (like git), for God’s sake
set nobackup
set nowritebackup
set noswapfile
@zernel
Copy link
Author

zernel commented Dec 23, 2014

https://github.com/Shougo/neobundle.vim

$ curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh | sh

@zernel
Copy link
Author

zernel commented Jun 26, 2015

Need to run brew install ctags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment