sponsor Vim development Vim logo Vim Book Ad

buffers_search_and_replace : Simple but powerful buffer(s) search & replace tool

 script karma  Rating 32/11, Downloaded by 2660  Comments, bugs, improvements  Vim wiki

created by
Alexandru Ionut Munteanu
 
script type
utility
 
description
    The "Buffers Search & Replace" plugin is a simple but powerful buffer(s)
search & replace tool. Search results can be set in the 'delete' category and replacement
can be performed on the remaining or deleted search results.

Please report any bugs or feature requests.

Available commands :
------------------------------
    :Bs <search_regex>
    :<range> Bsc <search_regex>

The 'Bs' command is searching in all the buffers and 'Bsc' only in the current buffer.

    :Bsf <buffer_name_filter_regex> <search_regex>
    :Bse <buffer_name_exclusion_regex> <search_regex>

The 'Bsf' command is searching in all the buffers whose name match <buffer_name_filter_regex> and
'Bse' in all buffers whose name doesn't match <buffer_name_exclusion_regex>.

Default key mappings in the buffer with the results :
---------------------------------------------------------------------
  "Space"  : moves the cursor on the first result of the next buffer
  "Enter or Control-j"   : shows or jumps to the result under the cursor
  "J"  : enables or disables jumping on the buffer when pressing Enter or Control-j
  "A"  : enables or disables auto-showing the context of the results when pressing j or k
  "d" : deletes the current range search result (default: current line)
           (the deleted search results are showed at the bottom of the buffer)
  "D" : definitely deletes the current range search result (default: current line)
  "Q"  : enables or disables auto-quitting the buffer results when jumping
  "O"  : toggles between showing options or showing results
  "r"  : replace action on the non-deleted searched results
  "R"  : replace action on the deleted searched results
  "u"  : replaces this search with a newer one (with the same keyword)
  "i"  : enables or disables the search match highlighting on the buffer with the results
  "I"  : enables or disables the search match highlighting on the other buffers (not the buffer with the results)
  "x"  : enables or disables quite-full-screen
  "q"  : deletes the buffer with the results
  "?"  : toggles between showing help or showing results

Screenshot : http://ioalex.net/buffers_search_and_replace/screenshot.png
Small demo video (ogg theora) : http://ioalex.net/buffers_search_and_replace/demo.ogv

For more information, contact me or read the more complete documentation at the start of the plugin file.
 
install details
    Installation :

Download the file "buffers_search.vim" and put it into the plugins
directory; on a unix-like system, the user plugin directory could be
"~/.vim/plugin".

    Optional configuration :

Variables that you can modify :
         *the variables take the possible values 0 or 1 (0 is disabled, 1 is enabled)
   -g:Bs_stay_on_buffer_results_when_entering_result : if to jump on
    the result or not when pressing enter (option "J") (default is 1)
   -g:Bs_auto_jump : if to auto-show the result or not when moving
    with j and k (option "A") (default is 1)
   -g:Bs_toggle_quit_enter : if you want to quit the buffer with the
    search results when jumping (option "Q") (default is 0)
   -g:Bs_results_buffer_match : if you want to have syntax highlight
    on the search string in the buffer with the results (option "i")
    (default is 1)
   -g:Bs_buffers_match : if you want to have syntax highlight on the
    search string in other buffers (option "I") (default is 1)
 

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
buffers_search_and_replace.vim 0.6 2012-06-11 6.0 Alexandru Ionut Munteanu improved buffer looping performance
buffers_search_and_replace.vim 0.5.2 2009-04-06 6.0 Alexandru Ionut Munteanu - added option to set range when searching through current buffer (:<range> Bsc <search_regex>)
- <range> must be '<,'> for searching in visual selection
- fixed the 'u' event to update with the current search type
- added a top line showing the type of the search
buffers_search_and_replace.vim 0.5.1 2009-03-12 6.0 Alexandru Ionut Munteanu -added command to search and exclude some buffers from the search :
     :Bse <buffer_name_exclusion_regex> <search_regex>
-added searching on custom buffers (buffer name filtering) command :
     :Bsf <buffer_name_filter_regex> <search_regex>
*thank you Vasilii Pascal :)
buffers_search_and_replace.vim 0.5 2009-03-10 6.0 Alexandru Ionut Munteanu Optimised 'd' action, in order not to refresh the buffer each time.
Warning ! 'r' option for refreshing the screen has been replaced with the 'replace' action !
Action 'D', 'r' and 'R' added :
"D"  : definitely deletes the current range search result (default: current line),
"r"  : replace action on the non-deleted searched results
"R"  : replace action on the deleted searched results
Changed name to buffers_search_and_replace.vim
buffers_search.vim 0.4 2009-03-07 6.0 Alexandru Ionut Munteanu -option 'd' implemented :
            "d"  : deletes the current range search result (default: current line)
                   the deleted search results are showed at the bottom of
                   the buffer; deleting a deleted search results will
                   set it again as search result
-added the ':Bsc <search_string>' command for searching only in the current buffer
buffers_search.vim 0.3 2007-03-11 7.0 Alexandru Ionut Munteanu -changed some internals to follow Jimmy advices (like using buffer numbers
instead of buffer names to support unnamed buffers); thanks!
-options J,A,Q,O,r,u,i,I,x,? implemented (see docs)
buffers_search.vim 0.2 2007-03-07 7.0 Alexandru Ionut Munteanu Fixed an important bug : the search did not returned all the matches
buffers_search.vim 0.1 2007-03-07 7.0 Alexandru Ionut Munteanu Initial upload
ip used for rating: 18.226.166.214

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.
   
Vim at Github