Skip to content

Support folding actions #123

Open
Open
@ulyssa

Description

Vim has a concept of folding, which squashes multiple real lines into one visual line on the screen, which is primarily used for expanding and collapsing blocks of code. I'd like to reuse these keybindings in iamb (see ulyssa/iamb#93), so I'm going to add a FoldAction that the following keys can map to:

  • zf - create a fold over motion or visual selection
  • zd - remove a single fold at cursor or w/in visual selection
  • zD - remove folds recursively at cursor or w/in visual selection
  • zE - remove all folds w/in the window (need to figure out if this means viewport or buffer)
  • zo - open fold under the cursor; count impacts depth; in visual mode one level is open for all line in the selection
  • zO - open all folds under the cursor recursively; in visual mode open all folds w/in selection
  • zc - close one fold under the cursor; count impacts depth; in visual mode one level is closed for all liens w/in selection
  • zC - close all folds under the cursor recursively;
  • za - toggle folds under cursor between open/closed count times
  • zA - toggle folds under cursor between open/closed recursively
  • zv - open enough folds to make cursor line visible
  • zx - restore all manually opened and closed folds to original state, and then expand folds for cursor line until cursor is visible, like zv
  • zX - restore all manually opened and closed folds to original state
  • zm - reduce folding level by count; enable folding if not already enabled
  • zM - close all folds by setting folding level to 0; enable folding if not already enabled.
  • zr - increase folding level by count
  • zR - open all folds by setting folding level to highest value
  • zn - disable folding in buffer
  • zN - enable folding in buffer
  • zi - toggle folding in buffer

There are also the following movement keys, which will need a new variant in MoveType:

  • [z - move to start of currently open fold
  • ]z - move to end of currently open fold
  • zj - move downwards to the start of the next fold (also mapped in Operator-Pending Mode)
  • zk - move upwards to the end of the previous fold (also mapped in Operator-Pending Mode)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vimIssues related to the Vim keybindings

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions