sponsor Vim development Vim logo Vim Book Ad

:REPL : Prompt-driven replace(substitute) for console vim, also in multiple files.

 script karma  Rating -4/6, Downloaded by 507    Comments, bugs, improvements  Vim wiki

created by
Yakov Lerner
 
script type
utility
 
description
" This script defines command REPL which is prompt-driven. REPL
" command does not take arguments. It prompts for:
" 1) string to replace. You can use * here for current word under cursor,
"    / for current search pattern. Simply Enter means current search pattern, too.
" 2) string to repalce to. Empty string means empty string here.
" 3) Substitution flags:
"     (i) ignorecase (m) matchCase
"     (w) as word    (c) confirm    (f) in files
"    Default flags are 'mw' - match-case and whole-word substitution.
"
" If you include f in flags, you are additionally prompted for
" file patterns (space-separated). Examples: (1) *.c *.h (2)  **.[ch]
" '**' in file patterns means recursive file matching.
"
" Press Ctrl-C at any prompt to abort the script.
"
" That's all.
" Send bugs and wishes to: iler.ml@gmail.com
"
" Todo & wishes:
" - print "No substitutions" when there were no substitutions. Currently,
"   nothing is printed where nothing was substituted.
"
" Example dialog:
"  :REPL
"  Replace what > foo
"  Replace to   > bar
"   (i) ignorecase (m) matchCase
"   (w) as word    (c) confirm    (f) in files [mw]
 
install details
Short instructions: drop script into your personal plugin
directory (~/.vim/plugin)

Detailed version:

1. Download script  repl.vim  from the link below.
2. Create directory ~/.vim/plugin if it does not exist:
                 mkdir -p ~/.vim/plugin
   (your personal plugin directory).
3. Copy script  repl.vim  into ~/.vim/plugin directory.
4. Restart vim
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
repl.vim 070521c 2007-05-21 6.0 Yakov Lerner Added optional autowrite in multi-file-replace. Checksum 1752632450
ip used for rating: 54.196.159.11

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
SourceForge.net Logo