Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support folding actions #123

Open
ulyssa opened this issue Oct 8, 2023 · 0 comments
Open

Support folding actions #123

ulyssa opened this issue Oct 8, 2023 · 0 comments
Labels
vim Issues related to the Vim keybindings

Comments

@ulyssa
Copy link
Owner

ulyssa commented Oct 8, 2023

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)
@ulyssa ulyssa added the vim Issues related to the Vim keybindings label Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vim Issues related to the Vim keybindings
Projects
None yet
Development

No branches or pull requests

1 participant