examples - chimay/wheel Wiki

Display some locations in tabs

Just press <M-w><space> to launch the location navigator, select the locations you want and press t

Display matching files in splits

Search and replace in grep edit mode

Let's say you want to refactory some shell scripts, and replace old_var_name by new_var_name.

The first thing to do is to create a group that contains all of your scripts. To do that, first create a torus named e.g. quickfix. Then, :cd to the root directory of your scripts and add all the script files with <M-w>*. The routine will ask you the glob pattern ; you can type **/*.sh if all your scripts have the same sh extension. After that, you will be asked if you want to create a new circle. Answer yes, and call this circle shell.

Now that you have your group ready, you can start the search with <M-w><M-g>. It will open the grep dedicated buffer in edit mode. You are now in a buffer where you can edit and propagate your changes. So, we use the classic :substitute (|:s| in short form) :

:%s/old_var_name/new_var_name/g

to replace all the occurences of the old var name. Then, just :write the buffer to apply these changes to all your shell scripts.

Satisfied with the changes ? Just save all your modified buffers with :wa.

Want to go back to previous state ? You can undo your substitution in the dedicated buffer, and write again.

You can of course reuse the shell group for later refactoring.

Replace everywhere, except in a given file

Simply use the :global command in invert mode :vglobal (|:v| in short form) in combination with :substitute :

SEARCH AND REPLACE WITH NARROW CIRCLE wheel-examples-search-replace-narrow

:v/my_file/s/old_var_name/new_var_name/g

Search and replace in narrow circle mode

We open the narrow circle buffer with <M-w>-c and run a substitution with <M-s>.

Then, just :write the buffer to apply these changes to all your circle files.

Replace everywhere, except in a given file

Once in the narrow buffer, press <m-i>, insert !my_file in the first line and press <enter> to apply the filter.

You can then run a substitute on the visible lines and propagate your changes by writing the buffer.

Add a tab with a similar file

List all tags of a kind