diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 09:15:44 +0100 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-03-04 09:15:44 +0100 |
commit | ed677c34d55a0e025b7008f29419498a3989cde2 (patch) | |
tree | 62efef78ed05b2b4e61efb21e40a6b337359eb8e /ftplugin/ruby.vim | |
parent | c161994e9607399a7b365ab274592bfc4f100306 (diff) | |
download | vim-polyglot-ed677c34d55a0e025b7008f29419498a3989cde2.tar.gz vim-polyglot-ed677c34d55a0e025b7008f29419498a3989cde2.zip |
Update
Diffstat (limited to 'ftplugin/ruby.vim')
-rw-r--r-- | ftplugin/ruby.vim | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/ftplugin/ruby.vim b/ftplugin/ruby.vim index 5b763e16..4c925fab 100644 --- a/ftplugin/ruby.vim +++ b/ftplugin/ruby.vim @@ -4,8 +4,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'ruby') == -1 " Language: Ruby " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" ---------------------------------------------------------------------------- +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> if (exists("b:did_ftplugin")) finish @@ -26,20 +25,20 @@ if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 let b:match_words = - \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|begin\)\>=\@!' . + \ '\<\%(if\|unless\|case\|while\|until\|for\|do\|class\|module\|def\|=\@<!begin\)\>=\@!' . \ ':' . \ '\<\%(else\|elsif\|ensure\|when\|rescue\|break\|redo\|next\|retry\)\>' . \ ':' . - \ '\%(^\|[^.\:@$]\)\@<=\<end\:\@!\>' . + \ '\%(^\|[^.\:@$=]\)\@<=\<end\:\@!\>' . + \ ',^=begin\>:^=end\>,' . \ ',{:},\[:\],(:)' let b:match_skip = \ "synIDattr(synID(line('.'),col('.'),0),'name') =~ '" . - \ "\\<ruby\\%(String\\|StringDelimiter\\|ASCIICode\\|Escape\\|" . - \ "Regexp\\|RegexpDelimiter\\|" . - \ "Interpolation\\|NoInterpolation\\|Comment\\|Documentation\\|" . - \ "ConditionalModifier\\|RepeatModifier\\|OptionalDo\\|" . - \ "Function\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" . + \ "\\<ruby\\%(String\\|.\+Delimiter\\|Character\\|.\+Escape\\|" . + \ "Regexp\\|Interpolation\\|Comment\\|Documentation\\|" . + \ "ConditionalModifier\\|RepeatModifier\\|RescueModifier\\|OptionalDo\\|" . + \ "MethodName\\|BlockArgument\\|KeywordAsMethod\\|ClassVariable\\|" . \ "InstanceVariable\\|GlobalVariable\\|Symbol\\)\\>'" endif @@ -154,7 +153,7 @@ endif function! s:map(mode, flags, map) abort let from = matchstr(a:map, '\S\+') if empty(mapcheck(from, a:mode)) - exe a:mode.'map' '<buffer>' a:map + exe a:mode.'map' '<buffer>' a:flags a:map let b:undo_ftplugin .= '|sil! '.a:mode.'unmap <buffer> '.from endif endfunction @@ -313,13 +312,16 @@ function! s:synid() abort endfunction function! s:wrap_i(back,forward) abort - execute 'norm k'.a:forward + execute 'norm! k' + execute 'norm '.a:forward let line = line('.') execute 'norm '.a:back if line('.') == line - 1 return s:wrap_a(a:back,a:forward) endif - execute 'norm jV'.a:forward.'k' + execute 'norm! jV' + execute 'norm '.a:forward + execute 'norm! k' endfunction function! s:wrap_a(back,forward) abort @@ -332,11 +334,15 @@ function! s:wrap_a(back,forward) abort - endwhile if exists('after') - execute 'norm V'.a:forward.'j' + execute 'norm! V' + execute 'norm '.a:forward + execute 'norm! j' elseif line('.') > 1 && getline(line('.')-1) =~# '^\s*$' - execute 'norm kV'.a:forward + execute 'norm! kV' + execute 'norm '.a:forward else - execute 'norm V'.a:forward + execute 'norm! V' + execute 'norm '.a:forward endif endfunction |