dedicated buffers applications - chimay/wheel GitHub Wiki

Within the wheel

The dedicated buffers that allow us to navigate in the wheel are :

  • <M-w><Space> : location
  • <M-w><C-space> : current location of the chosen circle
  • <M-w><S-space> : current location of the chosen torus
  • <M-w><M-x> : index with folds (see below)
  • <M-w>X : index of toruses > circles > locations
  • <M-w><M-S-x> : index of toruses > circles
  • <M-w><M-h> : history
  • <M-w><M-e> : frecency

Buffers

Go to buffer.

The default mapping are :

  • <M-w><M-b> for ordinary buffers
  • <M-w><C-b> for all buffers, included unlisted ones

Fields

This buffer displays the following columns :

buffer number | indicator | line number | filename

Tabs and windows in tree mode

Switch to visible buffer, displayed in a tab or window. Folding mode matching the tree of tabs and windows.

The default mapping is <M-w><M-v>.

Tabs & windows

Switch to visible buffer, displayed in a tab or window.

The default mapping is <M-w><C-v>.

Fields

This buffer displays the following columns :

tab number | window number | filename

Find

Search files in current directory tree with glob().

You can enter a single or multiple word(s) pattern at the prompt : the files are filtered by each word. See completion.

The default mapping is <M-w><M-f>.

Async find

Search files with unix find command in async mode.

If you enter pattern at the prompt, the glob used to find files will be :

*pattern*

The find command is recursive by default, so you don’t need the double asterisk prefix.

If you enter several words at the prompt, say word-1 word-2 , the glob used to find files will be :

*word-1*word-2*

The default mapping is <M-w>&f.

You can stop the process by using <c-s> in the dedicated buffer.

MRU

Open file in Most Recently Used file list.

The default mapping is <M-w><M-u>.

Fields

This buffer displays the following columns :

date & time of last edit | filename

Locate

Search files with unix locate command.

The default mapping is <M-w>l.

Occur

List of lines matching a pattern.

The default mapping is <M-w><M-o>.

Fields

This buffer displays the following columns :

tab number | window number | filename

Grep

The default mapping is <M-w>g.

The navigation mappings are the same as usual : activate a buffer line will open the right file at the right place.

Context menu

The context menu contains :

  • the usual navigation functionalities
  • an edit mode, see the grep edit mode
  • a quickfix window opener

Fields

This buffer displays the following columns :

error number | line number | column number | filename | line content

Outline

The default mapping is <M-w><S-o>.

An outline buffer is a grep buffer where all your headers are displayed. You can choose between the following header formats :

  • vim folds
  • markdown
  • org mode
  • vimwiki

Fields

This buffer displays the following columns :

error number | line number | column number | filename | line content

Markers

Go to selected marker.

The default mapping is <M-w><M-'>. It is inspired by the normal command 'a.

Fields

This buffer displays the following columns :

mark | line number | column number | filename | line content

Jumps

Go to element in jump list.

The default mapping is <M-w><M-j>.

Fields

This buffer displays the following columns :

buffer number | line number | column number | filename | line content

Changes

Go to element in changes list.

The default mapping is <M-w>;. It is inspired by the normal commands g;.

Fields

This buffer displays the following columns :

line number | column number | line content

Tags

Go to selected tag.

The default mapping is <M-w><M-t>.

Fields

This buffer displays the following columns :

tag type | tag iden | filename | search string

Reorder

The reordering buffers allow you to quickly reorder Wheel elements by reordering the buffer lines. You can use yank/delete/paste operations to perform the reordering.

You can also sort them with |:sort|, but in that case, be sure not to include the first line in the range.

Please yank/delete entire lines, or your data could loose their integrity.

To validate your change, simply |:write| the buffer.

The number of lines will be checked and, if there is missing or excedent lines, Wheel will refuse to apply your change.

Mappings

The default mappings launching reordering buffers are :

  • <M-w>@o : reorder locations
  • <M-w>@<C-o> : reorder circles
  • <M-w>@O : reorder toruses

Additional local maps

  • <M-s> : sort the visible lines, except the filter : 2,$sort
  • <M-r> : reversed sort of the visible lines, except the filter : 2,$sort!

Rename

The renaming buffers allow you to batch rename Wheel elements by editing the buffer lines. You can use powerful native tools, like visual block or :substitute operations to perform the renaming.

To validate your change, simply :write the buffer.

The number of lines will be checked and, if there is missing or excedent lines, Wheel will refuse to apply your change.

When dealing with locations, only the location names will be modified : the file names on the file system remain unchanged.

Rename locations & files

This function display two columns : the first one is for the locations, and the second one for the filenames. You can edit both of them.

You can even use it to move your files to another directory ; any non-existent folder will be created if needed.

Mappings

The default mappings launching renaming buffers are :

  • <M-w>@n : rename locations
  • <M-w>@<C-n> : rename circles
  • <M-w>@N : rename toruses
  • <M-w>@<M-n> : rename locations & files

Delete

The deleting buffers allow you to batch delete Wheel elements by selecting the buffer lines.

When you're sure about it, just write the buffer.

Mappings

The default mappings launching deleting buffers are :

  • <M-w>@d : delete locations
  • <M-w>@<C-d> : delete circles
  • <M-w>@D : delete toruses

Copy & move

The copy/move buffers allow you to batch copy or move Wheel elements by selecting the buffer lines. To validate your selection, simply |:write| the buffer. It will ask you if you want to copy or move the selection.

Mappings

The default mappings launching renaming buffers are :

  • <M-w>@c : copy/move locations
  • <M-w>@<M-c> : copy/move circles
  • <M-w>@C : copy/move toruses

Reorganize the wheel

The reorganizing buffer allows you to quickly reorganize the Wheel elements. All elements of the wheel are represented, and folds are used to reflect the tree structure of the Wheel :

  • torus names
  • circle names
  • locations (the dictionary lines)

You can :

  • copy or move elements by copying or moving the buffer lines
    • copy or move a location to another circle
    • copy or move a circle to another torus
    • reordering elements (but without check)
  • rename elements
  • change line or column of a location

Please move or copy entire lines, or your data could loose their integrity. Be aware that removing a line will remove the corresponding element from the wheel.

To validate your change, simply |:write| the buffer.

Mappings

The default mapping is <M-w><M-r>.

Reorganize tabs and windows

In this buffer, you can :

  • add new tabs
  • add files in new windows
    • the split will be horizontal or vertical, depending on the aspect ratio of the preceding window
  • move, copy or delete tabs
  • move, copy or delete windows

To validate your change, simply |:write| the buffer.

Mappings

The default mapping is <M-w><C-r>.

From context menu

This buffer can also be launched from the context menu of a tabs & windows navigation buffer.

Grep edit mode

The edit mode will save your search and open a new buffer where you can edit the grep lines. If you write this buffer, the plugin will propagate your changes to the grepped file(s). There are some limitations, however :

  • you cannot add or remove entire lines
  • if you exchange or shuffle lines, they will be exchanged or shuffled in your files too, which can lead to an undesired mess.

Note that :

  • the plugin will not write the grepped files for you.
    • if you are satisfied with the changes, just save all your modified buffers as usual with :wa.
  • you can of course undo the changes you made if you are not happy with it

Default mapping : <M-w><M-g>

Anyway, it's always a good thing to do a backup of your files first, or even better, to work within a VCS repository, like git.

Fields

This buffer displays the following columns :

error number | line number | column number | filename | line content

Narrow current file

This function narrow the current file lines. In the dedicated buffer, you can :

  • filter the lines
  • select lines
  • navigate to current or selected line(s)
  • edit visible lines

You can edit the existing lines contents as much as you want, but avoid modifying the line number field. There is also a limited support to add line with buffer local maps :

  • o : add line below current one
  • O : add line above current one
  • <M-y> : duplicate line below current one
  • <M-z> : duplicate line above current one

If you need to use the first-line filter, it's important to do it before adding new lines, or the numbering could be incorrect.

Just :write the buffer to propagate your changes to the original file.

Default mappings :

  • <M-w>-- : depends on the mode :
    • in normal mode : waits for a movement or a text-objects to select the range used in the narrow buffer
    • in visual mode : open a narrow buffer with the visual range
  • <M-w>-% : open a narrow buffer with the entire original file content

Fields

This buffer displays the following columns :

line number | line content

Substitution

