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 swapping windows in a given direction #16

Open
b0o opened this issue Apr 12, 2021 · 1 comment
Open

Support swapping windows in a given direction #16

b0o opened this issue Apr 12, 2021 · 1 comment

Comments

@b0o
Copy link

b0o commented Apr 12, 2021

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.

@piptouque
Copy link

piptouque commented Oct 21, 2022

Exactly what I was looking for, thanks!

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

2 participants