Always display the first few lines of a buffer in Vim
You could open the file in two windows (command line: vim -o file file
, or ctrl+w n :o file
) and then one is fixed and you can scroll in the other window.
If you want to see the first 5 rows press ctrl+w 5 _
.
If you're working with datatables alot, you might want to take a look at the csv plugin. it has the :HeaderToggle
command that does exactly what you want, and many more commands that you might find useful.
In this case it is convenient to use the preview window (see
:help preview-window
). To open the preview window showing the first, say,
eight lines of the current file, issue the following commands.
:set previewheight=8
:pedit +1
Use the :pclose
command (:pc
, for short)
or the Ctrl+W, Z shortcut
to close the preview window.