aboutsummaryrefslogtreecommitdiff
path: root/runtime/ftplugin
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-01 16:43:14 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-01 16:43:14 +0200
commit87140f234ac1f152f6f273dee5ab1e42c7b1d78b (patch)
tree2e8e1b980a4fe1786db5e35a2a44c77b0d2ecce8 /runtime/ftplugin
parent1f6c9fd82202c14021d0e6aa3f5e4ad89877d2f8 (diff)
parent5342342426777160300a431ef8c9200fb151f793 (diff)
downloadrneovim-87140f234ac1f152f6f273dee5ab1e42c7b1d78b.tar.gz
rneovim-87140f234ac1f152f6f273dee5ab1e42c7b1d78b.tar.bz2
rneovim-87140f234ac1f152f6f273dee5ab1e42c7b1d78b.zip
Merge #10646 'vim-patch: runtime patches'
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r--runtime/ftplugin/bash.vim31
-rw-r--r--runtime/ftplugin/cfg.vim19
-rw-r--r--runtime/ftplugin/dune.vim20
-rw-r--r--runtime/ftplugin/eruby.vim34
-rw-r--r--runtime/ftplugin/help.vim2
-rw-r--r--runtime/ftplugin/logcheck.vim10
-rw-r--r--runtime/ftplugin/mma.vim16
-rw-r--r--runtime/ftplugin/ocaml.vim48
-rw-r--r--runtime/ftplugin/rst.vim7
-rw-r--r--runtime/ftplugin/ruby.vim100
-rw-r--r--runtime/ftplugin/text.vim7
-rw-r--r--runtime/ftplugin/xml.vim8
12 files changed, 226 insertions, 76 deletions
diff --git a/runtime/ftplugin/bash.vim b/runtime/ftplugin/bash.vim
new file mode 100644
index 0000000000..a3d01fc2ad
--- /dev/null
+++ b/runtime/ftplugin/bash.vim
@@ -0,0 +1,31 @@
+" Vim filetype plugin file
+" Language: bash
+" Maintainer: Bram Moolenaar
+" Last Changed: 2019 Jan 12
+"
+" This is not a real filetype plugin. It allows for someone to set 'filetype'
+" to "bash" in the modeline, and gets the effect of filetype "sh" with
+" b:is_bash set. Idea from Mahmode Al-Qudsi.
+
+if exists("b:did_ftplugin")
+ finish
+endif
+
+let b:is_bash = 1
+if exists("b:is_sh")
+ unlet b:is_sh
+endif
+if exists("b:is_kornshell")
+ unlet b:is_kornshell
+endif
+
+" Setting 'filetype' here directly won't work, since we are being invoked
+" through an autocommand. Do it later, on the BufWinEnter event.
+augroup bash_filetype
+ au BufWinEnter * call SetBashFt()
+augroup END
+
+func SetBashFt()
+ au! bash_filetype
+ set ft=sh
+endfunc
diff --git a/runtime/ftplugin/cfg.vim b/runtime/ftplugin/cfg.vim
new file mode 100644
index 0000000000..b5835ba7a9
--- /dev/null
+++ b/runtime/ftplugin/cfg.vim
@@ -0,0 +1,19 @@
+" Vim filetype plugin file
+" Language: Configuration File
+" Maintainer: Christian Brabandt <cb@256bit.org>
+" Latest Revision: 2018-12-24
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let b:undo_ftplugin = "setl cms< fo<"
+
+setlocal commentstring=#\ %s formatoptions-=t formatoptions+=croql
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
diff --git a/runtime/ftplugin/dune.vim b/runtime/ftplugin/dune.vim
new file mode 100644
index 0000000000..8b1f8b4125
--- /dev/null
+++ b/runtime/ftplugin/dune.vim
@@ -0,0 +1,20 @@
+" Language: Dune buildsystem
+" Maintainer: Markus Mottl <markus.mottl@gmail.com>
+" Anton Kochkov <anton.kochkov@gmail.com>
+" URL: https://github.com/rgrinberg/vim-ocaml
+" Last Change:
+" 2018 Nov 3 - Added commentstring (Markus Mottl)
+" 2017 Sep 6 - Initial version (Etienne Millon)
+
+if exists("b:did_ftplugin")
+ finish
+endif
+let b:did_ftplugin=1
+
+set lisp
+
+" Comment string
+setl commentstring=;\ %s
+setl comments=:;
+
+setl iskeyword+=#,?,.,/
diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim
index 32f3fb868f..3c18bada78 100644
--- a/runtime/ftplugin/eruby.vim
+++ b/runtime/ftplugin/eruby.vim
@@ -3,6 +3,7 @@
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
" URL: https://github.com/vim-ruby/vim-ruby
" Release Coordinator: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2019 Jan 06
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -27,7 +28,7 @@ elseif !exists("b:eruby_subtype")
let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$")
let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+')
if b:eruby_subtype == ''
- let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
+ let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$')
endif
if b:eruby_subtype == 'rhtml'
let b:eruby_subtype = 'html'
@@ -45,7 +46,7 @@ elseif !exists("b:eruby_subtype")
endif
endif
-if exists("b:eruby_subtype") && b:eruby_subtype != ''
+if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby'
exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim"
else
runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim
@@ -66,6 +67,21 @@ if exists("b:match_words")
unlet b:match_words
endif
+let s:cfilemap = v:version >= 704 ? maparg('<Plug><cfile>', 'c', 0, 1) : {}
+if !get(s:cfilemap, 'buffer') || !s:cfilemap.expr || s:cfilemap.rhs =~# 'ErubyAtCursor()'
+ let s:cfilemap = {}
+endif
+if !has_key(s:cfilemap, 'rhs')
+ let s:cfilemap.rhs = "substitute(&l:inex =~# '\\<v:fname\\>' && len(expand('<cfile>')) ? eval(substitute(&l:inex, '\\<v:fname\\>', '\\=string(expand(\"<cfile>\"))', 'g')) : '', '^$', \"\\022\\006\",'')"
+endif
+let s:ctagmap = v:version >= 704 ? maparg('<Plug><ctag>', 'c', 0, 1) : {}
+if !get(s:ctagmap, 'buffer') || !s:ctagmap.expr || s:ctagmap.rhs =~# 'ErubyAtCursor()'
+ let s:ctagmap = {}
+endif
+let s:include = &l:include
+let s:path = &l:path
+let s:suffixesadd = &l:suffixesadd
+
runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim
let b:did_ftplugin = 1
@@ -80,6 +96,15 @@ if exists("b:match_words")
let s:match_words = b:match_words . ',' . s:match_words
endif
+if len(s:include)
+ let &l:include = s:include
+endif
+let &l:path = s:path . (s:path =~# ',$\|^$' ? '' : ',') . &l:path
+let &l:suffixesadd = s:suffixesadd . (s:suffixesadd =~# ',$\|^$' ? '' : ',') . &l:suffixesadd
+exe 'cmap <buffer><script><expr> <Plug><cfile> ErubyAtCursor() ? ' . maparg('<Plug><cfile>', 'c') . ' : ' . s:cfilemap.rhs
+exe 'cmap <buffer><script><expr> <Plug><ctag> ErubyAtCursor() ? ' . maparg('<Plug><ctag>', 'c') . ' : ' . get(s:ctagmap, 'rhs', '"\022\027"')
+unlet s:cfilemap s:ctagmap s:include s:path s:suffixesadd
+
" Change the browse dialog on Win32 to show mainly eRuby-related files
if has("gui_win32")
let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter
@@ -99,4 +124,9 @@ let b:undo_ftplugin = "setl cms< "
let &cpo = s:save_cpo
unlet s:save_cpo
+function! ErubyAtCursor() abort
+ let groups = map(['erubyBlock', 'erubyComment', 'erubyExpression', 'erubyOneLiner'], 'hlID(v:val)')
+ return !empty(filter(synstack(line('.'), col('.')), 'index(groups, v:val) >= 0'))
+endfunction
+
" vim: nowrap sw=2 sts=2 ts=8:
diff --git a/runtime/ftplugin/help.vim b/runtime/ftplugin/help.vim
index 0f448bd306..a6a6652b2f 100644
--- a/runtime/ftplugin/help.vim
+++ b/runtime/ftplugin/help.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin file
" Language: Vim help file
" Previous Maintainer: Nikolai Weibull <now@bitwi.se>
-" Latest Revision: 2008-07-09
+" Latest Revision: 2018-12-29
if exists("b:did_ftplugin")
finish
diff --git a/runtime/ftplugin/logcheck.vim b/runtime/ftplugin/logcheck.vim
index 7d4671d875..9d664b2d09 100644
--- a/runtime/ftplugin/logcheck.vim
+++ b/runtime/ftplugin/logcheck.vim
@@ -1,16 +1,16 @@
" Vim filetype plugin file
" Language: Logcheck
-" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
-" Last Change: 2012 Jan 15
+" Maintainer: Debian Vim Maintainers
+" Last Change: 2018 Dec 27
" License: Vim License
-" URL: http://hg.debian.org/hg/pkg-vim/vim/file/unstable/runtime/ftplugin/logcheck.vim
+" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/logcheck.vim
-if exists("b:did_ftplugin")
+if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1
-let b:undo_ftplugin = "setl fo<"
+let b:undo_ftplugin = 'setl fo<'
" Do not hard-wrap non-comment lines since each line is a self-contained
" regular expression
diff --git a/runtime/ftplugin/mma.vim b/runtime/ftplugin/mma.vim
new file mode 100644
index 0000000000..ce4cee18ae
--- /dev/null
+++ b/runtime/ftplugin/mma.vim
@@ -0,0 +1,16 @@
+" Vim filetype plugin file
+" Language: Mathematica
+" Maintainer: Ian Ford <ianf@wolfram.com>
+" Last Change: 22 January 2019
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+ finish
+endif
+
+" Don't load another plugin for this buffer
+let b:did_ftplugin = 1
+
+let b:undo_ftplugin = "setlocal commentstring<"
+
+setlocal commentstring=\(*%s*\)
diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim
index 3ee7849063..e0d7efe997 100644
--- a/runtime/ftplugin/ocaml.vim
+++ b/runtime/ftplugin/ocaml.vim
@@ -5,12 +5,12 @@
" Pierre Vittet <pierre-vittet@pvittet.com>
" Stefano Zacchiroli <zack@bononia.it>
" Vincent Aravantinos <firstname.name@imag.fr>
-" URL: http://www.ocaml.info/vim/ftplugin/ocaml.vim
+" URL: https://github.com/rgrinberg/vim-ocaml
" Last Change:
+" 2013 Oct 27 - Added commentstring (MM)
" 2013 Jul 26 - load default compiler settings (MM)
" 2013 Jul 24 - removed superfluous efm-setting (MM)
" 2013 Jul 22 - applied fixes supplied by Hirotaka Hamada (MM)
-" 2013 Mar 15 - Improved error format (MM)
if exists("b:did_ftplugin")
finish
@@ -37,6 +37,10 @@ endif
let s:cposet=&cpoptions
set cpo&vim
+" Comment string
+setlocal comments=
+setlocal commentstring=(*%s*)
+
" Add mappings, unless the user didn't want this.
if !exists("no_plugin_maps") && !exists("no_ocaml_maps")
" (un)commenting
@@ -60,16 +64,39 @@ if !exists("no_plugin_maps") && !exists("no_ocaml_maps")
endif
" Let % jump between structure elements (due to Issac Trotts)
-let b:mw = ''
-let b:mw = b:mw . ',\<let\>:\<and\>:\(\<in\>\|;;\)'
+let b:mw = '\<let\>:\<and\>:\(\<in\>\|;;\)'
let b:mw = b:mw . ',\<if\>:\<then\>:\<else\>'
-let b:mw = b:mw . ',\<\(for\|while\)\>:\<do\>:\<done\>,'
+let b:mw = b:mw . ',\<\(for\|while\)\>:\<do\>:\<done\>'
let b:mw = b:mw . ',\<\(object\|sig\|struct\|begin\)\>:\<end\>'
let b:mw = b:mw . ',\<\(match\|try\)\>:\<with\>'
let b:match_words = b:mw
let b:match_ignorecase=0
+function! s:OcpGrep(bang,args) abort
+ let grepprg = &l:grepprg
+ let grepformat = &l:grepformat
+ let shellpipe = &shellpipe
+ try
+ let &l:grepprg = "ocp-grep -c never"
+ setlocal grepformat=%f:%l:%m
+ if &shellpipe ==# '2>&1| tee' || &shellpipe ==# '|& tee'
+ let &shellpipe = "| tee"
+ endif
+ execute 'grep! '.a:args
+ if empty(a:bang) && !empty(getqflist())
+ return 'cfirst'
+ else
+ return ''
+ endif
+ finally
+ let &l:grepprg = grepprg
+ let &l:grepformat = grepformat
+ let &shellpipe = shellpipe
+ endtry
+endfunction
+command! -bar -bang -complete=file -nargs=+ Ocpgrep exe s:OcpGrep(<q-bang>, <q-args>)
+
" switching between interfaces (.mli) and implementations (.ml)
if !exists("g:did_ocaml_switch")
let g:did_ocaml_switch = 1
@@ -97,15 +124,8 @@ endif
" Folding support
" Get the modeline because folding depends on indentation
-let s:s = line2byte(line('.'))+col('.')-1
-if search('^\s*(\*:o\?caml:')
- let s:modeline = getline(".")
-else
- let s:modeline = ""
-endif
-if s:s > 0
- exe 'goto' s:s
-endif
+let lnum = search('^\s*(\*:o\?caml:', 'n')
+let s:modeline = lnum? getline(lnum): ""
" Get the indentation params
let s:m = matchstr(s:modeline,'default\s*=\s*\d\+')
diff --git a/runtime/ftplugin/rst.vim b/runtime/ftplugin/rst.vim
index 9d737cde44..8ab56b052a 100644
--- a/runtime/ftplugin/rst.vim
+++ b/runtime/ftplugin/rst.vim
@@ -3,7 +3,7 @@
" Maintainer: Marshall Ward <marshall.ward@gmail.com>
" Original Maintainer: Nikolai Weibull <now@bitwi.se>
" Website: https://github.com/marshallward/vim-restructuredtext
-" Latest Revision: 2018-01-07
+" Latest Revision: 2018-12-29
if exists("b:did_ftplugin")
finish
@@ -13,6 +13,11 @@ let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
+"Disable folding
+if !exists('g:rst_fold_enabled')
+ let g:rst_fold_enabled = 0
+endif
+
let b:undo_ftplugin = "setl com< cms< et< fo<"
setlocal comments=fb:.. commentstring=..\ %s expandtab
diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim
index 84fb9930a4..054c35e5fa 100644
--- a/runtime/ftplugin/ruby.vim
+++ b/runtime/ftplugin/ruby.vim
@@ -2,8 +2,8 @@
" 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>
+" Last Change: 2019 Jan 06
if (exists("b:did_ftplugin"))
finish
@@ -44,19 +44,12 @@ endif
setlocal formatoptions-=t formatoptions+=croql
setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\)
-setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'\%(\.rb\)\=$','.rb','')
setlocal suffixesadd=.rb
if exists("&ofu") && has("ruby")
setlocal omnifunc=rubycomplete#Complete
endif
-" To activate, :set ballooneval
-if has('balloon_eval') && exists('+balloonexpr')
- setlocal balloonexpr=RubyBalloonexpr()
-endif
-
-
" TODO:
"setlocal define=^\\s*def
@@ -69,7 +62,7 @@ endif
function! s:query_path(root) abort
let code = "print $:.join %q{,}"
- if &shell =~# 'sh'
+ if &shell =~# 'sh' && empty(&shellxquote)
let prefix = 'env PATH='.shellescape($PATH).' '
else
let prefix = ''
@@ -141,44 +134,54 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
\ "All Files (*.*)\t*.*\n"
endif
-let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< tags< kp<"
+let b:undo_ftplugin = "setl inc= sua= path= tags= fo< com< cms< kp="
\."| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip"
\."| if exists('&ofu') && has('ruby') | setl ofu< | endif"
- \."| if has('balloon_eval') && exists('+bexpr') | setl bexpr< | endif"
+
+if get(g:, 'ruby_recommended_style', 1)
+ setlocal shiftwidth=2 softtabstop=2 expandtab
+ let b:undo_ftplugin .= ' | setl sw< sts< et<'
+endif
+
+" To activate, :set ballooneval
+if exists('+balloonexpr') && get(g:, 'ruby_balloonexpr')
+ setlocal balloonexpr=RubyBalloonexpr()
+ let b:undo_ftplugin .= "| setl bexpr="
+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:0 ? a:1 : '') a:map
+ exe a:mode.'map' '<buffer>' a:map
let b:undo_ftplugin .= '|sil! '.a:mode.'unmap <buffer> '.from
endif
endfunction
-cmap <buffer><script><expr> <Plug><cword> substitute(RubyCursorIdentifier(),'^$',"\022\027",'')
+cmap <buffer><script><expr> <Plug><ctag> substitute(RubyCursorTag(),'^$',"\022\027",'')
cmap <buffer><script><expr> <Plug><cfile> substitute(RubyCursorFile(),'^$',"\022\006",'')
-let b:undo_ftplugin .= "| sil! cunmap <buffer> <Plug><cword>| sil! cunmap <buffer> <Plug><cfile>"
+let b:undo_ftplugin .= "| sil! cunmap <buffer> <Plug><ctag>| sil! cunmap <buffer> <Plug><cfile>"
if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
nmap <buffer><script> <SID>: :<C-U>
nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR>
- nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','n')<CR>
- nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','n')<CR>
- nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','n')<CR>
- nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','n')<CR>
- xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','v')<CR>
- xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','v')<CR>
- xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','v')<CR>
- xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','v')<CR>
-
- nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','n')<CR>
- nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','n')<CR>
- nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','n')<CR>
- nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','n')<CR>
- xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','v')<CR>
- xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','v')<CR>
- xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','v')<CR>
- xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','v')<CR>
+ nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','n')<CR>
+ nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','n')<CR>
+ nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','n')<CR>
+ nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','n')<CR>
+ xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','v')<CR>
+ xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','v')<CR>
+ xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','v')<CR>
+ xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','v')<CR>
+
+ nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','n')<CR>
+ nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','n')<CR>
+ nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','n')<CR>
+ nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','n')<CR>
+ xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','v')<CR>
+ xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','v')<CR>
+ xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','v')<CR>
+ xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','v')<CR>
let b:undo_ftplugin = b:undo_ftplugin
\."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['"
@@ -204,19 +207,18 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps")
\."| sil! exe 'xunmap <buffer> iM' | sil! exe 'xunmap <buffer> aM'"
endif
- call s:map('c', '', '<C-R><C-W> <Plug><cword>')
call s:map('c', '', '<C-R><C-F> <Plug><cfile>')
cmap <buffer><script><expr> <SID>tagzv &foldopen =~# 'tag' ? '<Bar>norm! zv' : ''
- call s:map('n', '<silent>', '<C-]> <SID>:exe v:count1."tag <Plug><cword>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', 'g<C-]> <SID>:exe "tjump <Plug><cword>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', 'g] <SID>:exe "tselect <Plug><cword>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W>] <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W><C-]> <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:exe "stjump <Plug><cword>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W>g] <SID>:exe "stselect <Plug><cword>"<SID>tagzv<CR>')
- call s:map('n', '<silent>', '<C-W>} <SID>:exe v:count1."ptag <Plug><cword>"<CR>')
- call s:map('n', '<silent>', '<C-W>g} <SID>:exe "ptjump <Plug><cword>"<CR>')
+ call s:map('n', '<silent>', '<C-]> <SID>:exe v:count1."tag <Plug><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<silent>', 'g<C-]> <SID>:exe "tjump <Plug><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<silent>', 'g] <SID>:exe "tselect <Plug><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<silent>', '<C-W>] <SID>:exe v:count1."stag <Plug><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<silent>', '<C-W><C-]> <SID>:exe v:count1."stag <Plug><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:exe "stjump <Plug><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<silent>', '<C-W>g] <SID>:exe "stselect <Plug><ctag>"<SID>tagzv<CR>')
+ call s:map('n', '<silent>', '<C-W>} <SID>:exe v:count1."ptag <Plug><ctag>"<CR>')
+ call s:map('n', '<silent>', '<C-W>g} <SID>:exe "ptjump <Plug><ctag>"<CR>')
call s:map('n', '<silent>', 'gf <SID>c:find <Plug><cfile><CR>')
call s:map('n', '<silent>', '<C-W>f <SID>c:sfind <Plug><cfile><CR>')
@@ -288,12 +290,13 @@ function! s:searchsyn(pattern, syn, flags, mode) abort
norm! gv
endif
let i = 0
+ call map(a:syn, 'hlID(v:val)')
while i < cnt
let i = i + 1
let line = line('.')
let col = col('.')
let pos = search(a:pattern,'W'.a:flags)
- while pos != 0 && s:synname() !~# a:syn
+ while pos != 0 && index(a:syn, s:synid()) < 0
let pos = search(a:pattern,'W'.a:flags)
endwhile
if pos == 0
@@ -303,8 +306,8 @@ function! s:searchsyn(pattern, syn, flags, mode) abort
endwhile
endfunction
-function! s:synname() abort
- return synIDattr(synID(line('.'),col('.'),0),'name')
+function! s:synid() abort
+ return synID(line('.'),col('.'),0)
endfunction
function! s:wrap_i(back,forward) abort
@@ -349,6 +352,10 @@ function! RubyCursorIdentifier() abort
return stripped == '' ? expand("<cword>") : stripped
endfunction
+function! RubyCursorTag() abort
+ return substitute(RubyCursorIdentifier(), '^[$@]*', '', '')
+endfunction
+
function! RubyCursorFile() abort
let isfname = &isfname
try
@@ -360,8 +367,9 @@ function! RubyCursorFile() abort
let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!')
let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*')
let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : ''
- if s:synname() ==# 'rubyConstant'
+ if s:synid() ==# hlID('rubyConstant')
let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','')
+ let cfile = substitute(cfile,'^::','','')
let cfile = substitute(cfile,'::','/','g')
let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g')
let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g')
diff --git a/runtime/ftplugin/text.vim b/runtime/ftplugin/text.vim
index ec84ac6f79..c4cbcb54c3 100644
--- a/runtime/ftplugin/text.vim
+++ b/runtime/ftplugin/text.vim
@@ -1,7 +1,7 @@
" Vim filetype plugin
" Language: Text
" Maintainer: David Barnett <daviebdawg+vim@gmail.com>
-" Last Change: 2014 Jul 09
+" Last Change: 2019 Jan 10
if exists('b:did_ftplugin')
finish
@@ -12,6 +12,7 @@ let b:undo_ftplugin = 'setlocal comments< commentstring<'
" We intentionally don't set formatoptions-=t since text should wrap as text.
-" Pseudo comment leaders to indent bulleted lists.
-setlocal comments=fb:-,fb:*
+" Pseudo comment leaders to indent bulleted lists with '-' and '*'. And allow
+" for Mail quoted text with '>'.
+setlocal comments=fb:-,fb:*,n:>
setlocal commentstring=
diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim
index 573a6ba441..1d43521155 100644
--- a/runtime/ftplugin/xml.vim
+++ b/runtime/ftplugin/xml.vim
@@ -1,8 +1,8 @@
" Vim filetype plugin file
-" Language: xml
-" Maintainer: Christian Brabandt <cb@256bit.org>
-" Last Changed: May 08th, 2018
-" Repository: https://github.com/chrisbra/vim-xml-ftplugin
+" Language: xml
+" Maintainer: Christian Brabandt <cb@256bit.org>
+" Last Changed: Dec 07th, 2018
+" Repository: https://github.com/chrisbra/vim-xml-ftplugin
" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin