Fix #1, supports count now.
This commit is contained in:
parent
43b418cd55
commit
27f0c14062
@ -2,19 +2,19 @@
|
||||
|
||||
## Installation
|
||||
|
||||
Vimball package will not release until English doc is ready.
|
||||
Now you can clone this repo and use [vim-makefile][] to install.
|
||||
Use [Vundle][] or [pathogen][] is suggested.
|
||||
|
||||
[vim-makefile]:http://github.com/c9s/vim-makefile
|
||||
[Vundle]:https://github.com/gmarik/vundle
|
||||
[pathogen]:https://github.com/tpope/vim-pathogen
|
||||
|
||||
## Usage
|
||||
|
||||
Add the following three lines to your vimrc file.
|
||||
|
||||
nnoremap / :M/
|
||||
nnoremap ? :M?
|
||||
nnoremap <expr> / ":<C-U>".v:count1."M/"
|
||||
nnoremap <expr> ? ":<C-U>".v:count1."M?"
|
||||
nnoremap ,/ /
|
||||
nnoremap ,? ?
|
||||
nnoremap .? ?
|
||||
|
||||
Now you can use / to find. :%S// (uppercase S) to replace.
|
||||
You can use ,/ to use the origin / .
|
||||
@ -25,6 +25,6 @@ Author : 安久津
|
||||
Origin : [eregex.vim][origin]
|
||||
Maintainer : othree
|
||||
|
||||
Might release under MIT License.
|
||||
`:help eregex-license-to-use` for license information.
|
||||
|
||||
[origin]:http://www.vector.co.jp/soft/unix/writing/se265654.html
|
||||
|
@ -209,7 +209,7 @@ let loaded_eregex=1
|
||||
"=============================================================================
|
||||
"Commands And Mappings:
|
||||
command! -nargs=? -range E2v :<line1>,<line2>call <SID>ExtendedRegex2VimRegexLineWise(<q-args>)
|
||||
command! -nargs=? -count M :let v:searchforward = <SID>Ematch(<q-args>)
|
||||
command! -nargs=? -count=0 M :let v:searchforward = <SID>Ematch(<count>, <q-args>)
|
||||
"command! -nargs=? -range S :<line1>,<line2>call <SID>Esubstitute(<q-args>)
|
||||
command! -nargs=? -range S :<line1>,<line2>call <SID>Esubstitute(<q-args>) <Bar> :noh
|
||||
|
||||
@ -675,9 +675,10 @@ endfunction
|
||||
"end E2v()
|
||||
"-----------------------------------------------------------------------------
|
||||
function! s:Ematch(...)
|
||||
if strlen(a:1) <= 1 | return | endif
|
||||
if strlen(a:2) <= 1 | return | endif
|
||||
|
||||
let string = a:1
|
||||
let ccount = a:1
|
||||
let string = a:2
|
||||
let delim=string[0]
|
||||
|
||||
if delim !=# '/' && delim !=# '?'
|
||||
@ -711,8 +712,9 @@ function! s:Ematch(...)
|
||||
let offset = delim
|
||||
endif
|
||||
|
||||
let cmd = 'normal! ' . delim . regex . offset . "\<CR>"
|
||||
let cmd = 'normal! ' . ccount . delim . regex . offset . "\<CR>"
|
||||
let v:errmsg=''
|
||||
set nohlsearch
|
||||
silent! exec cmd
|
||||
if (v:errmsg !~# '^E\d\+:') || (v:errmsg =~# '^E486:')
|
||||
"v130
|
||||
|
Loading…
Reference in New Issue
Block a user