The recommended method for running standardrb within vim is with vim-lsp.
First install vim-lsp:
$ git clone git@github.com:prabirshrestha/vim-lsp.git $HOME/.vim/pack/github/opt/vim-lsp
Edit your vimrc to first tell Vim to load the vim-lsp plugin:
# Tell Vim to find vim-lsp
packadd vim-lsp
Then, also in your vimrc, teach vim-lsp to execute standardrb
for Ruby files:
# Use standard if available if executable('standardrb') au User lsp_setup call lsp#register_server({ \ 'name': 'standardrb', \ 'cmd': ['standardrb', '--lsp'], \ 'allowlist': ['ruby'], \ }) endif
To set Standard as your only linter and fixer for Ruby files and thereby preventing conflicts with RuboCop, add these lines to your .vimrc file:
let g:ale_linters = {'ruby': ['standardrb']}
let g:ale_fixers = {'ruby': ['standardrb']}
For automatically fixing on save, add this to your .vimrc:
let g:ale_fix_on_save = 1
It is quite common for rubyists to use vim-ruby for ruby-aware syntax highlighting and indentation. However, vim-ruby's default indentation conflicts with standardrb. The following will configure vim-ruby to use the same indentation style as standardrb:
let g:ruby_indent_assignment_style = 'variable'
let g:ruby_indent_hanging_elements = 0
see also: vim-ruby indentation docs
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4