Add template for plugins.

This commit is contained in:
Glenn Y. Rolland 2015-12-27 18:48:53 +01:00
parent 55c46da499
commit 14424b1138
14 changed files with 395 additions and 306 deletions

View file

@ -12,3 +12,8 @@ vimrc_users: []
vimrc_sys: vimrc_sys:
- "syntax on" - "syntax on"
vim_modeline: true
vim_modelines: 10
vim_syntax: true
vim_colorshell: true

View file

@ -1,4 +1,15 @@
--- ---
- file:
path: ~/.vim/ansible
state: directory
become: true
become_user: "{{item}}"
with_items: vimrc_users
#
# Solarized
#
- name: Install Solarized plugin - name: Install Solarized plugin
git: > git: >
repo=git://github.com/altercation/vim-colors-solarized.git repo=git://github.com/altercation/vim-colors-solarized.git
@ -9,6 +20,11 @@
become_user: "{{item}}" become_user: "{{item}}"
with_items: vimrc_users with_items: vimrc_users
#
# NERDTREE
#
- name: Install Nerdtree plugin - name: Install Nerdtree plugin
git: git:
repo=https://github.com/scrooloose/nerdtree.git repo=https://github.com/scrooloose/nerdtree.git
@ -19,6 +35,20 @@
become_user: "{{item}}" become_user: "{{item}}"
with_items: vimrc_users with_items: vimrc_users
- template:
src=templates/plugin.nerdtree.j2
dest=~/.vim/ansible/plugin.nerdtree
owner={{item}}
group={{item}}
mode=0644
become: true
become_user: "{{item}}"
with_items: vimrc_users
#
# AutoComplPop
#
- name: Install AutoComplPop plugin - name: Install AutoComplPop plugin
git: git:
@ -30,6 +60,9 @@
become_user: "{{item}}" become_user: "{{item}}"
with_items: vimrc_users with_items: vimrc_users
#
# Vim-fugitive
#
- name: Install vim-fugitive plugin - name: Install vim-fugitive plugin
git: git:
repo=https://github.com/tpope/vim-fugitive.git repo=https://github.com/tpope/vim-fugitive.git
@ -40,6 +73,17 @@
become_user: "{{item}}" become_user: "{{item}}"
with_items: vimrc_users with_items: vimrc_users
- template:
src=templates/plugin.fugitive.j2
dest=~/.vim/ansible/plugin.fugitive
owner={{item}}
group={{item}}
mode=0644
become: true
become_user: "{{item}}"
with_items: vimrc_users
#- name: Install CtrlP #- name: Install CtrlP
# git: # git:
# repo=https://github.com/kien/ctrlp.vim.git # repo=https://github.com/kien/ctrlp.vim.git
@ -130,30 +174,39 @@
become_user: "{{item}}" become_user: "{{item}}"
with_items: vimrc_users with_items: vimrc_users
- name: Install YouCompleteMe dependencies - name: Uninstall YouCompleteMe plugin
apt: file:
name="{{item}}" path: ~/.vim/bundle/YouCompleteMe
state=present state: absent
with_items: #recurse: yes
- python-dev
- build-essential
- cmake
- name: Fetch YouCompleteMe plugin
register: youcompleteme_git
git:
repo=https://github.com/Valloric/YouCompleteMe.git
dest=~/.vim/bundle/YouCompleteMe
update=yes
accept_hostkey=yes
become: true become: true
become_user: "{{item}}" become_user: "{{item}}"
with_items: vimrc_users with_items: vimrc_users
- name: Build YouCompleteMe plugin # - name: Install YouCompleteMe dependencies
shell: cd ~/.vim/bundle/YouCompleteMe ; ./install.sh # apt:
become: true # name="{{item}}"
become_user: "{{item}}" # state=present
with_items: vimrc_users # with_items:
when: youcompleteme_git.changed # - python-dev
# - build-essential
# - cmake
#
# - name: Fetch YouCompleteMe plugin
# register: youcompleteme_git
# git:
# repo=https://github.com/Valloric/YouCompleteMe.git
# dest=~/.vim/bundle/YouCompleteMe
# update=yes
# accept_hostkey=yes
# become: true
# become_user: "{{item}}"
# with_items: vimrc_users
#
# - name: Build YouCompleteMe plugin
# shell: cd ~/.vim/bundle/YouCompleteMe ; ./install.sh
# become: true
# become_user: "{{item}}"
# with_items: vimrc_users
# when: youcompleteme_git.changed

View file

@ -12,11 +12,12 @@
become_user: "{{item}}" become_user: "{{item}}"
with_items: vimrc_users with_items: vimrc_users
- lineinfile: > # - lineinfile: >
dest=~/.vimrc # dest=~/.vimrc
regexp=^execute.pathogen.infect # regexp=^execute.pathogen.infect
line="execute pathogen#infect()" # line="source ~/.vim/ansible/pathogen.vim"
insertbefore="{{vimrc_boundary_end_regexp}}" # insertbefore="{{vimrc_boundary_end_regexp}}"
become: true # become: true
become_user: "{{item}}" # become_user: "{{item}}"
with_items: vimrc_users # with_items: vimrc_users

View file

@ -1,18 +1,28 @@
- template:
- lineinfile: > src=templates/vimrc.j2
dest=~/.vimrc dest=~/.vimrc
regexp="{{vimrc_boundary_begin_regexp}}" owner={{item}}
line="{{vimrc_boundary_begin}}" group={{item}}
create=yes mode=0644
become: true become: true
become_user: "{{item}}" become_user: "{{item}}"
with_items: vimrc_users with_items: vimrc_users
- lineinfile: > # - lineinfile: >
dest=~/.vimrc # dest=~/.vimrc
regexp="{{vimrc_boundary_end_regexp}}" # regexp="{{vimrc_boundary_begin_regexp}}"
insertafter="{{vimrc_boundary_begin_regexp}}" # line="{{vimrc_boundary_begin}}"
line="{{vimrc_boundary_end}}" # create=yes
become: true # become: true
become_user: "{{item}}" # become_user: "{{item}}"
with_items: vimrc_users # with_items: vimrc_users
#
# - lineinfile: >
# dest=~/.vimrc
# regexp="{{vimrc_boundary_end_regexp}}"
# insertafter="{{vimrc_boundary_begin_regexp}}"
# line="{{vimrc_boundary_end}}"
# become: true
# become_user: "{{item}}"
# with_items: vimrc_users
#

9
templates/ft.mutt.j2 Normal file
View file

@ -0,0 +1,9 @@
autocmd BufRead,BufNewFile /tmp/mutt-* source $HOME/.vim/mutt.colors
autocmd BufRead mutt* syntax on
autocmd BufRead mutt* set ft=mail
autocmd BufRead mutt* set textwidth=72
autocmd BufRead mutt* set wrap

View file

@ -0,0 +1,38 @@
" ## added by OPAM user-setup for vim / base ## 8a3125e39f347f6b9a1b167d8e564281 ## you can edit, but keep this line
let s:opam_share_dir = system("opam config var share")
let s:opam_share_dir = substitute(s:opam_share_dir, '[\r\n]*$', '', '')
let s:opam_configuration = {}
function! OpamConfOcpIndent()
let l:file = s:opam_share_dir . "/vim/syntax/ocp-indent.vim"
execute "source " . l:file
endfunction
let s:opam_configuration['ocp-indent'] = function('OpamConfOcpIndent')
function! OpamConfOcpIndex()
let l:dir = s:opam_share_dir . "/ocp-index/vim"
execute "set rtp+=" . l:dir
endfunction
let s:opam_configuration['ocp-index'] = function('OpamConfOcpIndex')
function! OpamConfMerlin()
let l:dir = s:opam_share_dir . "/merlin/vim"
execute "set rtp+=" . l:dir
endfunction
let s:opam_configuration['merlin'] = function('OpamConfMerlin')
let s:opam_packages = ["ocp-indent", "ocp-index", "merlin"]
let s:opam_check_cmdline = ["opam list --installed --short --safe --color=never"] + s:opam_packages
let s:opam_available_tools = split(system(join(s:opam_check_cmdline, ' ')))
for tool in s:opam_available_tools
call s:opam_configuration[tool]()
endfor
" ## end of OPAM user-setup addition for vim / base ## keep this line
" Ocaml Type Annotation
nnoremap <F2> :MerlinTypeOf<CR>
nnoremap <F3> :MerlinTypeOf<CR>

