codethread / qmk.nvim

Format qmk and zmk keymaps in neovim
MIT License
150 stars 5 forks source link

Consistent padding (fixed width) #40

Open Diaoul opened 3 months ago

Diaoul commented 3 months ago

I would like qmk-vim to be consistent in the number of characters used for keycodes. Currently, it's only consistent over a single layout and not the entire matrix which can result in some weird renders:

[BASE] = LAYOUT_split_3x6_3(
  KC_QUES , KC_Q , KC_W , KC_F , KC_P   , KC_B    ,                          KC_J    , KC_L   , KC_U    , KC_Y   , KC_QUOT , KC_MINS,
  QK_GESC , HR_A , HR_R , HR_S , HR_T   , KC_G    ,                          KC_M    , HR_N   , HR_E    , HR_I   , HR_O    , QK_REP ,
  KC_LPRN , KC_Z , KC_X , KC_C , KC_D   , KC_V    ,                          KC_K    , KC_H   , KC_COMM , KC_DOT , KC_SLSH , KC_RPRN,
                                 KC_ESC , NUM_TAB , NAV_SPC ,     SYM_BSPC , SYM_ENT , QK_REP                                       
),

[SYM] = LAYOUT_split_3x6_3(
  KC_EXCL , KC_1    , KC_2    , KC_3    , KC_4    , KC_5    ,                         _______ , _______ , _______ , _______ , _______ , _______,
  KC_HASH , KC_CIRC , KC_EQL  , KC_UNDS , KC_DLR  , KC_ASTR ,                         _______ , _______ , _______ , _______ , _______ , _______,
  KC_AT   , KC_LT   , KC_PIPE , KC_MINS , KC_GT   , KC_SLSH ,                         _______ , _______ , _______ , _______ , _______ , _______,
                                          _______ , _______ , _______ ,     _______ , _______ , _______                                        
),

See the first layout is much shorter than the second one on the left side because some columns (like 2nd and 3rd) are reduced to 5 chars on the first layout and not the second layout.

Is it possible to have a minimum width of 8?

codethread commented 2 months ago

I'll look into implementing a full colum-wise alignment option 🙂

I don't think a min-width option would solve the issue as you could still have a long key on a particular row that distorts the view 🤔

Diaoul commented 2 months ago

You're right, I'm just sticking to 8-chars names but that's purely on me.