move vim pack, stage 1
This commit is contained in:
		
							parent
							
								
									5738b8d1ea
								
							
						
					
					
						commit
						754b8e3a37
					
				
					 13 changed files with 63 additions and 34 deletions
				
			
		
							
								
								
									
										103
									
								
								vimpack/start/vim-scripts/plugin/directionalWindowResizer.vim
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								vimpack/start/vim-scripts/plugin/directionalWindowResizer.vim
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,103 @@
 | 
			
		|||
"By default I have the windows adjustment functions set to <Ctrl+j> for down, <Ctrl+k> for up, <Ctrl+l> for right & <Ctrl +h> for left
 | 
			
		||||
"Adjust them to whatever suits your needs
 | 
			
		||||
 | 
			
		||||
nnoremap <silent> <C-j> :call DownHorizontal()<CR>
 | 
			
		||||
nnoremap <silent> <C-k> :call UpHorizontal()<CR>
 | 
			
		||||
nnoremap <silent> <C-l> :call RightVertical()<CR>
 | 
			
		||||
nnoremap <silent> <C-h> :call LeftVertical()<CR>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
"WINDOW RESIZING Down
 | 
			
		||||
func! DownHorizontal()
 | 
			
		||||
let currentWin = winnr()
 | 
			
		||||
"If no window below or above leave as is, otherwise call function
 | 
			
		||||
   wincmd j
 | 
			
		||||
if winnr() == currentWin
 | 
			
		||||
   wincmd k
 | 
			
		||||
   if winnr() == currentWin
 | 
			
		||||
      wincmd k 
 | 
			
		||||
   else 
 | 
			
		||||
      exe currentWin . "wincmd w"
 | 
			
		||||
      call DownHorizontalAdjust()
 | 
			
		||||
   endif
 | 
			
		||||
else
 | 
			
		||||
   exe currentWin . "wincmd w"
 | 
			
		||||
   call DownHorizontalAdjust()
 | 
			
		||||
endif
 | 
			
		||||
endfun
 | 
			
		||||
 | 
			
		||||
func! DownHorizontalAdjust()
 | 
			
		||||
let currentWin = winnr()
 | 
			
		||||
"If very bottom window, decrease window size, otherwise just increase current window size
 | 
			
		||||
wincmd j 
 | 
			
		||||
if winnr() == currentWin
 | 
			
		||||
   resize -1
 | 
			
		||||
else
 | 
			
		||||
   exe currentWin . "wincmd w"
 | 
			
		||||
   resize +1
 | 
			
		||||
endif
 | 
			
		||||
endfun
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
"WINDOW RESIZING Up
 | 
			
		||||
func! UpHorizontal ()
 | 
			
		||||
let currentWin = winnr()
 | 
			
		||||
"If no window below or above leave as is
 | 
			
		||||
   wincmd j
 | 
			
		||||
if winnr() == currentWin
 | 
			
		||||
   wincmd k
 | 
			
		||||
   if winnr() == currentWin
 | 
			
		||||
      wincmd k 
 | 
			
		||||
   else 
 | 
			
		||||
      exe currentWin . "wincmd w"
 | 
			
		||||
      call UpHorizontalAdjust()
 | 
			
		||||
   endif
 | 
			
		||||
else
 | 
			
		||||
   exe currentWin . "wincmd w"
 | 
			
		||||
   call UpHorizontalAdjust()
 | 
			
		||||
endif
 | 
			
		||||
endfun
 | 
			
		||||
 | 
			
		||||
func! UpHorizontalAdjust()
 | 
			
		||||
let currentWin = winnr()
 | 
			
		||||
"If very top window, decrease window size, otherwise just increase current window size
 | 
			
		||||
   wincmd k
 | 
			
		||||
   if winnr() == currentWin
 | 
			
		||||
      resize -1
 | 
			
		||||
   else
 | 
			
		||||
      resize -1
 | 
			
		||||
      exe currentWin . "wincmd w"
 | 
			
		||||
endif
 | 
			
		||||
endfun
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
"WINDOW RESIZING Right (only requires 1 function)
 | 
			
		||||
func! RightVertical()
 | 
			
		||||
let currentWin = winnr()
 | 
			
		||||
" If very right window, decrease window size, otherwise just increase current window size
 | 
			
		||||
wincmd l
 | 
			
		||||
if winnr() == currentWin
 | 
			
		||||
   vertical resize -1
 | 
			
		||||
else
 | 
			
		||||
  exe currentWin . "wincmd w"
 | 
			
		||||
  vertical resize +1
 | 
			
		||||
endif
 | 
			
		||||
endfun
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
"WINDOW RESIZING Left (only requires 1 function)
 | 
			
		||||
func! LeftVertical()
 | 
			
		||||
let currentWin = winnr()
 | 
			
		||||
" If very left window, decrease window size, otherwise just increase current window size
 | 
			
		||||
wincmd h
 | 
			
		||||
if winnr() == currentWin
 | 
			
		||||
   vertical resize -1
 | 
			
		||||
else
 | 
			
		||||
  vertical resize -1
 | 
			
		||||
  exe currentWin . "wincmd w"
 | 
			
		||||
endif
 | 
			
		||||
endfun
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										44
									
								
								vimpack/start/vim-scripts/plugin/mouse_toggle.vim
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								vimpack/start/vim-scripts/plugin/mouse_toggle.vim
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,44 @@
 | 
			
		|||
" plugin/mouse_toggle.vim
 | 
			
		||||
"	<plug>mouse_toggle	-> toggle 'mouse' option
 | 
			
		||||
"	<leader>m		-> <plug>mouse_toggle
 | 
			
		||||
"	Written by Kobus Retief
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if !has("mouse")
 | 
			
		||||
	finish
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if exists("loaded_mouse_toggle")
 | 
			
		||||
	finish
 | 
			
		||||
endif
 | 
			
		||||
let loaded_mouse_toggle = 1
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
let s:save_cpo = &cpo
 | 
			
		||||
set cpo&vim
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
let s:oldmouse = exists("mouse_default") ? mouse_default : "a"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
function s:mouse_toggle()
 | 
			
		||||
	if &mouse == ""
 | 
			
		||||
		let &mouse = s:oldmouse
 | 
			
		||||
		echo "mouse enabled (=" . &mouse . ")"
 | 
			
		||||
	else
 | 
			
		||||
		let s:oldmouse = &mouse
 | 
			
		||||
		let &mouse = ""
 | 
			
		||||
		echo "mouse disabled"
 | 
			
		||||
	endif
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
nnoremap <unique> <silent> <plug>mouse_toggle :call <sid>mouse_toggle()<cr>
 | 
			
		||||
if ! hasmapto("<plug>mouse_toggle")
 | 
			
		||||
	map <unique> <leader>m <plug>mouse_toggle
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
let &cpo = s:save_cpo
 | 
			
		||||
unlet s:save_cpo
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue