<commit_before>func! vundle#config#bundle(arg, ...)
  let bundle = extend(s:parse_options(a:000), s:parse_name(a:arg))
  call extend(bundle, copy(s:bundle))
  call add(g:bundles, bundle)
  call s:rtp_add(bundle.rtpath())
  call vundle#config#require(bundle)
endf

func! vundle#config#init()
  call filter(g:bundles, 's:rtp_rm(v:val.rtpath())')
  let g:bundles = []
endf

func! vundle#config#require(bundle)
  call s:rtp_add(g:bundle_dir)
  " TODO: it has to be relative rtpath, not bundle.name
  exec 'runtime! '.a:bundle.name.'/plugin/*.vim'
  exec 'runtime! '.a:bundle.name.'/after/*.vim'
  call s:rtp_rm(g:bundle_dir)
endf

func! s:parse_options(opts)
  " TODO: improve this
  if len(a:opts) != 1 | return {} | endif
    
  if type(a:opts[0]) == type({})
    return a:opts[0]
  else
    return {'rev': a:opts[0]}
  endif
endf

func! s:parse_name(arg)
  let arg = a:arg
  if arg =~ '^\s*\(git@\|git://\)\S\+' || arg =~ 'https\?://' || arg =~ '\.git\*$'
    let uri = arg
    let name = substitute(split(uri,'\/')[-1], '\.git\s*$','','i')
  else
    let name = arg
    let uri  = 'http://github.com/vim-scripts/'.name.'.git'
  endif
  return {'name': name, 'uri': uri }
endf

func! s:rtp_rm(dir)
  exec 'set rtp-='.a:dir
  exec 'set rtp-='.expand(a:dir.'/after')
endf

func! s:rtp_add(dir)
  exec 'set rtp^='.a:dir
  exec 'set rtp+='.expand(a:dir.'/after')
endf

let s:bundle = {}

func! s:bundle.path()
  return join([g:bundle_dir, self.name], '/')
endf

func! s:bundle.rtpath()
  return has_key(self, 'rtp') ? join([self.path(), self.rtp], '/') : self.path()
endf
<commit_msg>Issue with command-T and explicit loading<commit_after>func! vundle#config#bundle(arg, ...)
  let bundle = extend(s:parse_options(a:000), s:parse_name(a:arg))
  call extend(bundle, copy(s:bundle))
  call add(g:bundles, bundle)
  call s:rtp_add(bundle.rtpath())
  " TODO: fix this: explicit sourcing kills command-T
  " call vundle#config#require(bundle)
endf

func! vundle#config#init()
  call filter(g:bundles, 's:rtp_rm(v:val.rtpath())')
  let g:bundles = []
endf

func! vundle#config#require(bundle)
  call s:rtp_add(g:bundle_dir)
  " TODO: it has to be relative rtpath, not bundle.name
  exec 'runtime! '.a:bundle.name.'/plugin/*.vim'
  exec 'runtime! '.a:bundle.name.'/after/*.vim'
  call s:rtp_rm(g:bundle_dir)
endf

func! s:parse_options(opts)
  " TODO: improve this
  if len(a:opts) != 1 | return {} | endif
    
  if type(a:opts[0]) == type({})
    return a:opts[0]
  else
    return {'rev': a:opts[0]}
  endif
endf

func! s:parse_name(arg)
  let arg = a:arg
  if arg =~ '^\s*\(git@\|git://\)\S\+' || arg =~ 'https\?://' || arg =~ '\.git\*$'
    let uri = arg
    let name = substitute(split(uri,'\/')[-1], '\.git\s*$','','i')
  else
    let name = arg
    let uri  = 'http://github.com/vim-scripts/'.name.'.git'
  endif
  return {'name': name, 'uri': uri }
endf

func! s:rtp_rm(dir)
  exec 'set rtp-='.a:dir
  exec 'set rtp-='.expand(a:dir.'/after')
endf

func! s:rtp_add(dir)
  exec 'set rtp^='.a:dir
  exec 'set rtp+='.expand(a:dir.'/after')
endf

let s:bundle = {}

func! s:bundle.path()
  return join([g:bundle_dir, self.name], '/')
endf

func! s:bundle.rtpath()
  return has_key(self, 'rtp') ? join([self.path(), self.rtp], '/') : self.path()
endf

{'fraction_non_alphanumeric': 0.21098087600246762, 'fraction_numerical': 0.004935225169648365, 'mean_word_length': 3.8620689655172415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2613193', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1347, 'n_words': 284}