From 676378ca4547c31af7594bae86ad4873c1878813 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 13 Mar 2018 16:49:25 -0400 Subject: [PATCH] Don't both checking for autocmd --- vim/config/settings.vim | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/vim/config/settings.vim b/vim/config/settings.vim index 07624d6..271c6d8 100644 --- a/vim/config/settings.vim +++ b/vim/config/settings.vim @@ -110,32 +110,30 @@ set directory=$HOME/.vim/swap,.,/var/tmp,/tmp "FUNCTIONS: {{{ - if has('autocmd') - "enable the auto-creation of missing folders in a save path - 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') + "enable the auto-creation of missing folders in a save path + 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 + if !isdirectory(dirpath) + call mkdir(dirpath,'p') endif - endfunction + endif + endfunction - augroup WriteDir - autocmd! - autocmd BufWritePre * :call s:MakeNewDir(expand(''),+expand('')) - augroup END - endif - - "update the current filetype when a file is renamed - augroup RenameCheckFiletype + augroup WriteDir autocmd! - autocmd BufFilePost * filetype detect + autocmd BufWritePre * :call s:MakeNewDir(expand(''),+expand('')) augroup END endif + "update the current filetype when a file is renamed + augroup RenameCheckFiletype + autocmd! + autocmd BufFilePost * filetype detect + augroup END + "functions to create a split using 33% and 66% of the height function s:SPResize33() sp|wincmd =|q