Giter Club home page Giter Club logo

vim-choosy's Introduction

Introduction

Choosy is a Vim plugin for quickly preforming actions on windows via a interactive selection mechanism. Vim typically operates with a verb-object syntax, and Choosy does the same. For example, you might type <leader>cwc (verb: choose window to close) then pick the window you want to close (the object, or target).

Choosy was inspired by vim-choosewin but is more configurable, allowing the user to specify the actions to take on the target window.

Features

When run, Choosy displays a popup at the center of each window. Each popup shows a letter or the window number (configurable). To choose the window, type the given letter/number. Choosy closes all of the popups it opened and executes an action.

What actions? Pretty much anything you like. Choosy comes with a number of example actions (see below) such as jumping to a window, splitting a window, closing a window, or swapping buffers between windows. But part of the power of Choosy is that you can easily set up your own actions. Here's an example call to Choosy that splits a selected window into 3 parts:

nnoremap <leader>3 :Choosy call win_execute({win.winid}, "sp {bar} sp")<cr>

The {win.winid} gets replaced with the window ID of the window you chose, and the {bar} gets replacded with the | command separator. See the docs for full information, or plugin/choosy.vim for more examples.

Default mappings

Choosy comes with a set of default mappings starting with <leader>cw ("choose window"):

  • <leader>cwh: split the target window horizontally
  • <leader>cwv: split the target window vertically
  • <leader>cwc: close the target window
  • <leader>cws: swap the buffers in this window and the target one, with the cursor following this buffer
  • <leader>cwS: swap the buffers in this window and the target one, with the cursor Staying in the current window
  • <leader>cwD: show this buffer in the target window ("Duplicate")

If NERDTree is installed, an additional set of mappings are available to open files from NERDTree in a target window. These start with <leader>co ("choose open"):

  • <leader>cow: open in the target window
  • <leader>coh: open in a horizontal split of the target window
  • <leader>cov: open in a vertical split of the target window

Installing

Choosy requires a recent Vim which supports popup windows and optional function arguments.

Choosy has not been tested on versions < 8.1 (patch 2110), nor on nvim.

To install, use your package manager of choice. For example, with vim-plug add to your vimrc:

Plug 'anjiro/vim-choosy'

Screenshots

Note that these screenshots have syntax higlighting turned off to make the Choosy popups more visible.

Basic configuration:

Basic screenshot

With g:choosy_color_popups and g:choosy_key_winnr set:

Fancy screenshot

vim-choosy's People

Contributors

anjiro avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.