use*_*693 12 ruby vim auto-indent
假设我有set cindent在.vimrc
def func()后面Enter,然后键入end,它缩进(不对齐def)
如何缩进的end关键字(将其调整到def).
即使使用endwise.vim plugin不解决问题
https://github.com/tpope/vim-endwise.git
它增加了自动的end关键字,但再次indented
m0t*_*ive 22
尝试使用smartindent而不是cindent(遵循类似C的缩进行为),并打开文件类型特定的缩进.
您可能还需要关闭vi兼容性.
尝试将此添加到您.vimrc:
" Turn off vi compatibility
set nocompatible
set smartindent
set autoindent
" load indent file for the current filetype
filetype indent on
Run Code Online (Sandbox Code Playgroud)
vimfiles包括 ruby 代码智能缩进和许多其他有用的东西
ruby 代码自动格式化为
class Foo
def bar
if xxx
blah
else
blahblah
end
barfoo
barfoo
end
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12471 次 |
| 最近记录: |