Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
scroll.txt343 linesDownload Raw Back to doc
1*scroll.txt*	For Vim version 9.2.  Last change: 2026 Feb 142 3 4		  VIM REFERENCE MANUAL	  by Bram Moolenaar5 6 7Scrolling						*scrolling*8 9These commands move the contents of the window.  If the cursor position is10moved off of the window, the cursor is moved onto the window (with11'scrolloff' screen lines around it).  A page is the number of lines in the12window minus two.  The mnemonics for these commands may be a bit confusing.13Remember that the commands refer to moving the window (the part of the buffer14that you see) upwards or downwards in the buffer.  When the window moves15upwards in the buffer, the text in the window moves downwards on your screen.16 17See section |03.7| of the user manual for an introduction.18 191. Scrolling downwards		|scroll-down|202. Scrolling upwards		|scroll-up|213. Scrolling relative to cursor	|scroll-cursor|224. Scrolling horizontally	|scroll-horizontal|235. Scrolling synchronously	|scroll-binding|246. Scrolling with a mouse wheel |scroll-mouse-wheel|25 26==============================================================================271. Scrolling downwards					*scroll-down*28 29The following commands move the edit window (the part of the buffer that you30see) downwards (this means that more lines downwards in the text buffer can be31seen):32 33							*CTRL-E*34CTRL-E			Scroll window [count] lines downwards in the buffer.35			The text moves upwards on the screen.36			Mnemonic: Extra lines.37 38							*CTRL-D*39CTRL-D			Scroll window Downwards in the buffer.  The number of40			lines comes from the 'scroll' option (default: half a41			screen).  If [count] given, first set 'scroll' option42			to [count].  The cursor is moved the same number of43			lines down in the file (if possible; when lines wrap44			and when hitting the end of the file there may be a45			difference).  When the cursor is on the last line of46			the buffer nothing happens and a beep is produced.47			See also 'startofline' option.48 49<S-Down>	or				*<S-Down>* *<kPageDown>*50<PageDown>	or				*<PageDown>* *CTRL-F*51<S-CR>	or					*<S-CR>* *<S-NL>*52<S-+>	or					*SHIFT-+* *<S-Plus>*53CTRL-F			Scroll window [count] pages Forwards (downwards) in54			the buffer.  See also 'startofline' option.55			When there is only one window the 'window' option56			might be used.57 58							*z+*59z+			Without [count]: Redraw with the line just below the60			window at the top of the window.  Put the cursor in61			that line, at the first non-blank in the line.62			With [count]: just like "z<CR>".63 64==============================================================================652. Scrolling upwards					*scroll-up*66 67The following commands move the edit window (the part of the buffer that you68see) upwards (this means that more lines upwards in the text buffer can be69seen):70 71							*CTRL-Y*72CTRL-Y			Scroll window [count] lines upwards in the buffer.73			The text moves downwards on the screen.74			Note: When using the MS-Windows key bindings CTRL-Y is75			remapped to redo.76 77							*CTRL-U*78CTRL-U			Scroll window Upwards in the buffer.  The number of79			lines comes from the 'scroll' option (default: half a80			screen).  If [count] given, first set the 'scroll'81			option to [count].  The cursor is moved the same82			number of lines up in the file (if possible; when83			lines wrap and when hitting the end of the file there84			may be a difference).  When the cursor is on the first85			line of the buffer nothing happens and a beep is86			produced.  See also 'startofline' option.87 88<S-Up>		or					*<S-Up>* *<kPageUp>*89<PageUp>	or					*<PageUp>* *CTRL-B*90<S-->		or				*<S-Minus>* *SHIFT-MINUS*91CTRL-B			Scroll window [count] pages Backwards (upwards) in the92			buffer.  See also 'startofline' option.93			When there is only one window the 'window' option94			might be used.95 96							*z^*97z^			Without [count]: Redraw with the line just above the98			window at the bottom of the window.  Put the cursor in99			that line, at the first non-blank in the line.100			With [count]: First scroll the text to put the [count]101			line at the bottom of the window, then redraw with the102			line which is now at the top of the window at the103			bottom of the window.  Put the cursor in that line, at104			the first non-blank in the line.105 106==============================================================================1073. Scrolling relative to cursor				*scroll-cursor*108 109The following commands reposition the edit window (the part of the buffer that110you see) while keeping the cursor on the same line.  Note that the 'scrolloff'111option may cause context lines to show above and below the cursor.112 113							*z<CR>*114z<CR>			Redraw, line [count] at top of window (default115			cursor line).  Put cursor at first non-blank in the116			line.117 118							*zt*119zt			Like "z<CR>", but leave the cursor in the same120			column.121 122							*zN<CR>*123z{height}<CR>		Redraw, make window {height} lines tall.  This is124			useful to make the number of lines small when screen125			updating is very slow.  Cannot make the height more126			than the physical screen height.127 128							*z.*129z.			Redraw, line [count] at center of window (default130			cursor line).  Put cursor at first non-blank in the131			line.132 133							*zz*134zz			Like "z.", but leave the cursor in the same column.135			Careful: If caps-lock is on, this command becomes136			"ZZ": write buffer and exit!137 138							*z-*139z-			Redraw, line [count] at bottom of window (default140			cursor line).  Put cursor at first non-blank in the141			line.142 143							*zb*144zb			Like "z-", but leave the cursor in the same column.145 146==============================================================================1474. Scrolling horizontally				*scroll-horizontal*148 149For the following four commands the cursor follows the screen.  If the150character that the cursor is on is moved off the screen, the cursor is moved151to the closest character that is on the screen.  The value of 'sidescroll' is152not used.153 154z<Right>    or						*zl* *z<Right>*155zl			Move the view on the text [count] characters to the156			right, thus scroll the text [count] characters to the157			left.  This only works when 'wrap' is off.158 159z<Left>      or						*zh* *z<Left>*160zh			Move the view on the text [count] characters to the161			left, thus scroll the text [count] characters to the162			right.  This only works when 'wrap' is off.163 164							*zL*165zL			Move the view on the text half a screenwidth to the166			right, thus scroll the text half a screenwidth to the167			left.  This only works when 'wrap' is off.168 169							*zH*170zH			Move the view on the text half a screenwidth to the171			left, thus scroll the text half a screenwidth to the172			right.  This only works when 'wrap' is off.173 174For the following two commands the cursor is not moved in the text, only the175text scrolls on the screen.176 177							*zs*178zs			Scroll the text horizontally to position the cursor179			at the start (left side) of the screen.  This only180			works when 'wrap' is off.181 182							*ze*183ze			Scroll the text horizontally to position the cursor184			at the end (right side) of the screen.  This only185			works when 'wrap' is off.186 187==============================================================================1885. Scrolling synchronously				*scroll-binding*189 190Occasionally, it is desirable to bind two or more windows together such that191when one window is scrolled, the other windows are also scrolled.  In Vim,192windows can be given this behavior by setting the (window-specific)193'scrollbind' option.  When a window that has 'scrollbind' set is scrolled, all194other 'scrollbind' windows are scrolled the same amount, if possible.  The195behavior of 'scrollbind' can be modified by the 'scrollopt' option.196 197When using the scrollbars or the mouse wheel, the binding only happens when198scrolling the window with focus (where the cursor is).  You can use this to199avoid scroll-binding for a moment without resetting options.200 201When a window also has the 'diff' option set, the scroll-binding uses the202differences between the two buffers to synchronize the position precisely.203Otherwise the following method is used.204 205							*scrollbind-relative*206Each 'scrollbind' window keeps track of its "relative offset", which can be207thought of as the difference between the current window's vertical scroll208position and the other window's vertical scroll position.  When one of the209'scrollbind' windows is asked to vertically scroll past the beginning or end210limit of its text, the window no longer scrolls, but remembers how far past211the limit it wishes to be.  The window keeps this information so that it can212maintain the same relative offset, regardless of its being asked to scroll213past its buffer's limits.214 215However, if a 'scrollbind' window that has a relative offset that is past its216buffer's limits is given the cursor focus, the other 'scrollbind' windows must217jump to a location where the current window's relative offset is valid.  This218behavior can be changed by clearing the "jump" flag from the 'scrollopt'219option.220 221						*syncbind* *:syncbind* *:sync*222:syncbind		Force all 'scrollbind' windows to have the same223			relative offset.  I.e., when any of the 'scrollbind'224			windows is scrolled to the top of its buffer, all of225			the 'scrollbind' windows will also be at the top of226			their buffers.227 228							*scrollbind-quickadj*229The 'scrollbind' flag is meaningful when using keyboard commands to vertically230scroll a window, and is also meaningful when using the vertical scrollbar or231the mouse wheel in the window which has the cursor focus.  However, when using232the vertical scrollbar or the mouse wheel in a window which doesn't have the233cursor focus, 'scrollbind' is ignored.234This allows quick adjustment of the relative offset of 'scrollbind' windows.235 236==============================================================================2376. Scrolling with a mouse wheel				*scroll-mouse-wheel*238 239When your mouse has a scroll wheel, it should work with Vim in the GUI.  How240it works depends on your system.  It might also work in an xterm241|xterm-mouse-wheel|.  By default only vertical scroll wheels are supported,242but some GUIs also support horizontal scroll wheels.243 244On MS-Windows, if the scroll action causes input focus -problems, see245|intellimouse-wheel-problems|.246 247For Win32 and the X11 GUIs (Motif and GTK) scrolling the wheel generates key248presses <ScrollWheelUp>, <ScrollWheelDown>, <ScrollWheelLeft> and249<ScrollWheelRight>.  For example, if you push the scroll wheel upwards a250<ScrollWheelUp> key press is generated causing the window to scroll upwards251(while the text is actually moving downwards).  The default action for these252keys are:253    <ScrollWheelUp>	    scroll N lines up	        *<ScrollWheelUp>*254    <S-ScrollWheelUp>	    scroll one page up		*<S-ScrollWheelUp>*255    <C-ScrollWheelUp>	    scroll one page up		*<C-ScrollWheelUp>*256    <ScrollWheelDown>	    scroll N lines down	        *<ScrollWheelDown>*257    <S-ScrollWheelDown>	    scroll one page down	*<S-ScrollWheelDown>*258    <C-ScrollWheelDown>	    scroll one page down	*<C-ScrollWheelDown>*259    <ScrollWheelLeft>	    scroll N columns left	*<ScrollWheelLeft>*260    <S-ScrollWheelLeft>	    scroll one page left	*<S-ScrollWheelLeft>*261    <C-ScrollWheelLeft>	    scroll one page left	*<C-ScrollWheelLeft>*262    <ScrollWheelRight>	    scroll N columns right	*<ScrollWheelRight>*263    <S-ScrollWheelRight>    scroll one page right	*<S-ScrollWheelRight>*264    <C-ScrollWheelRight>    scroll one page right	*<C-ScrollWheelRight>*265This should work in all modes, except when editing the command line.266 267The value of N depends on the system.  By default Vim scrolls three lines when268moving vertically, and six columns when moving horizontally.  On MS-Windows269the amount of lines and columns for each scroll action is taken from the270system-wide settings.271 272Note that horizontal scrolling only works if 'nowrap' is set.  Also, unless273the "h" flag in 'guioptions' is set, the cursor moves to the longest visible274line if the cursor line is about to be scrolled off the screen (similarly to275how the horizontal scrollbar works).276 277You can modify the default behavior by mapping the keys.  For example, to make278the scroll wheel move one line or half a page in Normal mode: >279   :map <ScrollWheelUp> <C-Y>280   :map <S-ScrollWheelUp> <C-U>281   :map <ScrollWheelDown> <C-E>282   :map <S-ScrollWheelDown> <C-D>283You can also use Alt and Ctrl modifiers.284 285This only works when Vim gets the scroll wheel events, of course.  You can286check if this works with the "xev" program.287							*mouse-scrolling-off*288If you do not want the mouse to cause scrolling (e.g. because resting your289palm on the touchpad causes scroll events), you can disable that with: >290	:map <ScrollWheelDown> <Nop>291	:map! <ScrollWheelDown> <Nop>292	:map <ScrollWheelUp> <Nop>293	:map! <ScrollWheelUp> <Nop>294	:map <ScrollWheelLeft> <Nop>295	:map! <ScrollWheelLeft> <Nop>296	:map <ScrollWheelRight> <Nop>297	:map! <ScrollWheelRight> <Nop>298 299When using XFree86, the /etc/XF86Config file should have the correct entry for300your mouse.  For FreeBSD, this entry works for a Logitech scrollmouse: >301    Protocol     "MouseMan"302    Device       "/dev/psm0"303    ZAxisMapping 4 5304See the XFree86 documentation for information.305 306						*<MouseDown>* *<MouseUp>*307The keys <MouseDown> and <MouseUp> have been deprecated.  Use <ScrollWheelUp>308instead of <MouseDown> and use <ScrollWheelDown> instead of <MouseUp>.309 310							*xterm-mouse-wheel*311To use the mouse wheel in a new xterm you only have to make the scroll wheel312work in your Xserver, as mentioned above.313 314To use the mouse wheel in an older xterm you must do this:3151. Make it work in your Xserver, as mentioned above.3162. Add translations for the xterm, so that the xterm will pass a scroll event317   to Vim as an escape sequence.3183. Add mappings in Vim, to interpret the escape sequences as <ScrollWheelDown>319   or <ScrollWheelUp> keys.320 321You can do the translations by adding this to your ~.Xdefaults file (or other322file where your X resources are kept): >323 324  XTerm*VT100.Translations:		#override \n\325		s<Btn4Down>: string("0x9b") string("[64~") \n\326		s<Btn5Down>: string("0x9b") string("[65~") \n\327		<Btn4Down>: string("0x9b") string("[62~") \n\328		<Btn5Down>: string("0x9b") string("[63~") \n\329		<Btn4Up>: \n\330		<Btn5Up>:331 332Add these mappings to your vimrc file: >333	:map <M-Esc>[62~ <ScrollWheelUp>334	:map! <M-Esc>[62~ <ScrollWheelUp>335	:map <M-Esc>[63~ <ScrollWheelDown>336	:map! <M-Esc>[63~ <ScrollWheelDown>337	:map <M-Esc>[64~ <S-ScrollWheelUp>338	:map! <M-Esc>[64~ <S-ScrollWheelUp>339	:map <M-Esc>[65~ <S-ScrollWheelDown>340	:map! <M-Esc>[65~ <S-ScrollWheelDown>341<342 vim:tw=78:ts=8:noet:ft=help:norl:343 
codekingpro/portable-devtools · Team Ai