VIMonad

Bringing VIM philosophy to window management

VIMonad

VIMonad is a fork of XMonad that manages windows in a modal way like that in VIM. Some of the features include

Acknowledgements

VIMonad is built upon XMonad and it borrows a lot of great modules already existing in its Contrib library. I'd like to thank all the people who have made XMonad a fantastic window manager in the first place.

Install

Dependencies

Steps

  1. clone the repo somewhere
  2. move all the scripts under bin to a directory included in $PATH
  3. copy files under .xmonad to ~/.xmonad (note your old xmonad configuration will be overriden)
  4. cd into xmonad; cabal install
  5. cd into XMonadContrib; cabal install

Concepts

Layout

(Zoom in to see how the layout is represented on the statusbar)

Hierarchy

workspace(s)
└── row(s)
    └── line(s)
        └── tab(s)

Resizing

Task group

A major concept of VIMonad is task group. A task group defines a groups of windows that share the same or similar characteristics e.g., vim terminal windows, browser windows, etc.

Each task group has

Checkout xmonad.hs for how to define task groups.

Checkout Taskgroup.hs for source about task groups.

Register

Registers server two purposes in VIMonad:

  1. they act as marks attached to windows, by referencing which we can cycle within a specific group of windows
  2. they also act as registers like those in vim - we can delete, move, yank windows into registers
    • when we delete or move windows into registers, they are actually minimized as mentioned before
    • when we yank windows into registers, the windows stay in their original places

Attached registers are displayed for each window within the sqaure brackets of its tab label as '<reg>['<another reg>].

Insertion

Insertion of windows/workspaces emulate the relevant aspects from vim

Insertion order

When a window is inserted, you can choose to keep the focus on the old window without switching to the new window

Keys

Some points to note:

Motion

History jumplist

Object

Objects are used with commands, where the same command is applied to all the windows contained in the object.

Command

Delete

['<reg>]d<motion/object>

Move

['<reg>]m<motion/object>

Same as delete, except

Yank

'<reg>y<motion/object>

yank the windows selected by <motion/object> into register <reg>

Paste

['<reg>][g]p

paste the windows in register <reg>

Change

['<reg>]c<motion/object><group>

delete the windows selected by <motion/object> into <reg> and replace them by a new window constructed for group <group>

Construct

['<reg>]c[<num>][g]<insert position><group>

delete the visually selected windows into <reg> (only applicable within active visual mode), construct <num> of new window(s) for group <group> and insert it/them at the position specified by <insert position>, which can be:

Unregister

u<motion/object>

remove the association between the windows selected by <motion/object> with any registers

Repeat

.

repeat the last command

Window style

Window style is a convenient way to configure the commonly used positions and dimensions for float windows.

For each type of window (as defined by the task group), you have the opportunity to define the list of float styles.

Note you would almost certainly want to include doSink in the list so that one of the styles is sinking the window back into the tiles.

Macro

Macros are by default stored under ~/.macros. There are two types of macros

  1. a saved list of key sequences in VIMonad; these can be recorded directly in VIMonad
  2. an arbitrary piece of text; when triggered it is typed into the focused window via xdotool, like a snippet

Actions

Visual

Similar to vim, VIMonad allows you to visually select windows. There is, however, an added subtlety about passive/active visual.

Passive visual

Passive visual is indicated by a small triangle on the right edge of the selected tab. It stays on unless M-<Esc> is pressed.

Passive visual is useful for chaining commands - you can for example, move the selected windows into the left adjacent row and continue moving them up/down different lines.

Active visual

Active visual is indicated by a small square on the right edge of the selected tab. This is more like the visual mode in vim.

You can enter the active visual mode by

In the active visual mode you can perform any motion to toggle the selection of windows in the respective range.

To quit the active visual mode, press M-<Esc>; this commits the selected windows to passive visual (press M-<Esc> again to remove passive visual).

Visual command

These commands operate on

  1. when inside active visual mode, any windows currently selected
  2. or window(s) with passive visual in the current line, if any
  3. or the currently focused window

Other useful keys

Prompt

Workspace Prompt

As mentioned before, each workspace in VIMonad is dynamically allocated, and linked to a directory when being created. This is achieved via the workspace prompt - the prompt allows you to search in a tag database composed of directories with their names as tags (by default under ~/DB), and select/create the directory for initializing the workspace.

For example, say I want to create a new workspace after the current one for research on VIMonad, I can

  1. press M-s a (mnemonic: space create after), and enter in the prompt VIMonad
  2. if this tag already exists, I can see the directory in the completion window and choose it to have a new workspace rooted on that
  3. if it doesn't, I can instead input something like indie/VIMonad to create a new tag inside indie and root the new workspace in that new directory
  4. on the other hand I can also choose to not select any tag and just stick with VIMonad in the prompt; this gives me a new workspace rooted on home directory
  5. for 2 and 3 the new workspace will have an abbreviated version of the tag name as its workspace name; for 4 it will be whatever text you've put into the prompt

The full syntax for the workspace prompt is:

s[<num>]<space action>

where <space action> can be

Dynamic Prompt

Dynamic prompt is an integral part of VIMonad as it handles almost all program-related aspects of the system. Instead of being a simple program launcher like dmenu, dynamic prompt is more like a full-fledged shell environment.

Dynamic prompt is activated via M-r.

You can

Search prompt

Search windows by register/title/workspace name in the current X session

Wallpaper prompt

The wallpaper prompt enables you to switch wallpapers on the fly; it also has a wallbase backend as well as a rss downloader backend (for flickr) for you to search and download wallpapers by tag/description.

Wallpaper prompt is triggered by M-z. When the prompt is active, all the windows will be painted semi-transparent so that you can look through them to see the glory of the wallpapers.

Disclaimer

I've put a lot of effort into VIMonad over the years, but there is no guarantee that it will work on your system. More specifically:

If you intend to try VIMonad and have encountered any problem, you're welcome to use the issue tracker.