Skip to content

Support swapping windows in a given direction #16

@b0o

Description

@b0o

I wrote a tiny function utilizing WindowSwap to swap two adjacent windows with a single mapping:

function! WindowSwapInDirection(dir)
  call WindowSwap#MarkWindowSwap()
  exec 'wincmd ' . a:dir
  call WindowSwap#DoWindowSwap()
endfunction

noremap <silent> <M-S-h> :call WindowSwapInDirection('h')<cr>
noremap <silent> <M-S-j> :call WindowSwapInDirection('j')<cr>
noremap <silent> <M-S-k> :call WindowSwapInDirection('k')<cr>
noremap <silent> <M-S-l> :call WindowSwapInDirection('l')<cr>

This is super useful and I think it would be a nice addition to the WindowSwap plugin itself.

I don't have time to submit a PR right now but I thought I'd leave the snippet here in case anyone wants to do the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions