commit 1ce25bb21ec74ea28d6f4b8b3c043321a361f939 parent 50726fa81d3b10a86983e933ba271ec2fbefd3a1 Author: Antoine Amarilli <a3nm@a3nm.net> Date: Sun, 28 May 2017 21:43:05 +0200 add binding to disable reflow Diffstat:
vim/vimrc | | | 32 | ++++++++++++++++++++++++++++++++ |
1 file changed, 32 insertions(+), 0 deletions(-)
diff --git a/vim/vimrc b/vim/vimrc @@ -145,3 +145,35 @@ set hlsearch map gf :e <cfile><cr> + +noremap <silent> <Leader>w :call ToggleWrap()<CR> +function ToggleWrap() + if &tw + echo "Wrap ON" + setlocal tw=0 + setlocal linebreak nolist + setlocal display+=lastline + noremap <buffer> <silent> <Up> gk + noremap <buffer> <silent> k gk + noremap <buffer> <silent> <Down> gj + noremap <buffer> <silent> j gj + noremap <buffer> <silent> <Home> g<Home> + noremap <buffer> <silent> 0 g0 + noremap <buffer> <silent> ^ g^ + noremap <buffer> <silent> <End> g<End> + noremap <buffer> <silent> $ g$ + else + echo "Wrap OFF" + setlocal tw=80 + silent! nunmap <buffer> <Up> + silent! nunmap <buffer> <Down> + silent! nunmap <buffer> <Home> + silent! nunmap <buffer> <End> + silent! nunmap <buffer> j + silent! nunmap <buffer> k + silent! nunmap <buffer> ^ + silent! nunmap <buffer> 0 + silent! nunmap <buffer> $ + endif +endfunction +