How do I control the exact indentation amount for continuation lines when text wrapping is enabled?
:set breakindentopt=shift:2
When breakindent is enabled, wrapped continuation lines are indented to match the start of their logical line.
:set breakindentopt=shift:2
When breakindent is enabled, wrapped continuation lines are indented to match the start of their logical line.
g0
When wrap is on, a long buffer line can span multiple screen (display) lines.
navigation #navigation #motions #wrap #display-lines #normal-mode
:set display+=lastline,truncate
By default, when a line is too long to fit in the window, Vim fills the remaining rows with @ characters to indicate the line continues off-screen.
g$
The g$ command moves the cursor to the last character of the current screen line, not the end of the logical line.
:set display=lastline
By default, when the last visible line of a window is too long to fit on screen, Vim shows @@@ in its place — hiding the content entirely.
:set smoothscroll
The smoothscroll option makes scroll commands respect screen rows rather than buffer lines when wrap is enabled.
S) with vim-surround
With the vim-surround plugin, select text visually and press S) to wrap with parentheses.
gq in visual mode
Select text with v or V, then press gq to format the selection according to textwidth.
set wrap linebreak breakindent
Use wrap to wrap long lines, linebreak to break at word boundaries (not mid-word), and breakindent to preserve indentation on wrapped lines.
qaciWmyFunc(<C-r>")<Esc>q
Record a macro that changes the inner word, types the function name with opening paren, pastes the original word from the register, and closes the paren.