spacevim/bundle/VimRegStyle/plugin/vrs.vim
JIe 2bb7059579
Some checks failed
Detach Plugins / check (FlyGrep.vim) (push) Has been cancelled
Detach Plugins / check (GitHub.vim) (push) Has been cancelled
Detach Plugins / check (JavaUnit.vim) (push) Has been cancelled
Detach Plugins / check (SourceCounter.vim) (push) Has been cancelled
Detach Plugins / check (cpicker.nvim) (push) Has been cancelled
Detach Plugins / check (dein-ui.vim) (push) Has been cancelled
Detach Plugins / check (git.vim) (push) Has been cancelled
Detach Plugins / check (iedit.vim) (push) Has been cancelled
Detach Plugins / check (scrollbar.vim) (push) Has been cancelled
Detach Plugins / check (vim-chat) (push) Has been cancelled
Detach Plugins / check (vim-cheat) (push) Has been cancelled
Detach Plugins / check (vim-todo) (push) Has been cancelled
Detach Plugins / check (xmake.vim) (push) Has been cancelled
test / Linux (nvim, nightly) (push) Has been cancelled
test / Linux (nvim, v0.3.8) (push) Has been cancelled
test / Linux (nvim, v0.4.0) (push) Has been cancelled
test / Linux (nvim, v0.4.2) (push) Has been cancelled
test / Linux (nvim, v0.4.3) (push) Has been cancelled
test / Linux (nvim, v0.4.4) (push) Has been cancelled
test / Linux (nvim, v0.5.0) (push) Has been cancelled
test / Linux (nvim, v0.5.1) (push) Has been cancelled
test / Linux (nvim, v0.6.0) (push) Has been cancelled
test / Linux (nvim, v0.6.1) (push) Has been cancelled
test / Linux (nvim, v0.7.0) (push) Has been cancelled
test / Linux (nvim, v0.7.2) (push) Has been cancelled
test / Linux (nvim, v0.8.0) (push) Has been cancelled
test / Linux (nvim, v0.8.1) (push) Has been cancelled
test / Linux (nvim, v0.8.2) (push) Has been cancelled
test / Linux (nvim, v0.8.3) (push) Has been cancelled
test / Linux (nvim, v0.9.0) (push) Has been cancelled
test / Linux (nvim, v0.9.1) (push) Has been cancelled
test / Linux (true, vim, v7.4.052) (push) Has been cancelled
test / Linux (true, vim, v7.4.1689) (push) Has been cancelled
test / Linux (true, vim, v7.4.629) (push) Has been cancelled
test / Linux (true, vim, v8.0.0027) (push) Has been cancelled
test / Linux (true, vim, v8.0.0183) (push) Has been cancelled
test / Linux (vim, nightly) (push) Has been cancelled
test / Linux (vim, v8.0.0184) (push) Has been cancelled
test / Linux (vim, v8.0.1453) (push) Has been cancelled
test / Linux (vim, v8.1.2269) (push) Has been cancelled
test / Linux (vim, v8.2.2434) (push) Has been cancelled
test / Linux (vim, v8.2.3995) (push) Has been cancelled
test / Windows (nvim, nightly) (push) Has been cancelled
test / Windows (nvim, v0.3.8) (push) Has been cancelled
test / Windows (nvim, v0.4.2) (push) Has been cancelled
test / Windows (nvim, v0.4.3) (push) Has been cancelled
test / Windows (nvim, v0.4.4) (push) Has been cancelled
test / Windows (nvim, v0.5.0) (push) Has been cancelled
test / Windows (nvim, v0.5.1) (push) Has been cancelled
test / Windows (nvim, v0.6.0) (push) Has been cancelled
test / Windows (nvim, v0.6.1) (push) Has been cancelled
test / Windows (nvim, v0.7.0) (push) Has been cancelled
test / Windows (nvim, v0.7.2) (push) Has been cancelled
test / Windows (nvim, v0.8.0) (push) Has been cancelled
test / Windows (nvim, v0.8.1) (push) Has been cancelled
test / Windows (nvim, v0.8.2) (push) Has been cancelled
test / Windows (nvim, v0.8.3) (push) Has been cancelled
test / Windows (nvim, v0.9.0) (push) Has been cancelled
test / Windows (nvim, v0.9.1) (push) Has been cancelled
test / Windows (vim, nightly) (push) Has been cancelled
test / Windows (vim, v7.4.1185) (push) Has been cancelled
test / Windows (vim, v7.4.1689) (push) Has been cancelled
test / Windows (vim, v8.0.0027) (push) Has been cancelled
test / Windows (vim, v8.0.1453) (push) Has been cancelled
test / Windows (vim, v8.1.2269) (push) Has been cancelled
test / Windows (vim, v8.2.2434) (push) Has been cancelled
test / Windows (vim, v8.2.3995) (push) Has been cancelled
docker / docker (push) Has been cancelled
mirror / check (coding) (push) Has been cancelled
mirror / check (gitee) (push) Has been cancelled
mirror / check (gitlab) (push) Has been cancelled
init
2024-08-21 14:17:26 +08:00

