Sha256: be08aa265e79ada95bc16a7db0fc7feb141e3c009e74e0c77b29a65a381de286

Contents?: true

Size: 1.28 KB

Versions: 3

Compression:

Stored size: 1.28 KB

Contents

function! s:AlternateFile()
  let fn = substitute(expand('%'), "^".getcwd()."/", "", "")
  let head = fnamemodify(fn, ':h')
  let tail = fnamemodify(fn, ':t')

  if match(head, '^lib/coupler/extensions') >= 0
    return substitute(head, '^lib/coupler/extensions', 'test/functional', '').'/test_'.tail
  elseif match(head, '^lib') >= 0
    return substitute(head, '^lib/coupler', 'test/unit', '').'/test_'.tail
  elseif match(head, '^test/functional') >= 0
    return substitute(head, '^test/functional', 'lib/coupler/extensions', '').'/'.substitute(tail, '^test_', '', '')
  elseif match(head, '^test') >= 0
    return substitute(head, '^test/unit', 'lib/coupler', '').'/'.substitute(tail, '^test_', '', '')
  endif
  return ''
endfunction

function! s:Alternate(cmd)
  let file = s:AlternateFile()
  "if file != '' && filereadable(file)
    if a:cmd == 'T'
      let cmd = 'tabe'
    elseif a:cmd == 'S'
      let cmd = 'sp'
    else
      let cmd = 'e'
    endif
    exe ':'.cmd.' '.file
  "else
    "echomsg 'No alternate file is defined: '.file
  "endif
endfunction

command! A  :call s:Alternate('')
command! AE :call s:Alternate('E')
command! AS :call s:Alternate('S')
command! AV :call s:Alternate('V')
command! AT :call s:Alternate('T')

let @a='OHv/def
hyV/^"end
\cu^xxxxlllli "€kD$a" do:s/_/ /g
'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
coupler-0.0.9-java .vimrc
coupler-0.0.8-java .vimrc
coupler-0.0.7-java .vimrc