Created
January 23, 2013 09:33
-
-
Save madx/4603650 to your computer and use it in GitHub Desktop.
This is how I manage my windows in Vim. You may also be interested in dwm.vim (https://github.com/spolu/dwm.vim)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Put this in .vim/bundle/master-window/plugin/ if you are using Pathogen | |
| " Figure out a way to get this loaded if you aren't | |
| if exists("master_window_loaded") | |
| finish | |
| endif | |
| let master_window_loaded = 1 | |
| function! FocusMasterWindow() | |
| exe "1wincmd w" | |
| endfunction | |
| function! SwapWithMasterWindow() | |
| call MarkWindowSwap() | |
| call FocusMasterWindow() | |
| call DoWindowSwap() | |
| endfunction | |
| function! MarkWindowSwap() | |
| let g:markedWinNum = winnr() | |
| endfunction | |
| function! DoWindowSwap() | |
| let curNum = winnr() | |
| let curBuf = bufnr( "%" ) | |
| exe g:markedWinNum . "wincmd w" | |
| let markedBuf = bufnr( "%" ) | |
| exe 'hide buf' curBuf | |
| exe curNum . "wincmd w" | |
| exe 'hide buf' markedBuf | |
| endfunction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nnoremap <silent> <leader>ww <C-W>w | |
| nnoremap <silent> <leader>wW <C-W>W | |
| nnoremap <silent> <leader>ws <C-W>s | |
| nnoremap <silent> <leader>wv <C-W>v | |
| nnoremap <silent> <leader>wq <C-W>q | |
| nmap <silent> <leader>w<Space> :call FocusMasterWindow()<CR> | |
| nmap <silent> <leader>w<CR> :call SwapWithMasterWindow()<CR> | |
| nmap <silent> <leader>wm :call MarkWindowSwap()<CR> | |
| nmap <silent> <leader>wx :call DoWindowSwap()<CR> | |
| nmap <silent> <C-W>w <nop> | |
| nmap <silent> <C-W>W <nop> | |
| nmap <silent> <C-W>s <nop> | |
| nmap <silent> <C-W>v <nop> | |
| nmap <silent> <C-W>q <nop> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment