首页 > 解决方案 > Vim 8 包干扰缩进?

问题描述

我最近切换到 Vim 8 以利用新的功能。我今天注意到,当我使用=自动更正缩进的键时,它现在破坏了一切。

这是损坏的缩进的样子:

  1 class FriendPolicy < ApplictionPolicy
  2 class Scope
  3 attr_reader :user, :friend
  4 
  5              def initialize(user, friend)
  6   @user = user
  7   @friend = friend
  8   end
  9 
 10   def resolve; end
 11   end
 12 
 13   def index?; end
 14   end

文件应该如下所示:

  1 class FriendPolicy < ApplictionPolicy
  2   class Scope
  3     attr_reader :user, :friend
  4 
  5     def initialize(user, friend)
  6       @user = user
  7       @friend = friend
  8     end
  9 
 10     def resolve; end
 11   end
 12 
 13   def index?; end
 14 end

我尝试过的事情:

  1. 我将唯一的包重命名为vim/pack/my_packages/start/vim-rubocop_asdfjlkdf然后,我的包没有加载,但问题仍然存在。
  2. 我将我的vim/pack文件重命名为任意名称,例如vim/pack_asdlkfjasdf然后缩进再次开始工作,但当然我的包没有加载

这是我的超级简单 vim 文件设置的链接:https ://github.com/latazzajones/dotfiles/tree/master/vim

任何意见将是有益的

标签: vim

解决方案


From looking at you vimrc, it seems the following is missing:

filetype plugin indent on

This enables to load filetype specific plugins and indent files.

See :help :filetype, :help :filetype-plugin-onand :help :filetype-indent-on.


推荐阅读