From 7e5afc2000e3bc6d6c218ec832f4063f90b49b2a Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 30 Oct 2017 22:01:41 +1300 Subject: 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. --- vim/config/wrap.vim | 16 ++++++++-------- 1 file 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 w :set wrap! +nnoremap w :setlocal wrap! " 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 -- cgit v1.2.3