From 27f0c14062b80db67af2ac5fad63321ebd1b8259 Mon Sep 17 00:00:00 2001 From: othree_kao Date: Thu, 21 Feb 2013 14:51:27 +0800 Subject: [PATCH] Fix #1, supports count now. --- README.markdown | 14 +++++++------- plugin/eregex.vim | 10 ++++++---- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.markdown b/README.markdown index 8278955..fe4ab4f 100644 --- a/README.markdown +++ b/README.markdown @@ -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 / ":".v:count1."M/" + nnoremap ? ":".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 diff --git a/plugin/eregex.vim b/plugin/eregex.vim index 969a229..45d8878 100644 --- a/plugin/eregex.vim +++ b/plugin/eregex.vim @@ -209,7 +209,7 @@ let loaded_eregex=1 "============================================================================= "Commands And Mappings: command! -nargs=? -range E2v :,call ExtendedRegex2VimRegexLineWise() -command! -nargs=? -count M :let v:searchforward = Ematch() +command! -nargs=? -count=0 M :let v:searchforward = Ematch(, ) "command! -nargs=? -range S :,call Esubstitute() command! -nargs=? -range S :,call Esubstitute() :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 . "\" + let cmd = 'normal! ' . ccount . delim . regex . offset . "\" let v:errmsg='' + set nohlsearch silent! exec cmd if (v:errmsg !~# '^E\d\+:') || (v:errmsg =~# '^E486:') "v130