Wikia

Vim Tips Wiki

Changes: Scroll alternate window

Edit

Back to page

(Move categories to tip template)
(Remove html character entities)
 
Line 15: Line 15:
   
 
<pre>
 
<pre>
nmap &lt;silent&gt; &lt;M-Down&gt; :call ScrollOtherWindow("down")&lt;CR&gt;
+
nmap <silent> <M-Down> :call ScrollOtherWindow("down")<CR>
nmap &lt;silent&gt; &lt;M-Up&gt; :call ScrollOtherWindow("up")&lt;CR&gt;
+
nmap <silent> <M-Up> :call ScrollOtherWindow("up")<CR>
   
 
fun! ScrollOtherWindow(dir)
 
fun! ScrollOtherWindow(dir)
 
if a:dir == "down"
 
if a:dir == "down"
let move = "\&lt;C-E&gt;"
+
let move = "\<C-E>"
 
elseif a:dir == "up"
 
elseif a:dir == "up"
let move = "\&lt;C-Y&gt;"
+
let move = "\<C-Y>"
 
endif
 
endif
exec "normal \&lt;C-W&gt;p" . move . "\&lt;C-W&gt;p"
+
exec "normal \<C-W>p" . move . "\<C-W>p"
 
endfun
 
endfun
 
</pre>
 
</pre>

Latest revision as of 08:30, September 28, 2008

Tip 131 Printable Monobook Previous Next

created October 11, 2001 · complexity basic · author Max Ischenko · version 6.0


This mapping allow you to quickly scroll inactive window when displaying several windows concurrently.

nmap <silent> <M-Down> :call ScrollOtherWindow("down")<CR>
nmap <silent> <M-Up> :call ScrollOtherWindow("up")<CR>

fun! ScrollOtherWindow(dir)
  if a:dir == "down"
    let move = "\<C-E>"
    elseif a:dir == "up"
    let move = "\<C-Y>"
  endif
  exec "normal \<C-W>p" . move . "\<C-W>p"
endfun

CommentsEdit

Around Wikia's network

Random Wiki