Reputation: 516
suppose I have set cindent
in .vimrc
def func()
followed by Enter
, and then type end
, it is indented(not aligned to the def
)
How to reindent the end
keyword(align it to the def
).
Even using endwise.vim plugin
doesn't fix the problem
https://github.com/tpope/vim-endwise.git
It adds automatically the end
keyword but again indented
Upvotes: 13
Views: 13882
Reputation: 23929
In my case this is what fixed my indentation issues (e.g. jumps in random places):
set smartindent
set noautoindent
filetype indent off
Upvotes: 1
Reputation: 30581
This worked for me.
" Ruby indentation from http://ubuntuforums.org/showthread.php?t=290462
if has ("autocmd")
filetype indent on
endif
Upvotes: 0
Reputation: 2946
Try using smartindent
instead of cindent
(which follows C-like indent behaviour), and turn on the filetype specific indent.
You'll also probably need to turn off vi compatibility.
Try adding this to you .vimrc:
" Turn off vi compatibility
set nocompatible
set smartindent
set autoindent
" load indent file for the current filetype
filetype indent on
Upvotes: 24