In an expression, &scrolloff refers to the value of the 'scrolloff' option. :nnoremap zz :let &scrolloff=999-&scrolloff With the following in your vimrc, and assuming the default backslash leader key, you can type \zz to toggle the value of 'scrolloff' between 0 and 999: If you change 'scrolloff' frequently, you may want to use a mapping. Setting 'scrolloff' to a large value causes the cursor to stay in the middle line when possible: Entering :set so=0 restores the default behavior so the cursor can be moved to any line in the window without scrolling. The above command can be abbreviated as :set so=5. The following command scrolls the text so that (when possible) there are always at least five lines visible above the cursor, and five lines visible below the cursor: The 'scrolloff' (scroll offset) option determines the number of context lines you would like to see above and below the cursor.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |