I work in two broadly different ways in vim (that are relevant to this question):
I am writing text or markdown-formatted content, writing paragraphs of text. In this case I am generally writing new content, so it is most elegant for
sidescrolloff
to be set to 0, otherwise the window content jumps left when I near the end of a line.I am editing existing programming code (e.g. python), which may have line lengths longer than it 'should' have (e.g. longer than
textwidth
). In this case I don't want to reformat those lines - I want to work with them at the length they are. In this case it is more elegant ifsidescrolloff
is, for example, 20, so that when my cursor gets nearer the end of the window/line on the right I can see the text to the right more clearly.
Is there an elegant way to set the value of sidescrolloff
differently depending if I am appending at the end of a line versus in the middle of it (i.e. the middle of the content)? Or perhaps a way to set it depending if I am in insert mode or normal mode?
Alternatively, are there any other elegant solutions to my problem?
In both these cases I use textwidth=78
and nowrap
.