2
templates/gui.j2 Normal file
View file

@ -0,0 +1,2 @@
set guifont=DejaVu\ Sans\ Mono\ 11

View file

@ -0,0 +1,7 @@
" Fugitive : set key mapping
nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gs :Gstatus<CR>
nnoremap <Leader>gd :Gdiff<Space>
nnoremap <Leader>gw :Gwrite<Space>

View file

@ -0,0 +1,19 @@
" 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 <Leader>nt :NERDTreeToggle<CR>
nnoremap <Leader>nf :NERDTreeFind<CR>

View file

@ -0,0 +1,9 @@
let g:pencil#wrapModeDefault = 'soft' " default is 'hard'
augroup pencil
autocmd!
autocmd FileType markdown,mkd call pencil#init()
autocmd FileType text call pencil#init()
augroup END

View file

@ -0,0 +1,8 @@
" Rails : set key mapping
nnoremap <Leader>rc :Rcontroller<CR>
nnoremap <Leader>rv :Rview <cword><CR>
nnoremap <Leader>rh :Rhelper <cword><CR>
nnoremap <Leader>rm :Rmodel<CR>
nnoremap <Leader>rs :Emodel<CR>

View file

@ -0,0 +1,9 @@
" RainbowParenthesesActivate
" autocmd VimEnter * RainbowParenthesesActivate
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces

180
templates/vimrc.j2 Normal file
View file

