1
0
mirror of https://github.com/amix/vimrc synced 2025-06-17 10:55:00 +08:00

Updated plugins

This commit is contained in:
Amir
2020-12-04 22:15:32 +01:00
parent e83f5ea2e7
commit a06964dd3b
261 changed files with 6955 additions and 2773 deletions

View File

@ -28,6 +28,9 @@ choosing another installation method. The version you download will
supersede the version that ships with Vim, so you will now be
responsible for keeping it up-to-date.)
If you're looking for stable releases from a particular version, you can find
them in [github](https://github.com/vim-ruby/vim-ruby/releases).
Manually
--------

View File

@ -1,73 +0,0 @@
+---------------------------------+
| vim-ruby github project README |
+---------------------------------+
Summary:
This project contains Vim configuration files for editing and compiling Ruby
within Vim. See the project homepage for more details.
Web links:
Homepage: https://github.com/vim-ruby
Explanation: https://github.com/vim-ruby/vim-ruby/wiki
For regular users:
- The project page should have two tarballs for download:
- vim-ruby-YYYY.MM.DD.tar.gz (the current stable release)
- vim-ruby-devel-YYYY.MM.DD.tar.gz (cutting-edge features we'd like you
to test)
- Please give feedback through the bug tracking and feature request features
of GitHub.
- Feel free to join discussions on the vim-ruby-devel mailing list:
http://rubyforge.org/mail/?group_id=16
For would-be contributors:
- Please get the latest from Git.
- Please join the mailing list and discuss changes, submit patches, etc.
- Thank you very much for taking an interest.
Contents of the project:
- The autoload, compiler, ftdetect, ftplugin, indent and syntax directories
contain the ruby*.vim files that are to be copied to a location somewhere
in the Vim 'runtimepath'.
How you get these files into Vim:
- By downloading the project via a snapshot or Git, you can keep up with
the latest, make changes, and install the files to a Vim directory.
- By downloading one of the tarballs, you can easily install the latest
stable or development version wherever you like on your machine. No
README etc. just Vim files. You would typically install these into either
$VIM/vimfiles, for system-wide use, or $HOME/.vim ($HOME/vimfiles on
Windows) for personal use.
- Remember that when you install Vim in the first place, all of these files
are present. The purpose of downloading and installing them from
GitHub is to get the latest version of them.
Git topics:
- Project was migrated from CVS in August, 2008.
- Files are tagged according to which version of Vim they are released in.
- The project was initiated in July 2003, when the current version of Vim
was 6.2. Thus every file began its life tagged as vim6.2.
- Modifications to the files are made in the expectation that they need to
be tested by interested users. They therefore (probably) don't have a
tag, and are available via "git pull --rebase", or a development snapshot.
- When a modification is considered stable, it is given a tag.
Everything that is stable gets released in vim-ruby-YYY.MM.DD.tar.gz files.
- When a new version of Vim is about to be released, the stable tarball is
contributed to it. After it has been released, the files are tagged
accordingly.
- MORAL OF THE STORY: modifications are committed to the head of the tree;
when they are ready for release into userland, they are tagged "stable".
Any questions or suggestions?
- If there's something about the project or its concepts that you don't
understand, send an email to the release coordinator, Doug Kearns
(dougkearns at gmail.com).
- To ask about the contents of the configuration files, open a GitHub issue
or ask on the mailing list, as different people maintain the different
files.
Project gossip:
- While the individual effort to maintain these files has a long history,
this actual project began in late July 2003.
--= End of Document =--

View File

@ -0,0 +1,63 @@
## Vim-ruby
This project contains Vim's runtime files for ruby support. This includes syntax
highlighting, indentation, omnicompletion, and various useful tools and mappings.
## Installation
See the file [INSTALL.markdown](./INSTALL.markdown) for instructions.
You might also find useful setup tips in the github wiki:
https://github.com/vim-ruby/vim-ruby/wiki/VimRubySupport
## Usage
Ideally, vim-ruby should work "correctly" for you out of the box. However, ruby
developers have varying preferences, so there are settings that control some of
the details. You can get more information on these by using the native `:help`
command:
- [`:help vim-ruby-plugin`](./doc/ft-ruby-plugin.txt): Filetype settings and custom mappings
- [`:help vim-ruby-indent`](./doc/ft-ruby-indent.txt): Indentation settings
- [`:help vim-ruby-syntax`](./doc/ft-ruby-syntax.txt): Syntax-related tweaks
- [`:help vim-ruby-omni`](./doc/ft-ruby-omni.txt): Information and settings for omni completion
## Issues
If you have an issue or a feature request, it's recommended to use the github
issue tracker: https://github.com/vim-ruby/vim-ruby/issues. Try the search box
to look for an existing issue -- it might have already been reported.
If you don't have a github account or would rather contact us in a different
way, you can find emails for individual maintainers in the
[CONTRIBUTORS](./CONTRIBUTORS) file. They're also in the comment headers of the
project's Vimscript files (`syntax/ruby.vim`, `indent/ruby.vim`, etc) under the
label "Maintainer".
If you're not sure who the most relevant person to contact is for your
particular issue, you can send an email to the release coordinator, Doug Kearns
(dougkearns at gmail.com).
## Contributing
Vim-ruby is a mature project, which is one way of saying it moves slowly and it
can be a bit difficult to modify. It's far from impossible, but be warned that
issues and PRs may take time to be handled. Partly, it's because we don't want
to risk breaking Vim's core ruby support, partly because it takes a lot of time
and energy to debug and fix things.
Contributing a fix for an issue would be very appreciated, even if it's a
proof-of-concept to start a conversation. Be warned that we're definitely going
to be conservative when considering changes to vim-ruby.
The code is tested using [RSpec](https://rspec.info/) and
[Vimrunner](https://github.com/AndrewRadev/vimrunner). The tests are not
exhaustive, but they should cover a wide variety of cases.
## Project history
This project began in July 2003, when the current version of Vim was 6.2. It
was migrated from CVS in August, 2008.
If you're curious about individual pre-git changes, you can read some of them
in the (unmaintained) [NEWS](./NEWS) and/or [ChangeLog](./ChangeLog) files.

View File

@ -1,8 +1,10 @@
RUBY *ft-ruby-indent*
*vim-ruby-indent*
Ruby: Access modifier indentation |ruby-access-modifier-indentation|
Ruby: Block style indentation |ruby-block-style-indentation|
Ruby: Assignment style indentation |ruby-assignment-style-indentation|
Ruby: Hanging element indentation |ruby-hanging-element-indentation|
*ruby-access-modifier-indentation*
*g:ruby_indent_access_modifier_style*
@ -64,7 +66,7 @@ Different block indentation styles can be used by setting: >
:let g:ruby_indent_block_style = 'expression'
:let g:ruby_indent_block_style = 'do'
<
By default, the "expression" block indent style is used.
By default, the "do" block indent style is used.
Block indent style "expression":
>
@ -105,5 +107,42 @@ Assignment indent style "variable":
end
<
*ruby-hanging-element-indentation*
*g:ruby_indent_hanging_elements*
Ruby: Hanging element indentation ~
Elements of multiline collections -- such as arrays, hashes, and method
argument lists -- can have hanging indentation enabled or disabled with the
following setting.
>
:let g:ruby_indent_hanging_elements = 1
:let g:ruby_indent_hanging_elements = 0
<
By default, this setting is "1" (true) meaning that hanging indentation is
enabled in some cases.
Here is an example method call when the setting is true (non-zero):
>
render('product/show',
product: product,
on_sale: true,
)
<
And the same method call when the setting is false (zero):
>
render('product/show',
product: product,
on_sale: true,
)
<
Note that, even if the setting is turned on, you can still get non-hanging
indentation by putting each argument on a separate line:
>
render(
'product/show',
product: product,
on_sale: true,
)
<
vim:tw=78:sw=4:ts=8:ft=help:norl:

View File

@ -1,4 +1,5 @@
RUBY *ft-ruby-omni*
*vim-ruby-omni*
Completion of Ruby code requires that Vim be built with |+ruby|.

View File

@ -1,4 +1,6 @@
RUBY *ft-ruby-plugin*
*vim-ruby-plugin*
Ruby: Recommended settings |ruby-recommended|
Ruby: Motion commands |ruby-motion|

View File

@ -1,4 +1,5 @@
RUBY *ruby.vim* *ft-ruby-syntax*
*vim-ruby-syntax*
Ruby: Operator highlighting |ruby_operators|
Ruby: Whitespace errors |ruby_space_errors|

View File

@ -117,7 +117,7 @@ endif
" TODO: comments=
setlocal commentstring=<%#%s%>
let b:undo_ftplugin = "setl cms< "
let b:undo_ftplugin = "setl cms< " .
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
let &cpo = s:save_cpo

View File

@ -26,7 +26,12 @@ endif
if !exists('g:ruby_indent_block_style')
" Possible values: "expression", "do"
let g:ruby_indent_block_style = 'expression'
let g:ruby_indent_block_style = 'do'
endif
if !exists('g:ruby_indent_hanging_elements')
" Non-zero means hanging indents are enabled, zero means disabled
let g:ruby_indent_hanging_elements = 1
endif
setlocal nosmartindent
@ -321,7 +326,11 @@ function! s:ClosingBracketOnEmptyLine(cline_info) abort
if searchpair(escape(bracket_pair[0], '\['), '', bracket_pair[1], 'bW', s:skip_expr) > 0
if closing_bracket == ')' && col('.') != col('$') - 1
let ind = virtcol('.') - 1
if g:ruby_indent_hanging_elements
let ind = virtcol('.') - 1
else
let ind = indent(line('.'))
end
elseif g:ruby_indent_block_style == 'do'
let ind = indent(line('.'))
else " g:ruby_indent_block_style == 'expression'
@ -546,7 +555,9 @@ function! s:AfterUnbalancedBracket(pline_info) abort
let [opening, closing] = s:ExtraBrackets(info.plnum)
if opening.pos != -1
if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if !g:ruby_indent_hanging_elements
return indent(info.plnum) + info.sw
elseif opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0
if col('.') + 1 == col('$')
return indent(info.plnum) + info.sw
else

View File

@ -1,10 +1,6 @@
require 'spec_helper'
describe "Indenting" do
after :each do
vim.command 'let g:ruby_indent_block_style = "expression"'
end
specify "indented blocks with expression style" do
vim.command 'let g:ruby_indent_block_style = "expression"'
@ -103,6 +99,7 @@ describe "Indenting" do
end
specify "blocks with multiline parameters" do
vim.command 'let g:ruby_indent_block_style = "expression"'
assert_correct_indenting <<~EOF
def foo
opts.on('--coordinator host=HOST[,port=PORT]',

View File

@ -57,6 +57,7 @@ describe "Indenting" do
end
specify "continuations after round braces" do
vim.command 'let g:ruby_indent_block_style = "expression"'
assert_correct_indenting <<~EOF
opts.on('--coordinator host=HOST[,port=PORT]',
'Specify the HOST and the PORT of the coordinator') do |str|
@ -67,10 +68,6 @@ describe "Indenting" do
end
describe "assignments" do
after :each do
vim.command 'let g:ruby_indent_assignment_style = "hanging"'
end
specify "continuations after assignment" do
assert_correct_indenting <<~EOF
variable =

View File

@ -0,0 +1,78 @@
require 'spec_helper'
describe 'Indenting' do
specify 'method args' do
assert_correct_indenting <<~EOF
render('product/show',
product: product,
on_sale: true,
)
EOF
vim.command 'let g:ruby_indent_hanging_elements = 0'
assert_correct_indenting <<~EOF
render('product/show',
product: product,
on_sale: true,
)
EOF
end
specify 'method args with block' do
assert_correct_indenting <<~EOF
opts.on('--coordinator host=HOST[,port=PORT]',
'Specify the HOST and the PORT of the coordinator') do |str|
h = sub_opts_to_hash(str)
puts h
end
EOF
vim.command 'let g:ruby_indent_hanging_elements = 0'
assert_correct_indenting <<~EOF
opts.on('--coordinator host=HOST[,port=PORT]',
'Specify the HOST and the PORT of the coordinator') do |str|
h = sub_opts_to_hash(str)
puts h
end
EOF
end
specify 'arrays' do
assert_correct_indenting <<~EOF
x = [1,
2,
3,
]
EOF
vim.command 'let g:ruby_indent_hanging_elements = 0'
assert_correct_indenting <<~EOF
x = [1,
2,
3,
]
EOF
end
specify 'hashes' do
assert_correct_indenting <<~EOF
x = { a: 1,
b: 2,
c: 3,
}
EOF
vim.command 'let g:ruby_indent_hanging_elements = 0'
assert_correct_indenting <<~EOF
x = { a: 1,
b: 2,
c: 3,
}
EOF
end
end

View File

@ -1,10 +1,6 @@
require 'spec_helper'
describe "Indenting" do
after :each do
vim.command 'let g:ruby_indent_access_modifier_style = "normal"'
end
specify "default indented access modifiers" do
assert_correct_indenting <<~EOF
class OuterClass

View File

@ -20,6 +20,7 @@ describe "Indenting" do
}
EOF
vim.command 'let g:ruby_indent_block_style = "expression"'
assert_correct_indenting <<~EOF
var.
func1(:param => 'value') {
@ -40,6 +41,7 @@ describe "Indenting" do
}
EOF
vim.command 'let g:ruby_indent_block_style = "expression"'
assert_correct_indenting <<~EOF
foo,
bar = {
@ -53,6 +55,7 @@ describe "Indenting" do
end
specify "nested blocks with a continuation and function call inbetween" do
vim.command 'let g:ruby_indent_block_style = "expression"'
assert_correct_indenting <<~EOF
var.
func1(:param => 'value') {

View File

@ -20,6 +20,7 @@ describe "Indenting" do
end
specify "splats with blocks in assignment" do
vim.command 'let g:ruby_indent_block_style = "expression"'
assert_correct_indenting <<~EOF
x = *
array.map do

View File

@ -1,6 +1,16 @@
require 'vimrunner'
require 'vimrunner/rspec'
RSpec.configure do |config|
# reset globals to default values before each test
config.before(:each) do
vim.command 'let g:ruby_indent_access_modifier_style = "normal"'
vim.command 'let g:ruby_indent_block_style = "do"'
vim.command 'let g:ruby_indent_assignment_style = "hanging"'
vim.command 'let g:ruby_indent_hanging_elements = 1'
end
end
Vimrunner::RSpec.configure do |config|
config.reuse_server = true

View File

@ -65,7 +65,7 @@ endfunction
com! -nargs=* SynFold call s:run_syntax_fold(<q-args>)
" Not-Top Cluster {{{1
syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses
syn cluster rubyNotTop contains=@rubyCommentNotTop,@rubyStringNotTop,@rubyRegexpSpecial,@rubyDeclaration,@rubyExceptionHandler,@rubyClassOperator,rubyConditional,rubyModuleName,rubyClassName,rubySymbolDelimiter,rubyParentheses,@Spell
" Whitespace Errors {{{1
if exists("ruby_space_errors")
@ -331,7 +331,7 @@ SynFold '<<' syn region rubyString start=+\%(\%(class\|::\|\.\@1<!\.\)\_s*\|\%([
syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,@rubyGlobalVariable nextgroup=rubyAliasDeclaration2 skipwhite
syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,@rubyGlobalVariable
syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable
syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyClassName,rubyScopeOperator nextgroup=rubySuperClassOperator skipwhite skipnl
syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyClassName,rubyScopeOperator nextgroup=rubySuperClassOperator skipwhite
syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyModuleName,rubyScopeOperator
syn match rubyMethodName "\<\%([_[:alpha:]]\|[^\x00-\x7F]\)\%([_[:alnum:]]\|[^\x00-\x7F]\)*[?!=]\=\%([[:alnum:]_.:?!=]\|[^\x00-\x7F]\)\@!" contained containedin=rubyMethodDeclaration