examples - chimay/wheel GitHub 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

  • <M-w><space> to launch the location navigator
  • i to go to insert mode & filter line
  • enter the pattern you want
    • e.g. \.vim$ if all your vim locations end with .vim
  • <enter> to validate the pattern
  • * to select all the visible (filtered) locations
  • v to open all selected locations in vertical 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 :

: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

  • press <M-w><C-r> to launch the tabs & windows organizer
  • copy the line with the tab you want to duplicate
    • with closed fold, to take the files in it
  • paste it where you want
  • open the fold of the new tab
  • modify the filename in it to match the file you want to edit
    • you can even use <C-x><C-f> to use vim file completion
  • apply your changes with :write

List all tags of a kind

  • launch the tag navigator with <M-w>t
  • type i to go to insert mode on filter line
  • enter \<f\> to keep only functions tags
    • or \<m\> to keep only maps tags
    • ...
⚠️ **GitHub.com Fallback** ⚠️