The map <M-s> launch a :substitute wrapper. There are a few advantages to use it instead of a plain :s/.../.../g.

First, only the line contents are modified, the other fields remain intact. If you are curious about how it is done, check /\@<= in vim help.

Second, it asks you if you mean to replace only full word matches. This is useful if you want to replace e.g. the word foo but not foo in foobar.

Third, if the replacing word is already present in the buffer, it will ask you confirmation before running the substitution. That way, you can avoid confusion in variable names, for instance.

Only visible lines are affected for this function : it's just a wrapper for :substitute

Narrow all circle files

This function narrow the lines of all circle files. In the dedicated buffer, you can :

  • filter the lines
  • select lines
  • navigate to current or selected line(s)
  • edit visible lines

You can see it as a combination of the grep and grep edit mode dedicated buffers.

You can edit the lines content as much as you want, but avoid modifying the other fields. Adding or removing lines is currently not supported.

Just :write the buffer to propagate your changes to the original file.

It uses and fill the vim quickfix list under the hood.

Default mapping : <M-w>-c

Fields

This buffer displays the following columns :

buffer number | line number | filename | line content

Substitution

The map <M-s> launch a :substitute wrapper. There are a few advantages to use it instead of a plain :s/.../.../g, see narrow file substitution

Context

The map <M-c> adds context lines to each grep result. You're asked how many lines to add.

Yank

As usual, you can filter the elements in insert mode. The available local maps are :

  • <Enter> : paste a yank after cursor
  • g<Enter> : paste a yank after cursor, leave yank ring opened
  • p : paste a yank linewise after cursor, leave yank ring opened
  • P : paste a yank linewise before cursor, leave yank ring opened
  • gp : paste a yank characterwise after cursor, leave yank ring opened
  • gP : paste a yank characterwise before cursor, leave yank ring opened
  • s : switch register

Switching register

A yank dedicated buffer starts with the yank ring of the wheel default register.

A yank dedicated buffer starts with the default register.

If you press s, a prompt asks you to which register you want to switch. Completion is available with the register full names as candidates :

unnamed : " clipboard : + primary : * small : - inserted : . search : / command : : expression : = file : % alternate : #

The buffer content is then replaced by the yank ring of the new register.

If you press <M-w><C-y>, a prompt will ask you for a new starting default register. Register completion is there to help you. This map is also available in any regular buffer.

Plain mode

The yank ring buffer in plain mode is launched by <M-w><M-p>.

Each line of the dedicated buffer is a line of one of your yanks, represented as a string.

Besides the usual yank maps, you can go to visual mode and paste your selection with p. The paste is done characterwise.

Advantages :

  • flexible : you can use visual line, char or block mode

Drawbacks :

  • more keystrockes to paste multiple lines :
    • hit p on each one
    • or select them and use p next
    • or use visual mode

List mode

The yank ring buffer in list mode is launched by <M-w><M-y>.

Each line of the dedicated buffer is one of your yanks, represented as a list.

Advantages :

  • you can paste a whole yank with a single keystroke

Drawbacks :

  • less flexibility : it is not possible to use visual mode

Undo list

In this buffer, you can navigate in the undo tree of the related buffer.

Actions available :

  • <enter> : go to the undo position of the current line
  • - : perform :earlier on the related buffer
  • + : perform :later on the related buffer
  • u : go back to the last undo state

Before playing with this, be sure you have a backup of your file (VCS or so).

Default mapping : <M-w><C-u>

With u, you can go back to the last undo state.

Diff mode

With D, you can visualize a diff split between :

  • the current state of your file
  • the chosen undo state

You can even make some modifications in this file with do and dp (or :diffget and :diffput).

With x, you can close the diff split.

Fields

This buffer displays the following columns :

iden | time | written

Command output

You can execute an ex or shell command and display the output in a wheel dedicated buffer. Shell commands must be prefixed by a !.

Default mapping : <M-w>:

Examples :

  • <M-w>: then nmap <silent> <plug>(wheel-
  • <M-w>: then nmap <silent> <M-w>
  • <M-w>: then !ls -l % #

Async mode

You can run a shell command in async mode and display the output in a dedicated buffer.

Default mapping : <M-w>&&

You can stop the process by using <c-s> in the dedicated buffer.

⚠️ **GitHub.com Fallback** ⚠️