From 3a1bab3bfeadb8d00581bd319b0eb08e32175196 Mon Sep 17 00:00:00 2001 From: Von Welch Date: Thu, 31 Mar 2016 21:25:41 -0400 Subject: [PATCH] Use vim-scripts/scrarch instead of kana/vim-scratch --- plugin/key-bindings.vim | 2 +- plugin/scratch.vim | 10 +++++++++- vimrc | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/plugin/key-bindings.vim b/plugin/key-bindings.vim index b34a972..34973aa 100644 --- a/plugin/key-bindings.vim +++ b/plugin/key-bindings.vim @@ -62,7 +62,7 @@ nnoremap g :Unite grep:. :map R :redraw! " Open a scratch buffer with 's' -:map s :ScratchOpen +:map s :call ToggleScratch() " Run tig to do my git stuff " silent turns off request for enter when tig is done, that requires diff --git a/plugin/scratch.vim b/plugin/scratch.vim index 60a3ed7..44bea96 100644 --- a/plugin/scratch.vim +++ b/plugin/scratch.vim @@ -1,3 +1,11 @@ " Configuration related to scratch plugin -CommandCabbr scratch ScratchOpen +" Toggle scratch buffer (scratch.vim plugin) +" Kudos: http://blog.mojotech.com/a-veterans-vimrc/ +function! ToggleScratch() + if expand('%') == g:ScratchBufferName + quit + else + Sscratch + endif +endfunction diff --git a/vimrc b/vimrc index a2a79c3..2cbc8ec 100644 --- a/vimrc +++ b/vimrc @@ -84,9 +84,6 @@ NeoBundle 'ciaranm/securemodelines' let g:buffergator_suppress_keymaps=1 " Do this in key-bindings.vim NeoBundle 'jeetsukumaran/vim-buffergator' -" Open a scratch buffer with :ScratchOpen -NeoBundle 'kana/vim-scratch' - " Allows definiton of arbitrary objects (prereusite of following) NeoBundle 'kana/vim-textobj-user' " vim-textobj-entire adds text object of 'ae' for entire buffer @@ -153,6 +150,9 @@ NeoBundle 'tpope/vim-unimpaired' " Tweaks for netrw NeoBundle 'tpope/vim-vinegar' +" For :Scratch and Sscratch +NeoBundle 'vim-scripts/scratch.vim' + " Ring for yanked text NeoBundle 'vim-scripts/YankRing.vim'