2

This is better shown than explained. The first image shows how line wrapping works in VScode, and the second in vim.

VScode vim

In VScode the wrapped line continues at the indentation level of the line, rather than at the beginning of the document, however this is not the case in vim. For some tasks, the VScode way of wrapping is much cleaner.

Is there any way to get this functionality in vim?

2

Yes, see :h breakindent:

'breakindent' 'bri' boolean (default off)
            local to window
            {not available when compiled without the |+linebreak|
            feature}
    Every wrapped line will continue visually indented (same amount of
    space as the beginning of that line), thus preserving horizontal blocks
    of text.

And also :h breakindentopt. I use set breakindentopt=sbr and it places showbreak symbol to first column.

enter image description here

For list items it wouldn't indent wrapped lines to be under the text, though. And actually, your vscode example does the same.

| improve this answer | |
  • Thank you, this is what I was looking for. The list items was just an example, i actually prefer the more general functionality – Jorge Romeu Apr 10 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.