From 5f64be2ad0c24d065a213a79323f20d723d3870f Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Thu, 24 Jul 2014 00:51:58 -0400 Subject: [PATCH] Added function check to MakeNewDir to avoid complaints when reloading settings.vim, and played with key timeout settings to see if I can fix a strange error where the arrow keys suddenly stop working. --- vim/config/settings.vim | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/vim/config/settings.vim b/vim/config/settings.vim index 02285a3..ed16488 100644 --- a/vim/config/settings.vim +++ b/vim/config/settings.vim @@ -82,18 +82,21 @@ set whichwrap=b,s,<,>,[,] "scrolling left/right off current line wraps to the next/previous set smarttab expandtab autoindent tabstop=4 shiftwidth=4 "configure tabs set hlsearch incsearch ignorecase smartcase "configure how search behaves - set timeoutlen=500 ttimeoutlen=0 "shorten the timeout length of escapes + set timeout timeoutlen=1000 "how long before timing out for mappings + set ttimeout ttimeoutlen=100 "how long before timing out for terminal key codes "enable the auto-creation of missing folders in a save path - function s:MakeNewDir(fullpath, buf) - if empty(getbufvar(a:buf,'&buftype')) && a:fullpath!~#'\v^\w+\:\/' - let dirpath=fnamemodify(a:fullpath,':h') - if !isdirectory(dirpath)|call mkdir(dirpath,'p')|endif - endif - endfunction - augroup WriteDir - autocmd! - autocmd BufWritePre * :call s:MakeNewDir(expand(''),+expand('')) - augroup END + if !exists('*s:MakeNewDir') + function s:MakeNewDir(fullpath, buf) + if empty(getbufvar(a:buf,'&buftype')) && a:fullpath!~#'\v^\w+\:\/' + let dirpath=fnamemodify(a:fullpath,':h') + if !isdirectory(dirpath)|call mkdir(dirpath,'p')|endif + endif + endfunction + augroup WriteDir + autocmd! + autocmd BufWritePre * :call s:MakeNewDir(expand(''),+expand('')) + augroup END + endif "}}} "}}}