@ -0,0 +1,180 @@
" BEGIN Ansible glenux.vim -- DO NOT MODIFY
" vim: set ts=2 sw=2 et:
{% if vim_modeline %}
set modeline
set modelines={{vim_modelines}}
{% endif %}
{% if vim_syntax %}
syntax on
{%endif%}
{% if vim_colorshell %}
set t_Co=256
{%endif%}
":set nu
set backupdir=$HOME/tmp
set dir=$HOME/tmp
" Wild menu
set wildmenu
set wildmode=longest:list
" Redefine <Leader> key in vim
let mapleader = ","
set colorcolumn=80,120
nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>
"autocmd WinEnter * setlocal cursorline
"autocmd WinLeave * setlocal nocursorline
nmap <F4> :w<CR>:make<CR>:cw<CR>
" Make sure that your status line is always shown as the second last line in
" the editor window:
set laststatus=2
{% if vim_colorshell %}
" Folds
" =====
set foldmethod=indent " Fold based on indent
set foldnestmax=3 " Deepest fold is 3 levels
set nofoldenable " Don't fold by default
set foldcolumn=2
set foldmethod=marker
{%endif%}
" Spell check parameters
set spelllang=fr_FR
set spellfile=$HOME/.vim/spell/generic.fr.add
highlight SpellBad ctermfg=NONE ctermbg=NONE cterm=underline,bold
highlight SpellCap ctermfg=NONE ctermbg=NONE cterm=underline,bold
highlight SpellLocal ctermfg=NONE ctermbg=NONE cterm=underline,bold
highlight MatchParen cterm=bold ctermfg=NONE ctermbg=NONE
" Cursor management
" =================
" Number of visible lines to keep above/below the cursor
set scrolloff=3
" Show cursor position (line, col)
set ruler
set list
"set smarttab softtabstop=8 tabstop=8 shiftwidth=4 noexpandtab list
set listchars=tab:~.,trail:.,nbsp:<3A>
" Mouse parameters
" ================
" mouse parameters
set mouse=a
" send more characters for redraw
set ttyfast
" Set this to the name of your terminal that supports mouse codes.
" Must be one of: xterm, xterm2, netterm, dec, jsbterm, pterm
set ttymouse=xterm2
set nocompatible
call pathogen#infect()
" Disable views when using Rails plugin
"" autocmd BufWinLeave * silent! mkview
"" autocmd BufWinEnter * silent! loadview
"autocmd BufReadPost *
" \ if line("'\"") > 0 && line("'\"") <= line("$") |
" \ exe "normal g`\"" |
" \ endif
filetype plugin indent on
filetype plugin on
" Default text indent, tab, width
set noexpandtab copyindent preserveindent softtabstop=0 shiftwidth=4 tabstop=4
autocmd BufNewFile,BufRead *.t2t set ft=txt2tags
autocmd BufNewFile,BufRead *.md set ft=markdown
autocmd FileType css,scss,less set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType javascript set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType markdown set tabstop=4 shiftwidth=4 softtabstop=0 nosmarttab expandtab list textwidth=0
autocmd FileType haml set tabstop=2 shiftwidth=2 softtabstop=0 nosmarttab expandtab list textwidth=0
autocmd FileType xhtml,html set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType c set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType cpp set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType java set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType python set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab list textwidth=0
autocmd FileType ruby set tabstop=2 shiftwidth=2 softtabstop=0 smarttab expandtab nolist textwidth=0
autocmd FileType php set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType sh set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType make set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab list textwidth=0
autocmd FileType xsd,xml set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd BufNewFile,BufRead *
\ syntax match GNUX_TAGS /FIXME\s*:/ containedin=ALL contained |
\ syntax match GNUX_TAGS /TOREAD\s*:/ containedin=ALL contained |
\ highlight GNUX_TAGS ctermbg=darkred ctermfg=green
"autocmd FileType python source ~/.vim/scripts/python.vim
highlight Folded guibg=gray15 guifg=gray50
highlight TabLine term=none cterm=none
"highlight TabLineSel ctermbg=darkred
syntax match TAB_CHAR /^[ ]*/
"syntax match TAB_CHAR /\t/
highlight link TAB_CHAR Error
{% if false %}
"set cursorline
"highlight CursorLine term=reverse cterm=reverse
"
"au FileType haskell,vhdl,ada,ocaml let b:comment_leader = '-- '
"au FileType vim let b:comment_leader = '" '
"au FileType c,cpp,java let b:comment_leader = '// '
"au FileType sh,make let b:comment_leader = '# '
"au FileType tex let b:comment_leader = '% '
"noremap <silent> ,c :<C-B>sil <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:noh<CR>
"noremap <silent> ,u :<C-B>sil <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:noh<CR>
"set background=dark
"highlight PreProc ctermfg=5 cterm=bold "cyan
"highlight Comment ctermfg=9 "bright red
"highlight String ctermfg=7 "dark white
"highlight Normal guibg=Black guifg=White
{% endif %}
" Display settings
"set background=light
set background=dark
"let g:solarized_termcolors=256
colorscheme desert
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
" Buffer management : show buffer list & choose
nnoremap <F5> :buffers<CR>:buffer<Space>
" 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
" END Ansible glenux.vim

View file

@ -1,261 +0,0 @@
{% if vim_modeline %}
set modeline
set modelines={{vim_modelines}}
{% endif %}
{% if vim.syntax %}
syntax on
{%endif%}
set t_Co=256
":set nu
set backupdir=$HOME/tmp
set dir=$HOME/tmp
" Wild menu
set wildmenu
set wildmode=longest:list
" Redefine <Leader> key in vim
let mapleader = ","
set colorcolumn=80,120
nnoremap <Leader>c :set cursorline! cursorcolumn!<CR>
"autocmd WinEnter * setlocal cursorline
"autocmd WinLeave * setlocal nocursorline
nmap <F4> :w<CR>:make<CR>:cw<CR>
" Make sure that your status line is always shown as the second last line in
" the editor window:
set laststatus=2
" Folds
" =====
set foldmethod=indent " Fold based on indent
set foldnestmax=3 " Deepest fold is 3 levels
set nofoldenable " Don't fold by default
set foldcolumn=2
set foldmethod=marker
" Spell check parameters
set spelllang=fr_FR
set spellfile=$HOME/.vim/spell/generic.fr.add
highlight SpellBad ctermfg=NONE ctermbg=NONE cterm=underline,bold
highlight SpellCap ctermfg=NONE ctermbg=NONE cterm=underline,bold
highlight SpellLocal ctermfg=NONE ctermbg=NONE cterm=underline,bold
highlight MatchParen cterm=bold ctermfg=NONE ctermbg=NONE
" Number of visible lines to keep above/below the cursor
set scrolloff=3
" Show cursor position (line, col)
set ruler
set list
"set smarttab softtabstop=8 tabstop=8 shiftwidth=4 noexpandtab list
set listchars=tab:~.,trail:.,nbsp:<3A>
" Mouse parameters
" ================
" mouse parameters
set mouse=a
" send more characters for redraw
set ttyfast
" Set this to the name of your terminal that supports mouse codes.
" Must be one of: xterm, xterm2, netterm, dec, jsbterm, pterm
set ttymouse=xterm2
if !has("compatible")
call pathogen#infect()
" Disable views when using Rails plugin
"" autocmd BufWinLeave * silent! mkview
"" autocmd BufWinEnter * silent! loadview
"autocmd BufReadPost *
" \ if line("'\"") > 0 && line("'\"") <= line("$") |
" \ exe "normal g`\"" |
" \ endif
filetype plugin indent on
filetype plugin on
" Text indent, tab, width
set noexpandtab
set copyindent
set preserveindent
set softtabstop=0
set shiftwidth=4
set tabstop=4
autocmd BufRead mutt* syntax on
autocmd BufRead mutt* set ft=mail
autocmd BufRead mutt* set textwidth=72
autocmd BufRead mutt* set wrap
autocmd BufNewFile,BufRead *.t2t set ft=txt2tags
autocmd BufNewFile,BufRead *.md set ft=markdown
let g:pencil#wrapModeDefault = 'soft' " default is 'hard'
augroup pencil
autocmd!
autocmd FileType markdown,mkd call pencil#init()
autocmd FileType text call pencil#init()
augroup END
autocmd FileType css,scss,less set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType javascript set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType markdown set tabstop=4 shiftwidth=4 softtabstop=0 nosmarttab expandtab list textwidth=0
autocmd FileType haml set tabstop=2 shiftwidth=2 softtabstop=0 nosmarttab expandtab list textwidth=0
autocmd FileType xhtml,html set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType c set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType cpp set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType java set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType python set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab list textwidth=0
autocmd FileType ruby set tabstop=2 shiftwidth=2 softtabstop=0 smarttab expandtab nolist textwidth=0
autocmd FileType php set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType sh set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd FileType make set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab list textwidth=0
autocmd FileType xsd,xml set tabstop=4 shiftwidth=4 softtabstop=0 smarttab noexpandtab nolist textwidth=0
autocmd BufRead,BufNewFile /tmp/mutt-* source $HOME/.vim/mutt.colors
"autocmd FileType python set
"\ softtabstop=4
" \ autoindent
" \ smartindent
autocmd BufNewFile,BufRead *
\ syntax match GNUX_TAGS /FIXME\s*:/ containedin=ALL contained |
\ syntax match GNUX_TAGS /TOREAD\s*:/ containedin=ALL contained |
\ highlight GNUX_TAGS ctermbg=darkred ctermfg=green
endif
"autocmd FileType python source ~/.vim/scripts/python.vim
highlight Folded guibg=gray15 guifg=gray50
highlight TabLine term=none cterm=none
"highlight TabLineSel ctermbg=darkred
syntax match TAB_CHAR /^[ ]*/
"syntax match TAB_CHAR /\t/
highlight link TAB_CHAR Error
"set cursorline
"highlight CursorLine term=reverse cterm=reverse
"au FileType haskell,vhdl,ada,ocaml let b:comment_leader = '-- '
"au FileType vim let b:comment_leader = '" '
"au FileType c,cpp,java let b:comment_leader = '// '
"au FileType sh,make let b:comment_leader = '# '
"au FileType tex let b:comment_leader = '% '
"noremap <silent> ,c :<C-B>sil <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:noh<CR>
"noremap <silent> ,u :<C-B>sil <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:noh<CR>
"set background=dark
"highlight PreProc ctermfg=5 cterm=bold "cyan
"highlight Comment ctermfg=9 "bright red
"highlight String ctermfg=7 "dark white
"highlight Normal guibg=Black guifg=White
" Display settings
"set background=light
set background=dark
"let g:solarized_termcolors=256
colorscheme desert
set guifont=DejaVu\ Sans\ Mono\ 9
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
set guifont=DejaVu\ Sans\ Mono\ 11
" 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 <Leader>nt :NERDTreeToggle<CR>
nnoremap <Leader>nf :NERDTreeFind<CR>
" RainbowParenthesesActivate
" autocmd VimEnter * RainbowParenthesesActivate
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
" Fugitive : set key mapping
nnoremap <Leader>gb :Gblame<CR>
nnoremap <Leader>gs :Gstatus<CR>
nnoremap <Leader>gd :Gdiff<Space>
nnoremap <Leader>gw :Gwrite<Space>
" Rails : set key mapping
nnoremap <Leader>rc :Rcontroller<CR>
nnoremap <Leader>rv :Rview <cword><CR>
nnoremap <Leader>rh :Rhelper <cword><CR>
nnoremap <Leader>rm :Rmodel<CR>
nnoremap <Leader>rs :Emodel<CR>
" Buffer management : show buffer list & choose
nnoremap <F5> :buffers<CR>:buffer<Space>
" ## added by OPAM user-setup for vim / base ## 8a3125e39f347f6b9a1b167d8e564281 ## you can edit, but keep this line
let s:opam_share_dir = system("opam config var share")
let s:opam_share_dir = substitute(s:opam_share_dir, '[\r\n]*$', '', '')
let s:opam_configuration = {}
function! OpamConfOcpIndent()
let l:file = s:opam_share_dir . "/vim/syntax/ocp-indent.vim"
execute "source " . l:file
endfunction
let s:opam_configuration['ocp-indent'] = function('OpamConfOcpIndent')
function! OpamConfOcpIndex()
let l:dir = s:opam_share_dir . "/ocp-index/vim"
execute "set rtp+=" . l:dir
endfunction
let s:opam_configuration['ocp-index'] = function('OpamConfOcpIndex')
function! OpamConfMerlin()
let l:dir = s:opam_share_dir . "/merlin/vim"
execute "set rtp+=" . l:dir
endfunction
let s:opam_configuration['merlin'] = function('OpamConfMerlin')
let s:opam_packages = ["ocp-indent", "ocp-index", "merlin"]
let s:opam_check_cmdline = ["opam list --installed --short --safe --color=never"] + s:opam_packages
let s:opam_available_tools = split(system(join(s:opam_check_cmdline, ' ')))
for tool in s:opam_available_tools
call s:opam_configuration[tool]()
endfor
" ## end of OPAM user-setup addition for vim / base ## keep this line
" Ocaml Type Annotation
nnoremap <F2> :MerlinTypeOf<CR>
nnoremap <F3> :MerlinTypeOf<CR>