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

Incorrect alignment in visual block mode #141

Open
Addisonbean opened this issue Jul 14, 2020 · 0 comments
Open

Incorrect alignment in visual block mode #141

Addisonbean opened this issue Jul 14, 2020 · 0 comments

Comments

@Addisonbean
Copy link

Addisonbean commented Jul 14, 2020

I am trying to align the following code:

  ((modMask .|. controlMask, xK_Right), sendMessage $ ExpandTowards R)
, ((modMask .|. controlMask .|. shiftMask, xK_Right), sendMessage $ ShrinkFrom R)
, ((modMask .|. controlMask, xK_Left), sendMessage $ ExpandTowards L)
, ((modMask .|. controlMask .|. shiftMask, xK_Left), sendMessage $ ShrinkFrom L)
, ((modMask .|. controlMask, xK_Down), sendMessage $ ExpandTowards D)
, ((modMask .|. controlMask .|. shiftMask, xK_Down), sendMessage $ ShrinkFrom D)
, ((modMask .|. controlMask, xK_Up), sendMessage $ ExpandTowards U)
, ((modMask .|. controlMask .|. shiftMask, xK_Up), sendMessage $ ShrinkFrom U)
, ((modMask, xK_r), sendMessage BSP.Rotate)
, ((modMask, xK_s), sendMessage BSP.Swap)

And I want to end up with this:

  ((modMask .|. controlMask,               xK_Right), sendMessage $ ExpandTowards R)
, ((modMask .|. controlMask .|. shiftMask, xK_Right), sendMessage $ ShrinkFrom R)
, ((modMask .|. controlMask,               xK_Left), sendMessage $ ExpandTowards L)
, ((modMask .|. controlMask .|. shiftMask, xK_Left), sendMessage $ ShrinkFrom L)
, ((modMask .|. controlMask,               xK_Down), sendMessage $ ExpandTowards D)
, ((modMask .|. controlMask .|. shiftMask, xK_Down), sendMessage $ ShrinkFrom D)
, ((modMask .|. controlMask,               xK_Up), sendMessage $ ExpandTowards U)
, ((modMask .|. controlMask .|. shiftMask, xK_Up), sendMessage $ ShrinkFrom U)
, ((modMask,                               xK_r), sendMessage BSP.Rotate)
, ((modMask,                               xK_s), sendMessage BSP.Swap)

Because of the missing comma on the first line, I use visual-block mode to do the alignment, ignoring the leading commas. Here's the keys I used, my cursor started at the beginning of the code block: f(<C-v>9j$ga,.

This is what I end up with after doing that:

  ((modMask .|. controlMask,               xK_Right), sendMessage $ ExpandTowards R)
, ((modMask .|. controlMask .|. shiftMask,  xK_Right), sendMessage $ ShrinkFrom R)
, ((modMask .|. controlMask,               xK_Left), sendMessage $ ExpandTowards L)
, ((modMask .|. controlMask .|. shiftMask,  xK_Left), sendMessage $ ShrinkFrom L)
, ((modMask .|. controlMask,               xK_Down), sendMessage $ ExpandTowards D)
, ((modMask .|. controlMask .|. shiftMask,  xK_Down), sendMessage $ ShrinkFrom D)
, ((modMask .|. controlMask,               xK_Up), sendMessage $ ExpandTowards U)
, ((modMask .|. controlMask .|. shiftMask,  xK_Up), sendMessage $ ShrinkFrom U)
, ((modMask,                               xK_r), sendMessage BSP.Rotate)
, ((modMask,                               xK_s), sendMessage BSP.Swap)

As you can see, the values after the first , of my selection are not all aligned with each other as I hoped they would be.

It's worth mentioning it worked as expected when I added a comma to the first line that was missing one and used visual-line mode (V9jga2,). Adding the comma outside the selection did not affect how visual-block mode behaved.

I'm on the latest version of vim-easy-align and Neovim 0.4.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant