我最近设置了vim-ruby
插件,并希望它能像docs所说的那样开箱即用,但即使是基本的ruby缩进也不适用于我。我有一个非常简单的vimrc文件:
set nocompatible " turn vi into vim
filetype off " required by vundle
" VUNDLE SETUP
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin() " required
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Track the engine.
Plugin 'SirVer/ultisnips'
" " Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'
" go-vim plugin by fatih
Plugin 'fatih/vim-go'
" vim-ruby plugin for ruby shit
Plugin 'vim-ruby/vim-ruby'
" vim-fugitive plugin for git
Plugin 'tpope/vim-fugitive'
" enabled vim-neatstatus line
Plugin 'maciakl/vim-neatstatus'
call vundle#end() " required
filetype plugin indent on " enable file detection
syntax on " Always turn the syntax on
set expandtab " Turn tab into spaces
set number " Turn on numbering of lines
set showmatch " Show matching brackets.
set matchtime=5 " Bracket blinking.
set noshowmode " Shows vim mode
" set status line
set laststatus=2 " Always show status line.
" Match and search
set hlsearch " highlight search
set ignorecase " Do case in sensitive matching with
set smartcase " be sensitive when there's a capital letter
set incsearch " Search incrementally
" color scheme
set background=dark
colorscheme molokai
set t_Co=256
let mapleader = ","
let g:mapleader = ","
" remap hjkl
noremap ' l
noremap ; k
noremap l j
noremap k h
nnoremap . ;
" Fast saving
nmap <leader>w :w!<cr>
" Fast quitting
nmap <leader>q :q<cr>
" Fast save and quit
nmap <leader>ww :wq<cr>
" toggle the paste
map <leader>p :set paste!<CR>
" toggles search highlighting
nmap <silent> <leader>n :set hlsearch!<CR>
" Turn off auto-commenting
au FileType * setlocal formatoptions-=cro
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<c-k>"
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<s-c-k>"
没什么好疯狂的。但是,每当编辑ruby文件(.rb,Rakefile等)时,缩进总是8个空格,我不知道为什么。
即使是简单的if子句也会变成这样:
if foo == "bar"
puts "foobar"
end
vim-ruby在检测Rakefile等ruby文件方面做得非常棒,但在花了几个小时调查缩进后,我放弃并打开了这个问题。
我的vim版本:
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Oct 22 2014 11:49:13)
MacOS X (unix) version
Included patches: 1-430
Compiled by Homebrew
答案 0 :(得分:2)
尝试将a.search-result {
display: block;
text-decoration: none;
color: black;
border-bottom: 1px solid #ccc;
border-bottom-left-radius: 29px;
margin: 0 0 0 -25px;
transition: color 2s;
}
a:hover.search-result {
color: #0000ff;
}
添加到autocmd FileType ruby set shiftwidth=2