From b4b4076b50443ad820bd5723e193e9222a27c840 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Wed, 16 Dec 2020 23:54:26 -0800 Subject: [PATCH] Rename files and add init support --- vim/.vim/{plugin => init.d}/mappings.vim | 0 vim/.vim/plug.d/core.vim | 27 ++++++++++++++++++- vim/.vim/{UltiSnips => snips}/all.snippets | 0 vim/.vim/{UltiSnips => snips}/coffee.snippets | 0 vim/.vim/{UltiSnips => snips}/html.snippets | 0 .../{UltiSnips => snips}/javascript.snippets | 0 vim/.vim/{UltiSnips => snips}/php.snippets | 0 vim/.vim/{UltiSnips => snips}/python.snippets | 0 vim/.vim/{UltiSnips => snips}/scss.snippets | 0 vim/.vim/vimrc | 15 +++++++++++ vim/.vimrc | 7 ----- 11 files changed, 41 insertions(+), 8 deletions(-) rename vim/.vim/{plugin => init.d}/mappings.vim (100%) rename vim/.vim/{UltiSnips => snips}/all.snippets (100%) rename vim/.vim/{UltiSnips => snips}/coffee.snippets (100%) rename vim/.vim/{UltiSnips => snips}/html.snippets (100%) rename vim/.vim/{UltiSnips => snips}/javascript.snippets (100%) rename vim/.vim/{UltiSnips => snips}/php.snippets (100%) rename vim/.vim/{UltiSnips => snips}/python.snippets (100%) rename vim/.vim/{UltiSnips => snips}/scss.snippets (100%) create mode 100644 vim/.vim/vimrc delete mode 100644 vim/.vimrc diff --git a/vim/.vim/plugin/mappings.vim b/vim/.vim/init.d/mappings.vim similarity index 100% rename from vim/.vim/plugin/mappings.vim rename to vim/.vim/init.d/mappings.vim diff --git a/vim/.vim/plug.d/core.vim b/vim/.vim/plug.d/core.vim index a40fd55..34c86c7 100644 --- a/vim/.vim/plug.d/core.vim +++ b/vim/.vim/plug.d/core.vim @@ -1,3 +1,28 @@ -Plug 'SirVer/ultisnips', { 'tag': '3.2' } Plug 'editorconfig/editorconfig-vim', { 'tag': 'v1.1.1' } Plug 'tpope/vim-surround' + +" UltiSnips +Plug 'SirVer/ultisnips', { 'tag': '3.2' } +let g:UltiSnipsSnippetDirectories = [ 'UltiSnips', 'snips' ] + +" NerdTree +Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle', 'tag': '6.9.8' } + +" Close all open buffers on entering a window if the only +" buffer that's left is the NERDTree buffer +function! s:CloseIfOnlyNerdTreeLeft() + if exists("t:NERDTreeBufName") + if bufwinnr(t:NERDTreeBufName) != -1 + if winnr("$") == 1 + q + endif + endif + endif +endfunction + +let g:NERDTreeDirArrowExpandable = '▸' +let g:NERDTreeDirArrowCollapsible = '▾' +let NERDTreeDirArrows = 1 +let NERDTreeIgnore = [ '\.pyc$', '\.swp$' ] + +autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft() diff --git a/vim/.vim/UltiSnips/all.snippets b/vim/.vim/snips/all.snippets similarity index 100% rename from vim/.vim/UltiSnips/all.snippets rename to vim/.vim/snips/all.snippets diff --git a/vim/.vim/UltiSnips/coffee.snippets b/vim/.vim/snips/coffee.snippets similarity index 100% rename from vim/.vim/UltiSnips/coffee.snippets rename to vim/.vim/snips/coffee.snippets diff --git a/vim/.vim/UltiSnips/html.snippets b/vim/.vim/snips/html.snippets similarity index 100% rename from vim/.vim/UltiSnips/html.snippets rename to vim/.vim/snips/html.snippets diff --git a/vim/.vim/UltiSnips/javascript.snippets b/vim/.vim/snips/javascript.snippets similarity index 100% rename from vim/.vim/UltiSnips/javascript.snippets rename to vim/.vim/snips/javascript.snippets diff --git a/vim/.vim/UltiSnips/php.snippets b/vim/.vim/snips/php.snippets similarity index 100% rename from vim/.vim/UltiSnips/php.snippets rename to vim/.vim/snips/php.snippets diff --git a/vim/.vim/UltiSnips/python.snippets b/vim/.vim/snips/python.snippets similarity index 100% rename from vim/.vim/UltiSnips/python.snippets rename to vim/.vim/snips/python.snippets diff --git a/vim/.vim/UltiSnips/scss.snippets b/vim/.vim/snips/scss.snippets similarity index 100% rename from vim/.vim/UltiSnips/scss.snippets rename to vim/.vim/snips/scss.snippets diff --git a/vim/.vim/vimrc b/vim/.vim/vimrc new file mode 100644 index 0000000..c7ca572 --- /dev/null +++ b/vim/.vim/vimrc @@ -0,0 +1,15 @@ +" Load from init.d instead of plugin directory. This is done so a leader key +" can be set before loading plugin settings. This allows the plugin setting +" files to set mappings with leader keys +for f in split(glob('~/.vim/init.d/*.vim'), '\n') + exe 'source' f +endfor + +" The plugged plugin manager function calls need to be called between the +" plug#begin and plug#end. Because of that, using the normal plugin directory +" loading won't work. +call plug#begin('~/.vim/plugged') +for f in split(glob('~/.vim/plug.d/*.vim'), '\n') + exe 'source' f +endfor +call plug#end() diff --git a/vim/.vimrc b/vim/.vimrc deleted file mode 100644 index c09e4af..0000000 --- a/vim/.vimrc +++ /dev/null @@ -1,7 +0,0 @@ -call plug#begin('~/.vim/plugged') - -for f in split(glob('~/.vim/plug.d/*.vim'), '\n') - exe 'source' f -endfor - -call plug#end()