136 lines
3.4 KiB
VimL

" Vim global plugin for short description
" Maintainer: Barry Arthur <barry.arthur@gmail.com>
" Israel Chauca F. <israelchauca@gmail.com>
" Version: 0.1
" Description: Long description.
" Last Change: 2013-02-03
" License: Vim License (see :help license)
" Location: plugin/vrs.vim
" Website: https://github.com/Raimondi/vrs
"
" See vrs.txt for help. This can be accessed by doing:
"
" :helptags ~/.vim/doc
" :help vrs
" Vimscript Setup: {{{1
" Allow use of line continuation.
let s:save_cpo = &cpo
set cpo&vim
" load guard
" uncomment after plugin development.
" XXX The conditions are only as examples of how to use them. Change them as
" needed. XXX
"if exists("g:loaded_vrs")
" \ || v:version < 700
" \ || v:version == 703 && !has('patch338')
" \ || &compatible
" let &cpo = s:save_cpo
" finish
"endif
"let g:loaded_vrs = 1
" Options: {{{1
" Private Functions: {{{1
function! s:ex(key, ...) "{{{1
let pattern = vrs#get(a:key)
if empty(pattern)
return ''
endif
let dest = a:0 ? a:1 : '@/'
return 'let ' . dest . ' = ' . string(pattern)
endfunction
function! s:get_re(...)
let re = vrs#get(input('Pattern name: ', '',
\ 'customlist,'.s:SID().'get_names'))
if empty(re)
return ''
endif
if !a:0 || a:1 == 0
return re
elseif a:1 == 1
return string(re)
else
return '"' . escape(re, '"\') . '"'
endif
endfunction
function! s:get_names(a, c, p)
return vrs#from_partial(a:a)
endfunction
function! s:SID()
return matchstr(expand('<sfile>'), '<SNR>\d\+_\zeSID$')
endfun
" Public Interface: {{{1
function! ExtendedRegexObject(...)
return call('extended_regex#ExtendedRegex', a:000)
endfunction
" Commands: {{{1
" first arg is the name of the pattern, second is the destination of the
" pattern found (defaults to @/.
" TODO add completion support.
command! -nargs=+ VRS exec s:ex(<f-args>)
" Maps: {{{1
inoremap <Plug>VRSPlain <C-R>=<SID>get_re(0)<CR>
inoremap <Plug>VRSSingle <C-R>=<SID>get_re(1)<CR>
inoremap <Plug>VRSDouble <C-R>=<SID>get_re(2)<CR>
cnoremap <Plug>VRSPlain <C-R>=<SID>get_re(0)<CR>
cnoremap <Plug>VRSSingle <C-R>=<SID>get_re(1)<CR>
cnoremap <Plug>VRSDouble <C-R>=<SID>get_re(2)<CR>
nnoremap <Plug>VRSPlain "=<SID>get_re(0)<CR>p
nnoremap <Plug>VRSSingle "=<SID>get_re(1)<CR>p
nnoremap <Plug>VRSDouble "=<SID>get_re(2)<CR>p
nnoremap <Plug>VRS/ /<C-R>=<SID>get_re()<CR>
nnoremap <Plug>VRS? ?<C-R>=<SID>get_re()<CR>
if !hasmapto('<Plug>VRSPlain', 'i')
imap <unique> <C-B>rep <Plug>VRSPlain
endif
if !hasmapto('<Plug>VRSSingle', 'i')
imap <unique> <C-B>re' <Plug>VRSSingle
endif
if !hasmapto('<Plug>VRSDouble', 'i')
imap <unique> <C-B>re" <Plug>VRSDouble
endif
if !hasmapto('<Plug>VRSPlain', 'c')
cmap <unique> <C-G>rep <Plug>VRSPlain
endif
if !hasmapto('<Plug>VRSSingle', 'c')
cmap <unique> <C-G>re' <Plug>VRSSingle
endif
if !hasmapto('<Plug>VRSDouble', 'c')
cmap <unique> <C-G>re" <Plug>VRSDouble
endif
if !hasmapto('<Plug>VRSPlain', 'n')
nmap <unique> <Leader>rep <Plug>VRSPlain
endif
if !hasmapto('<Plug>VRSSingle', 'n')
nmap <unique> <Leader>re' <Plug>VRSSingle
endif
if !hasmapto('<Plug>VRSDouble', 'n')
nmap <unique> <Leader>re" <Plug>VRSDouble
endif
if !hasmapto('<Plug>VRS/', 'n')
nmap <unique> <Leader>re/ <Plug>VRS/
endif
if !hasmapto('<Plug>VRS?', 'n')
nmap <unique> <Leader>re? <Plug>VRS?
endif
" Teardown:{{{1
"reset &cpo back to users setting
let &cpo = s:save_cpo
" vim: set sw=2 sts=2 et fdm=marker: