Skip to content

Commit

Permalink
fix: adjust window keymaps
Browse files Browse the repository at this point in the history
`<M-w>` -> `<]w>`
`<M-W>` -> `<[w>`
  • Loading branch information
adoyle-h committed Sep 4, 2024
1 parent c58f9a8 commit 0ae175b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
10 changes: 8 additions & 2 deletions doc/one.txt
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,15 @@ If bufferline plugin enabled, some keymaps will be overridden. See [Buffer Line]

- `-` = Choose window in current tab
- `<C-w><C-w>` = Choose window or tab via telescope picker
- `<M-w>` = Focus to next window
- `<M-W>` = Focus to previous window
- `<]w>` = Focus to next window
- `<[w>` = Focus to previous window
- `<C-w>p` = Focus to last accessed window.
- `<C-w>q` = Close current window
- `<C-w>o` = Close all other windows
- `<C-w>|` = Open window (vsplit)
- `<C-w>\` or `<C-w>n` = Open window (split)
- `<C-w>s` = Copy window (split)
- `<C-w>v` = Copy window (vsplit)
- `<C-w>r` = Enter window resize mode
- `<C-w>h` = Focus to left window
- `<C-w>j` = Focus to bottom window
Expand All @@ -443,6 +445,10 @@ If bufferline plugin enabled, some keymaps will be overridden. See [Buffer Line]
- `<C-w>t` = Move current window to new tab
- `<C-w>_` = Maximize window height
- `<C-w>=` = Make all windows (almost) equally high and wide, but use 'winheight' and 'winwidth' for the current window.
- `<C-w><C-H>` = move current window to left
- `<C-w><C-J>` = move current window to bottom
- `<C-w><C-K>` = move current window to top
- `<C-w><C-L>` = move current window to right

--------------------------------------------------------------------------------
## Scroll *one-keymaps-scroll*
Expand Down
10 changes: 8 additions & 2 deletions doc/usage/keymaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,13 +294,15 @@ If bufferline plugin enabled, some keymaps will be overridden. See [Buffer Line]

- `-` = Choose window in current tab
- `<C-w><C-w>` = Choose window or tab via telescope picker
- `<M-w>` = Focus to next window
- `<M-W>` = Focus to previous window
- `<]w>` = Focus to next window
- `<[w>` = Focus to previous window
- `<C-w>p` = Focus to last accessed window.
- `<C-w>q` = Close current window
- `<C-w>o` = Close all other windows
- `<C-w>|` = Open window (vsplit)
- `<C-w>\` or `<C-w>n` = Open window (split)
- `<C-w>s` = Copy window (split)
- `<C-w>v` = Copy window (vsplit)
- `<C-w>r` = Enter window resize mode
- `<C-w>h` = Focus to left window
- `<C-w>j` = Focus to bottom window
Expand All @@ -319,6 +321,10 @@ If bufferline plugin enabled, some keymaps will be overridden. See [Buffer Line]
- `<C-w>t` = Move current window to new tab
- `<C-w>_` = Maximize window height
- `<C-w>=` = Make all windows (almost) equally high and wide, but use 'winheight' and 'winwidth' for the current window.
- `<C-w><C-H>` = move current window to left
- `<C-w><C-J>` = move current window to bottom
- `<C-w><C-K>` = move current window to top
- `<C-w><C-L>` = move current window to right

## Scroll

Expand Down
16 changes: 8 additions & 8 deletions lua/one/keymap/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ M.keymaps = {
{ 'n', '<C-w><', '<C-w>1<<C-w>', { remap = true, desc = 'adjust window border to left (1 space)' } },

{ 'n', '<C-w>>', '<C-w>1><C-w>',
{ remap = true, desc = 'adjust window border to right (1 space)' } },
{ remap = true, desc = 'adjust window border to right (1 space)' } },

{ 'n', '<C-w>+', '<C-w>1+<C-w>', { remap = true, desc = 'increment window height (1 space)' } },
{ 'n', '<C-w>-', '<C-w>1-<C-w>', { remap = true, desc = 'decrement window height (1 space)' } },

{ 'n', '<C-w>H', '<C-w>5<<C-w>',
{ remap = true, desc = 'adjust window border to left (5 spaces)' } },
{ remap = true, desc = 'adjust window border to left (5 spaces)' } },

{
'n',
Expand All @@ -24,17 +24,17 @@ M.keymaps = {
{ 'n', '<C-w>J', '<C-w>3+<C-w>', { remap = true, desc = 'increment window height (3 spaces)' } },
{ 'n', '<C-w>K', '<C-w>3-<C-w>', { remap = true, desc = 'decrement window height (3 spaces)' } },

{ 'n', '<C-w><C-L>', '<C-w>L', { noremap = true, desc = 'move current buffer to right' } },
{ 'n', '<C-w><C-H>', '<C-w>H', { noremap = true, desc = 'move current buffer to left' } },
{ 'n', '<C-w><C-J>', '<C-w>J', { noremap = true, desc = 'move current buffer to bottom' } },
{ 'n', '<C-w><C-K>', '<C-w>K', { noremap = true, desc = 'move current buffer to top' } },
{ 'n', '<C-w><C-L>', '<C-w>L', { noremap = true, desc = 'move current window to right' } },
{ 'n', '<C-w><C-H>', '<C-w>H', { noremap = true, desc = 'move current window to left' } },
{ 'n', '<C-w><C-J>', '<C-w>J', { noremap = true, desc = 'move current window to bottom' } },
{ 'n', '<C-w><C-K>', '<C-w>K', { noremap = true, desc = 'move current window to top' } },

{ 'n', '<C-w>\\', ':new<CR>', { desc = 'create new buffer horizontally' } },
{ 'n', '<C-w>|', ':vnew<CR>', { desc = 'create new buffer vertically' } },
{ 'n', '<C-w>N', ':vnew<CR>', { desc = 'create new buffer vertically' } },

{ 'n', '<M-w>', '<C-w>w', { noremap = true, desc = 'next buffer in window' } },
{ 'n', '<M-W>', '<C-w>W', { noremap = true, desc = 'previous buffer in window' } },
{ 'n', ']w', '<C-w>w', { noremap = true, desc = 'next buffer in window' } },
{ 'n', '[w', '<C-w>W', { noremap = true, desc = 'previous buffer in window' } },
}

return M

0 comments on commit 0ae175b

Please sign in to comment.