aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-30 22:01:41 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-30 22:22:39 +1300
commit7e5afc2000e3bc6d6c218ec832f4063f90b49b2a (patch)
tree7a8f2bd246a1a480e1c97051e1928f7fe020c200
parentMove linebreak Vim config into wrap config subfile (diff)
downloaddotfiles-7e5afc2000e3bc6d6c218ec832f4063f90b49b2a.tar.gz
dotfiles-7e5afc2000e3bc6d6c218ec832f4063f90b49b2a.zip
Toggle 'wrap' and related Vim options locally
Don't change the value of these options for all buffers with the \w and \b maps, just the current one.
-rw-r--r--vim/config/wrap.vim16
1 files changed, 8 insertions, 8 deletions
diff --git a/vim/config/wrap.vim b/vim/config/wrap.vim
index eb70751e..e8caff66 100644
--- a/vim/config/wrap.vim
+++ b/vim/config/wrap.vim
@@ -5,7 +5,7 @@ set display=lastline
" Don't wrap by default, but use \w to toggle it on or off quickly
set nowrap
-nnoremap <leader>w :set wrap!<CR>
+nnoremap <leader>w :setlocal wrap!<CR>
" When wrapping, j and k should move by screen row, and not to the same
" column number in the previous logical line, which feels very clumsy and is
@@ -28,17 +28,17 @@ if has('linebreak')
" off for convenience of copypasting multiple lines from terminal emulators.
if has('eval')
function! s:ToggleBreak()
- if &linebreak
- set nolinebreak
- set showbreak=
+ if &l:linebreak
+ setlocal nolinebreak
+ setlocal showbreak=
if v:version > 704 || v:version ==# 704 && has('patch338')
- set nobreakindent
+ setlocal nobreakindent
endif
else
- set linebreak
- set showbreak=...
+ setlocal linebreak
+ setlocal showbreak=...
if v:version > 704 || v:version ==# 704 && has('patch338')
- set breakindent
+ setlocal breakindent
endif
endif
endfunction