aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2019-06-09 19:45:27 +1200
committerTom Ryder <tom@sanctum.geek.nz>2019-06-09 19:45:27 +1200
commit83a97ede26b5c6e665862fc43a6d775aae68f44f (patch)
treebda7f521a5c9485b9f35e9acb05dd20129be2519
parentMove 'backspace' settings down a bit (diff)
downloaddotfiles-83a97ede26b5c6e665862fc43a6d775aae68f44f.tar.gz
dotfiles-83a97ede26b5c6e665862fc43a6d775aae68f44f.zip
Group together and document 'wrap'-related options
-rw-r--r--vim/vimrc26
1 files changed, 21 insertions, 5 deletions
diff --git a/vim/vimrc b/vim/vimrc
index 0bb6c8e9..7debeed9 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -354,12 +354,33 @@ set backspace+=eol " Line breaks
set backspace+=indent " Leading whitespace characters created by 'autoindent'
set backspace+=start " Text before the start of the current insertion
+" When soft-wrapping text with the 'wrap' option on, which is off by default,
+" break the lines between words, rather than within them; it's much easier to
+" read.
+"
+set linebreak
+
+" Similarly, show that the screen line is a trailing part of a wrapped line by
+" prefixing it with an ellipsis. If we have a multi-byte encoding, use U+2026
+" HORIZONTAL ELLIPSIS to save a couple of columns, but otherwise three periods
+" will do just fine.
+"
+if has('multi_byte_encoding')
+ set showbreak=…
+else
+ set showbreak=...
+endif
+
" The visual structure of code provided by indents breaks down if a lot of the
" lines wrap. Ideally, most if not all lines would be kept below 80
" characters, but in cases where this isn't possible, soft-wrapping longer
" lines when 'wrap' is on so that the indent is preserved in the following
" line mitigates this breakdown somewhat.
"
+" With this set, it's particularly important to have 'showbreak' set to
+" something, above, otherwise without line numbers it's hard to tell what's
+" a logical line and what's not.
+"
" This option wasn't added until v7.4.338, so we need to check it exists
" before we set it.
"
@@ -574,8 +595,6 @@ set laststatus=1
"
set lazyredraw
-" Break lines at word boundaries
-set linebreak
" Define extra 'list' display characters
set listchars&vi " Neovim adds duplicates otherwise
@@ -622,9 +641,6 @@ set sessionoptions-=options " No global options or mappings
" Don't show startup splash screen (I donated)
set shortmess+=I
-" Prefix wrapped rows with three dots
-set showbreak=...
-
" Don't try to syntax highlight run-on lines
set synmaxcol=500