After installing vim-rails plugin I got problems with HAML indentation
Sounds like you may have some tab characters embedded in your file - do a :retab
, which will convert them to spaces.
I also have set list listchars=tab:»·
in my .vimrc, which makes tab characters nice and obvious when editing a file. :)
Vim's Ruby option is not enabled
The functionality on the second screenshot is given by installing the vim-ruby plugin.
The internal Ruby support is to allow people to write plugins and scripts for Vim using Ruby and it's not strictly necessary for what you seem to want to accomplish.
If you REALLY want to add Ruby support, you can always build Vim from source (or get a package with it already built). I suggest you to look into Vim's homepage for more info on this matter.
vim ruby plugin indentation
Try to add autocmd FileType ruby set shiftwidth=2
to .vimrc
Vim ruby, rails omnicompletion: Error loading rails environment. How do I configure vim-ruby's autocomplete to work with rails?
Upon further investigation, vim-ruby
was executing the system's ruby, with which I wasn't able to get rubygems to work. I'm not absolutely sure, but I believe vim-ruby/autoload/rubycomplete.vim
was failing at this line while attempting to require the console_app
gem, which didn't exist on my system.
So I re-built vim according to the instructions on Jon Cairns' blog. The article references RVM, but is equally applicable to rbenv or whatever ruby you might be using.
For posterity's sake, on Ubuntu, the steps I took to do this were:
sudo apt-get install mercurial
hg clone https://vim.googlecode.com/hg/ vim && cd vim
./configure --with-features=HUGE --enable-pythoninterp=yes --enable-multibyte=yes --enable-rubyinterp=yes --with-ruby-command=$(which ruby) --enable-gui=gnome2 --with-x --enable-fontset
make
sudo make install
After doing this, omni-completion in Rails works like a charm - albeit a bit slow the first time it's used.
Problems with new command on Rails.vim
As mentioned in comments (by romainl and Peter Rincker), it is a bug of the latest version of the plugin.
The Issue http://github.com/tpope/vim-rails/issues/344 was posted and solved. An update of my local version solved the problem. Now, everything works fine.
Related Topics
Why Slicing The Params Hash Poses a Security Issue on Mass-Assignment
Bundler Using Wrong Ruby Version
How to Remove a Url's Trailing Slash in a Rails App? (In a Seo View)
Sql Like Operator in Ruby on Rails
Do Ruby Objects Have a Size Limit
Belongs_To Presence in Rails 5 Not Working
How to Fix Difference in Behavior of Activesupport 3.0.0 Compare to 2.X
Converting Ruby Hashes to Arrays
Need Help Installing Ruby 2.7.2 on Mac
How to Handle Omniauth Callbacks in Multiple Environments
Ruby on Rails Private Link Sharing: Google Docs Style
Rails 3, Http Extensions (Webdav) and Rack App Mounting
Skipping: Touch Associations When Saving an Activerecord Object
In Ruby, How to Be Warned of Duplicate Keys in Hashes When Loading a Yaml Document
Using Google Search Rest API in Ruby