[[plugins]]
repo = 'MattesGroeger/vim-bookmarks'
hook_add = '''
let g:bookmark_no_default_key_mappings = 1
nmap mm <Plug>BookmarkToggle
nmap mx <Plug>BookmarkClearAll
nmap mf <Cmd>FzfPreviewBookmarksRpc<CR>

let g:bookmark_save_per_working_dir = 1
call mkdir('/tmp/bookmarks', 'p')
function! BMWorkDirFileLocation() abort
  let root = system('git rev-parse --show-toplevel')
  if v:shell_error
    let root = getcwd()
  endif
  let root = substitute(root, '/', '@', 'g')
  return '/tmp/bookmarks/' .. root
endfunction
'''

[[plugins]]
repo = 'Shougo/dein.vim'
merged = 0

[[plugins]]
repo = 'Shougo/junkfile.vim'
hook_add = '''
let g:junkfile#directory = '/data/code/junkfile'
'''

[[plugins]]
repo = 'c000/rapidfire.vim'
hook_add = '''
function! s:rapidfire_search_config() abort
  let file = findfile('.rapidfire', '.;')
  if empty(file)
    let g:rapidfire#persistent_filename = '~/.vim/.rapidfire'
  else
    let g:rapidfire#persistent_filename = readfile(file)[0]
  endif
endfunction
call s:rapidfire_search_config()
'''

[[plugins]]
repo = 'hrsh7th/vim-vsnip'
hook_add = '''
" imap <Tab> <Plug>(vsnip-expand-or-jump)
let g:vsnip_snippet_dir = $HOME .. "/.vim/snippets"
'''

[[plugins]]
repo = 'junegunn/fzf'

[[plugins]]
repo = 'kana/vim-textobj-entire'

[[plugins]]
repo = 'kana/vim-textobj-line'

[[plugins]]
repo = 'kana/vim-textobj-user'

[[plugins]]
repo = 'kuuote/vim-fuzzyhistory'
hook_add = '''
nmap <C-f> <Plug>(fuzzy-history)
'''

[[plugins]]
repo = 'lambdalisue/fern.vim'

[[plugins]]
repo = 'lambdalisue/gina.vim'
hook_source = '''
call gina#custom#mapping#nmap(
      \ 'status', ',c',
      \ ':<C-u>Gina commit -v --opener=tabedit<CR>',
      \ {'noremap': 1, 'nowait': 1, 'silent': 1},
      \)
if dein#tap('ddc.vim')
  call ddc#custom#patch_filetype('gina-commit', 'specialBufferCompletion', v:true)
endif
'''

[[plugins]]
repo = 'lambdalisue/mr-quickfix.vim'

[[plugins]]
repo = 'lambdalisue/mr.vim'

[[plugins]]
repo = 'lambdalisue/suda.vim'

[[plugins]]
repo = 'machakann/vim-sandwich'

[[plugins]]
repo = 'mattn/vim-sonictemplate'
hook_add = '''
let g:sonictemplate_vim_template_dir = $HOME .. '/.vim/template'
'''

[[plugins]]
repo = 'thinca/vim-localrc'

[[plugins]]
repo = 'thinca/vim-qfreplace'

[[plugins]]
repo = 'thinca/vim-quickrun'

[[plugins]]
repo = 'thinca/vim-ref'

[[plugins]]
repo = 'thinca/vim-themis'

[[plugins]]
repo = 'tyru/capture.vim'

[[plugins]]
repo = 'vim-denops/denops.vim'

[[plugins]]
repo = 'vim-skk/skkeleton'
hook_add = '''

call hypermap#map('jj', 'eval(maparg("<Plug>(skkeleton-toggle)", mode()))', {'eval': v:true})

let g:vimrc#ddc_source_options.skkeleton = {
  \ 'mark': 'skk',
  \ 'matchers': ['skkeleton'],
  \ 'sorters': [],
  \ 'minAutoCompleteLength': 2,
  \ }

function! s:skkeleton_init() abort
  call skkeleton#config({
  \ 'registerConvertResult': v:true,
  \ 'userJisyo': '/hd/skkeleton/jisyo',
  \ })
  call skkeleton#register_kanatable('rom', {
  \   'jj': 'disable',
  \ })
endfunction

autocmd User skkeleton-initialize-pre call s:skkeleton_init()

autocmd User skkeleton-enable-pre call s:skkeleton_pre()
function! s:skkeleton_pre() abort
  " Save current sources
  let b:skkeleton_ddc_sources = get(ddc#custom#get_current(), 'sources', [])
  call ddc#custom#patch_buffer('sources', ['skkeleton'])
  " call pum#set_option('setline_insert', v:true)
endfunction
autocmd User skkeleton-disable-pre call s:skkeleton_post()
function! s:skkeleton_post() abort
  " Restore current sources
  call ddc#custom#patch_buffer('sources', b:skkeleton_ddc_sources)
  call pum#set_option('setline_insert', v:false)
endfunction
'''

[[plugins]]
repo = 'wsdjeg/dein-ui.vim'
hook_add = '''
autocmd FileType SpaceVimPlugManager autocmd TextChanged <buffer> normal! G
'''

[[plugins]]
repo = 'yuki-yano/fern-preview.vim'
hook_add = '''
function! s:fern_preview_map() abort
  nmap <silent> <buffer> p     <Plug>(fern-action-preview:toggle)
  nmap <silent> <buffer> P     <Plug>(fern-action-preview:auto:toggle)
  nmap <silent> <buffer> <C-d> <Plug>(fern-action-preview:scroll:down:half)
  nmap <silent> <buffer> <C-u> <Plug>(fern-action-preview:scroll:up:half)
endfunction

augroup vimrc
  autocmd FileType fern call s:fern_preview_map()
augroup END
'''

[[plugins]]
repo = 'yuki-yano/fzf-preview.vim'
hook_add = '''
let g:fzf_preview_grep_cmd = 'rg --line-number --no-heading --color=never --sort=path --with-filename'

nnoremap <fzf-p> <Nop>
nmap 'z <fzf-p>
nnoremap <silent> <C-p> <Cmd>FzfPreviewDirectoryFilesRpc<CR>
nnoremap <silent> <fzf-p>L :<C-u>FzfPreviewProjectGrepRpc --experimental-fast -add-fzf-arg=--exact --add-fzf-arg=--no-sort . <C-r>=expand('%:p')<CR><CR>
nnoremap <silent> <fzf-p>f <Cmd>FzfPreviewCommandPaletteRpc<CR>
nnoremap <silent> <fzf-p>l <Cmd>FzfPreviewLinesRpc<CR>
nnoremap <silent> <fzf-p>p :<C-u>FzfPreviewProjectGrep --experimental-fast<Space>
nnoremap <silent> <fzf-p>s <Cmd>FzfPreviewGitStatusRpc<CR>
nnoremap <silent> <fzf-p>w <Cmd>FzfPreviewProjectMrwFilesRpc --add-fzf-arg=--no-sort<CR>
'''
hook_source = '''
call vimrc#build#add(g:dein#plugin)
'''