Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
5

The file that controls this lives at /usr/share/vim/vim80/indent/ruby.vim. Opening the file, I see it has two variables: if !exists('g:ruby_indent_access_modifier_style') " Possible values: "normal", "indent", "outdent" let g:ruby_indent_access_modifier_style = 'normal' endif if !exists('g:ruby_indent_block_style') " Possible values: "expression", "...


4

Ok, this is probably not the best solution because it is pretty invasive. But, it's all I could come up with so I will give it to you. One thing we can do is basically manually do the highlighting ourselves. So we could easily do something like: syn match quotedErubyBlock '"<%.\{-}%>"' This will define a new highlighting section that matches "<...


3

Take a look at the IRuby kernel for Jupyter / IPython and ipython-vimception. If you must do it in Vim itself you might try the vim-ipython plugin, but in my experience this part doesn't work very well.


3

If you want to evaluate a single line you can do this with a macro simply : qq$hy:r! ruby -e '<C-r>"'<CR> Decomposing : qq " record a new macro v$hy " select the current line minus the ^m :r! " prepare to read a command ruby -e '<C-r>"' " call ruby inline mode executing <CR> "...


3

There are actually several way to do that. The first google result is the vim-ruby-eval plugin which provides the :RubyEval command. Here is a screen cast coming from the README page of the plugin: This plugin requires +ruby (:echo has('ruby') should return 1) You can also do this with the xmpfilter command provided by the rcodetools ruby gem. As this ...


2

Just solved my problem. Not 100% sure how, but I'll do my best to explain all the steps I took: Installed Vundle and configured it to manage vim-ruby and neocomplete, ran :PluginInstall and :PluginUpdate a few times, tried rebooting Added the following lines to my .vimrc, found in another thread: autocmd FileType ruby,eruby let g:...


2

Just make sure your basic configuration has filetype enabled to begin with: filetype plugin on If it is, but sill not working as intended, you can set filetypes explicitly: Something like this should be in your ~/.vimrc or ~/.config/nvim/init.vim depending on whichever editor you are actually using: augroup MyRubyCode " Files with extension .rb are ...


2

Thanks to the comment's help, I was able to muck around with my .vimrc some more and isolate the issue to the commented-out line: filetype indent on Not sure how I missed that before, but it works now, so thanks!


1

ALE doesn't seem to support prettier for Ruby in its default configuration. Though it offers enough hooks for you to use a different executable (such as rbprettier) or to pass it additional arguments (such as --parser ruby). You can override these with buffer-local variables b:ale_javascript_prettier_executable and b:ale_javascript_prettier_options. See ...


1

It seems that if ruby path is not set correctly during vim compilation, it slows down vim when editing ruby files, check this post. Also, using old regex engine (set re=1) rather than the new one speed things up apparently.


1

It is probably the result of the mappings in $VIMRUNTIME/ftplugin/ruby.vim, which include a mapping of <C-R><C-W> to <Plug><cword> which is then mapped to a call to RubyCursorIdentifier(). That function contains expressions more complicated than I wished to follow, but it probably sees the ! as belonging to the identifier mymethod and ...


1

The iskeyword setting controls this. You can add ? and ! to it with: :setlocal iskeyword+=? iskeyword+=! Or, for just Ruby from your vimrc: augroup ruby_settings autocmd! autocmd Filetype Ruby :setlocal iskeyword+=? iskeyword+=! augroup end Do not use set iskeyword=.. from your vimrc, as that will likely lead to problems with other filetypes. ...


1

No, that is not possible. Vim treats all those 'is...' options as collections of characters (like [a-zA-z]), and cannot do more precise regular expression-like assertions. In fact, the 'iskeyword' set has its own character class (:help /\k), so it is limited to be a simple set of characters. If this were changed, that correspondence of "a keyword" and a \k\+...


1

Are you using any kind of auto-completion plugin, like neocomplete/YouCompleteMe? I also use Arch Linux and for me it gives completions. I use neocomplete and vim-ruby plugins, that probably add needed things to do the completion EDIT: Relevant parts of my vimrc: autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete autocmd FileType ruby,eruby let ...


1

Thanks @tomstuart: I use https://github.com/t9md/vim-ruby-xmpfilter with xmpfilter.


Only top voted, non community-wiki answers of a minimum length are eligible