From f2c70b222c17c48d6247ca4de1895f0213f69894 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sun, 27 Dec 2015 19:45:10 +0100 Subject: [PATCH] Install plugin-specific configuration files. --- tasks/pathogen-plugins.yml | 64 +++++++++++++++++-- tasks/pathogen.yml | 2 +- templates/{ft.mutt.j2 => ft.mutt.vim.j2} | 0 ...{ft.ocaml-opam.j2 => ft.ocaml-opam.vim.j2} | 0 templates/{gui.j2 => gui.vim.j2} | 0 ...gin.fugitive.j2 => plugin.fugitive.vim.j2} | 0 templates/plugin.nerdtree.j2 | 19 ------ templates/plugin.nerdtree.vim.j2 | 26 ++++++++ ...{plugin.pencil.j2 => plugin.pencil.vim.j2} | 5 +- .../{plugin.rails.j2 => plugin.rails.vim.j2} | 0 ...s.j2 => plugin.rainbow-parentheses.vim.j2} | 0 templates/vimrc.j2 | 9 +-- 12 files changed, 93 insertions(+), 32 deletions(-) rename templates/{ft.mutt.j2 => ft.mutt.vim.j2} (100%) rename templates/{ft.ocaml-opam.j2 => ft.ocaml-opam.vim.j2} (100%) rename templates/{gui.j2 => gui.vim.j2} (100%) rename templates/{plugin.fugitive.j2 => plugin.fugitive.vim.j2} (100%) delete mode 100644 templates/plugin.nerdtree.j2 create mode 100644 templates/plugin.nerdtree.vim.j2 rename templates/{plugin.pencil.j2 => plugin.pencil.vim.j2} (65%) rename templates/{plugin.rails.j2 => plugin.rails.vim.j2} (100%) rename templates/{plugin.rainbow-parentheses.j2 => plugin.rainbow-parentheses.vim.j2} (100%) diff --git a/tasks/pathogen-plugins.yml b/tasks/pathogen-plugins.yml index 82a423c..21f312b 100644 --- a/tasks/pathogen-plugins.yml +++ b/tasks/pathogen-plugins.yml @@ -22,7 +22,7 @@ # -# NERDTREE +# NERDTree # - name: Install Nerdtree plugin @@ -36,8 +36,8 @@ with_items: vimrc_users - template: - src=templates/plugin.nerdtree.j2 - dest=~/.vim/ansible/plugin.nerdtree + src=templates/plugin.nerdtree.vim.j2 + dest=~/.vim/ansible/plugin.nerdtree.vim owner={{item}} group={{item}} mode=0644 @@ -74,8 +74,8 @@ with_items: vimrc_users - template: - src=templates/plugin.fugitive.j2 - dest=~/.vim/ansible/plugin.fugitive + src=templates/plugin.fugitive.vim.j2 + dest=~/.vim/ansible/plugin.fugitive.vim owner={{item}} group={{item}} mode=0644 @@ -93,6 +93,9 @@ # become: true # become_user: "{{vim_user}}" +# +# Rainbow parentheses: +# - name: Install rainbow_parentheses plugin git: repo=https://github.com/kien/rainbow_parentheses.vim.git @@ -103,6 +106,20 @@ become_user: "{{item}}" with_items: vimrc_users +- template: + src=templates/plugin.rainbow-parentheses.vim.j2 + dest=~/.vim/ansible/plugin.rainbow-parentheses.vim + owner={{item}} + group={{item}} + mode=0644 + become: true + become_user: "{{item}}" + with_items: vimrc_users + + +# +# Syntastic: ... +# - name: Install syntastic plugin git: repo=https://github.com/scrooloose/syntastic.git @@ -134,6 +151,10 @@ become_user: "{{item}}" with_items: vimrc_users +# +# Javascript +# + - name: Install vim-javascript plugin git: repo=https://github.com/pangloss/vim-javascript.git @@ -154,6 +175,9 @@ become_user: "{{item}}" with_items: vimrc_users +# +# Rails +# - name: Install vim-rails plugin git: repo=https://github.com/tpope/vim-rails.git @@ -164,6 +188,19 @@ become_user: "{{item}}" with_items: vimrc_users +- template: + src=templates/plugin.rails.vim.j2 + dest=~/.vim/ansible/plugin.rails.vim + owner={{item}} + group={{item}} + mode=0644 + become: true + become_user: "{{item}}" + with_items: vimrc_users + +# +# vim-sensible: a universal set of defaults that (hopefully) everyone can agree on +# - name: Install vim-sensible plugin git: repo=https://github.com/tpope/vim-sensible.git @@ -174,6 +211,23 @@ become_user: "{{item}}" with_items: vimrc_users +# +# vim-pencil: rethinking Vim as a tool for writing +# +- name: Install vim-pencil plugin + git: + repo=https://github.com/reedes/vim-pencil.git + dest=~/.vim/bundle/vim-pencil + update=yes + accept_hostkey=yes + become: true + become_user: "{{item}}" + with_items: vimrc_users + + +# +# YouCompleteMe +# - name: Uninstall YouCompleteMe plugin file: path: ~/.vim/bundle/YouCompleteMe diff --git a/tasks/pathogen.yml b/tasks/pathogen.yml index ca74d5a..5e27427 100644 --- a/tasks/pathogen.yml +++ b/tasks/pathogen.yml @@ -7,7 +7,7 @@ become_user: "{{item[1]}}" with_nested: - [ '~/.vim/autoload', '~/.vim/bundle' ] - - users + - vimrc_users - name: Install Pathogen get_url: > diff --git a/templates/ft.mutt.j2 b/templates/ft.mutt.vim.j2 similarity index 100% rename from templates/ft.mutt.j2 rename to templates/ft.mutt.vim.j2 diff --git a/templates/ft.ocaml-opam.j2 b/templates/ft.ocaml-opam.vim.j2 similarity index 100% rename from templates/ft.ocaml-opam.j2 rename to templates/ft.ocaml-opam.vim.j2 diff --git a/templates/gui.j2 b/templates/gui.vim.j2 similarity index 100% rename from templates/gui.j2 rename to templates/gui.vim.j2 diff --git a/templates/plugin.fugitive.j2 b/templates/plugin.fugitive.vim.j2 similarity index 100% rename from templates/plugin.fugitive.j2 rename to templates/plugin.fugitive.vim.j2 diff --git a/templates/plugin.nerdtree.j2 b/templates/plugin.nerdtree.j2 deleted file mode 100644 index ca1bba8..0000000 --- a/templates/plugin.nerdtree.j2 +++ /dev/null @@ -1,19 +0,0 @@ -" NERDTree : Set NERDTree position -let NERDTreeWinPos="left" - -" NERDTree : Use as expected with mouse, (dir => single clic, file => double clic) -let NERDTreeMouseMode=2 - -" NERDTree : Run at startup -autocmd vimenter * NERDTree - -" NERDTree : Force focus to right buffer -autocmd vimenter * wincmd p - -" NERDTree : automatically close if it is the last window remaining -autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif - -" NERDTree : map to ,nt -nnoremap nt :NERDTreeToggle -nnoremap nf :NERDTreeFind - diff --git a/templates/plugin.nerdtree.vim.j2 b/templates/plugin.nerdtree.vim.j2 new file mode 100644 index 0000000..e4a6b18 --- /dev/null +++ b/templates/plugin.nerdtree.vim.j2 @@ -0,0 +1,26 @@ +" NERDTree +" ======== + +" Open a NERDTree automatically when vim starts up? +autocmd vimenter * NERDTree + +" open a NERDTree automatically when vim starts up if no files were specified? +autocmd StdinReadPre * let s:std_in=1 +autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif + +" Set NERDTree position +let NERDTreeWinPos="left" + +" Use as expected with mouse, (dir => single clic, file => double clic) +let NERDTreeMouseMode=2 + +" Force focus to right buffer +autocmd vimenter * wincmd p + +" Close vim if the only window left open is a NERDTree? +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + +" Add shortcuts +nnoremap nt :NERDTreeToggle +nnoremap nf :NERDTreeFind + diff --git a/templates/plugin.pencil.j2 b/templates/plugin.pencil.vim.j2 similarity index 65% rename from templates/plugin.pencil.j2 rename to templates/plugin.pencil.vim.j2 index 71287d0..74a5137 100644 --- a/templates/plugin.pencil.j2 +++ b/templates/plugin.pencil.vim.j2 @@ -1,9 +1,12 @@ +" Vim-Pencil +" ========== + let g:pencil#wrapModeDefault = 'soft' " default is 'hard' augroup pencil autocmd! autocmd FileType markdown,mkd call pencil#init() - autocmd FileType text call pencil#init() +" autocmd FileType text call pencil#init() augroup END diff --git a/templates/plugin.rails.j2 b/templates/plugin.rails.vim.j2 similarity index 100% rename from templates/plugin.rails.j2 rename to templates/plugin.rails.vim.j2 diff --git a/templates/plugin.rainbow-parentheses.j2 b/templates/plugin.rainbow-parentheses.vim.j2 similarity index 100% rename from templates/plugin.rainbow-parentheses.j2 rename to templates/plugin.rainbow-parentheses.vim.j2 diff --git a/templates/vimrc.j2 b/templates/vimrc.j2 index ec6f590..a5de6b3 100644 --- a/templates/vimrc.j2 +++ b/templates/vimrc.j2 @@ -169,12 +169,9 @@ hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=whi nnoremap :buffers:buffer " Plugin-specific configuration -if filereadable($HOME . '/.vim/ansible/plugin.fugitive') - source ~/.vim/ansible/plugin.fugitive -endif -if filereadable($HOME . '/.vim/ansible/plugin.nerdtree') - source ~/.vim/ansible/plugin.nerdtree -endif +for f in split(glob('~/.vim/ansible/*.vim'), '\n') + exe 'source' f +endfor " END Ansible glenux.vim