diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-30 21:57:26 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-10-30 21:57:26 +1300 |
commit | 49143bd2b4934c983b55e22141ff4dc88eb31bfb (patch) | |
tree | 997a9fb2002ace742f08f72dedaabac61015641c | |
parent | Refactor min.awk to match max.awk (diff) | |
download | dotfiles-49143bd2b4934c983b55e22141ff4dc88eb31bfb.tar.gz dotfiles-49143bd2b4934c983b55e22141ff4dc88eb31bfb.zip |
Move linebreak Vim config into wrap config subfile
'linebreak', 'showbreak', 'breakindent', and 'breakindent' are only
relevant when 'wrap' is on, so it makes sense for their settings to be
grouped together.
-rw-r--r-- | vim/config/linebreak.vim | 31 | ||||
-rw-r--r-- | vim/config/wrap.vim | 32 |
2 files changed, 32 insertions, 31 deletions
diff --git a/vim/config/linebreak.vim b/vim/config/linebreak.vim deleted file mode 100644 index 0c358955..00000000 --- a/vim/config/linebreak.vim +++ /dev/null @@ -1,31 +0,0 @@ -" Break lines at word boundaries if possible and not simply at the last -" character that will fit on the screen, preceding the next line with three -" periods to make it obvious that it's a continuation of the previous line -if has('linebreak') - set linebreak - set showbreak=... - if v:version > 704 || v:version ==# 704 && has('patch338') - set breakindent - endif - - " Bind \b to turn off linebreak and toggle the showbreak characters on and - " off for convenience of copypasting multiple lines from terminal emulators. - if has('eval') - function! s:ToggleBreak() - if &linebreak - set nolinebreak - set showbreak= - if v:version > 704 || v:version ==# 704 && has('patch338') - set nobreakindent - endif - else - set linebreak - set showbreak=... - if v:version > 704 || v:version ==# 704 && has('patch338') - set breakindent - endif - endif - endfunction - nnoremap <silent> <leader>b :<C-U>call <SID>ToggleBreak()<CR> - endif -endif diff --git a/vim/config/wrap.vim b/vim/config/wrap.vim index 1316e12e..eb70751e 100644 --- a/vim/config/wrap.vim +++ b/vim/config/wrap.vim @@ -13,3 +13,35 @@ nnoremap <leader>w :set wrap!<CR> " line anyway if you need to nnoremap j gj nnoremap k gk + +" Break lines at word boundaries if possible and not simply at the last +" character that will fit on the screen, preceding the next line with three +" periods to make it obvious that it's a continuation of the previous line +if has('linebreak') + set linebreak + set showbreak=... + if v:version > 704 || v:version ==# 704 && has('patch338') + set breakindent + endif + + " Bind \b to turn off linebreak and toggle the showbreak characters on and + " off for convenience of copypasting multiple lines from terminal emulators. + if has('eval') + function! s:ToggleBreak() + if &linebreak + set nolinebreak + set showbreak= + if v:version > 704 || v:version ==# 704 && has('patch338') + set nobreakindent + endif + else + set linebreak + set showbreak=... + if v:version > 704 || v:version ==# 704 && has('patch338') + set breakindent + endif + endif + endfunction + nnoremap <silent> <leader>b :<C-U>call <SID>ToggleBreak()<CR> + endif +endif |