From 7e9f3763aa61c5f5846f9c9a3b59706f4d6253be Mon Sep 17 00:00:00 2001 From: Alexander Karle Date: Thu, 3 May 2018 17:11:37 -0400 Subject: [PATCH] Second Vimscript function! Simple toggle setting --- vim/vimrc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/vim/vimrc b/vim/vimrc index 7329d6f..f6114c8 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -213,6 +213,14 @@ function! CMDPreserve(command) abort let @/=_s call cursor(l, c) endfunction + +function! ToggleColorColumn() abort + if &colorcolumn == "" + set colorcolumn=80 + else + set colorcolumn="" + endif +endfunction " }}} " KEY MAPPINGS {{{ @@ -237,9 +245,12 @@ nnoremap :call CMDPreserve("%s/\\s\\+$//e") " edit in current buffer dir nnoremap e :e %:h/ nnoremap v :vsp %:h/ -nnoremap s :vsp %:h/ +nnoremap s :sp %:h/ " quick toggle for light/dark background nnoremap L :set background=light nnoremap D :set background=dark + +" toggle color column (to ensure short lines) +nnoremap C :call ToggleColorColumn() " }}} -- libgit2 0.28.4