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()