コード例 #1
0
ファイル: __init__.py プロジェクト: nus/vim-ros
def alternate():
    mapping = {'.h': '.cpp', '.cpp': '.h'}
    if vimp.buf.extension in mapping:
        altfile = vimp.buf.stem + mapping[vimp.buf.extension]
        for f in package().locate_files(altfile):
            vimp.edit(f)
            return
        print 'Nothing found!'
    else:
        print 'No alternate for this extension'
コード例 #2
0
ファイル: __init__.py プロジェクト: nus/vim-ros
def alternate():
    mapping = {'.h': '.cpp', '.cpp': '.h'}
    if vimp.buf.extension in mapping:
        altfile = vimp.buf.stem + mapping[vimp.buf.extension]
        for f in package().locate_files(altfile):
            vimp.edit(f)
            return
        print 'Nothing found!'
    else:
        print 'No alternate for this extension'
コード例 #3
0
ファイル: __init__.py プロジェクト: galou/vim-ros
def alternate():
    mapping = {'.h': ('.cpp', '.cc'), '.cpp': ('.h',), '.cc': ('.h',)}
    if vimp.buf.extension in mapping:
        for altextension in mapping[vimp.buf.extension]:
            altfile = vimp.buf.stem + altextension
            for f in package().locate_files(altfile):
                vimp.edit(f)
                return
            print('No {} alternate found!'.format(altextension))
        else:
            print('Unknown extension!')
コード例 #4
0
ファイル: __init__.py プロジェクト: arntanguy/vim-ros
def alternate():
    mapping = {".h": (".cpp", ".cc"), ".cpp": (".h",), ".cc": (".h",)}
    if vimp.buf.extension in mapping:
        for altextension in mapping[vimp.buf.extension]:
            altfile = vimp.buf.stem + altextension
            for f in package().locate_files(altfile):
                vimp.edit(f)
                return
            print("No {} alternate found!".format(altextension))
        else:
            print("Unknown extension!")
コード例 #5
0
ファイル: launch.py プロジェクト: shidahe/vim-ros
def goto_file():
    import roslaunch.substitution_args
    tag = pxp.get_inner_tag(vim.current.buffer, vimp.buf.cursor)
    if 'file' in tag.attr:
        f = roslaunch.substitution_args.resolve_args(tag.attr['file'])
        vimp.edit(f)
        return
    find_expression = goto_rospack_find(vim.current.buffer, vimp.buf.cursor)
    if find_expression:
        f = roslaunch.substitution_args.resolve_args(find_expression)
        vimp.edit(f)
コード例 #6
0
def goto_file():
    import roslaunch.substitution_args
    tag = pxp.get_inner_tag(vim.current.buffer, vimp.buf.cursor)
    if 'file' in tag.attr:
        f = roslaunch.substitution_args.resolve_args(tag.attr['file'])
        vimp.edit(f)
        return
    for attr in tag.attr.values():
        if re.match(r'\$\(find \w+\)/.+', attr):
            f = roslaunch.substitution_args.resolve_args(attr)
            vimp.edit(f)
            return
コード例 #7
0
def alternate():
    mapping = {'.h': ('.cpp', '.cc'), '.cpp': ('.h', '.hpp'), '.cc': ('.h', ),
               '.hpp': ('.cpp', '.impl'), '.impl': ('.hpp', )}
    if vimp.buf.extension in mapping:
        for altextension in mapping[vimp.buf.extension]:
            altfile = vimp.buf.stem + altextension
            for f in package().locate_files(altfile):
                vimp.edit(f)
                return
            print('No {} alternate found!'.format(altextension))
        else:
            print('Unknown extension!')
コード例 #8
0
ファイル: msg.py プロジェクト: nus/vim-ros
def goto_definition():
    text, group, start, end = vimp.syntax.get_entire_syntax_region()
    # We can go to the definition of only "complex" user-defined message types,
    # because build-in types have no definition. The only exception is the
    # "Header" type, which despite being a built-in is actually a "complex"
    # message type with a definition.
    if group == 'rosmsgBuiltInType' and text == 'Header':
        group, text = 'rosmsgType', 'std_msgs/Header'
    if group == 'rosmsgType':
        package_name, msg_type = text.split('/')
        for f in rosp.Package(package_name).locate_files(msg_type + '.msg'):
            vimp.edit(f)
    elif group == 'rosmsgBuiltInType':
        print '"{0}" is a built-in type and has no definition'.format(text)
    else:
        print 'Not a message type'
コード例 #9
0
ファイル: __init__.py プロジェクト: arntanguy/vim-ros
def rosed(package_name, *file_names):
    try:
        pkg = rosp.Package(package_name)
    except rospkg.ResourceNotFound:
        print("Package {0} not found".format(package_name))
        return
    for fn in file_names:
        files = list(pkg.locate_files(fn))
        if len(files) == 0:
            print("File {0} not found".format(fn))
        elif len(files) == 1:
            vimp.edit(files[0])
        else:
            f = vimp.inputlist("You have chosen a non-unique filename, please " "pick one of the following:", files)
            if f is not None:
                vimp.edit(f)
コード例 #10
0
ファイル: msg.py プロジェクト: F34140r/vim-ros
def goto_definition():
    text, group, start, end = vimp.syntax.get_entire_syntax_region()
    # We can go to the definition of only "complex" user-defined message types,
    # because build-in types have no definition. The only exception is the
    # "Header" type, which despite being a built-in is actually a "complex"
    # message type with a definition.
    if group == 'rosmsgBuiltInType' and text == 'Header':
        group, text = 'rosmsgType', 'std_msgs/Header'
    if group == 'rosmsgType':
        package_name, msg_type = text.split('/')
        for f in rosp.Package(package_name).locate_files(msg_type + '.msg'):
            vimp.edit(f)
    elif group == 'rosmsgBuiltInType':
        print('"{0}" is a built-in type and has no definition'.format(text))
    else:
        print('Not a message type')
コード例 #11
0
def rosed(package_name, *file_names):
    try:
        pkg = rosp.Package(package_name)
    except rospkg.ResourceNotFound:
        print('Package {0} not found'.format(package_name))
        return
    for fn in file_names:
        files = list(pkg.locate_files(fn))
        if len(files) == 0:
            print('File {0} not found'.format(fn))
        elif len(files) == 1:
            vimp.edit(files[0])
        else:
            f = vimp.inputlist('You have chosen a non-unique filename, please '
                               'pick one of the following:', files)
            if f is not None:
                vimp.edit(f)
コード例 #12
0
ファイル: msg.py プロジェクト: AtsushiSakai/vim-ros
def goto_definition():
    text, group, start, end = vimp.syntax.get_entire_syntax_region()
    # We can go to the definition of only "complex" user-defined message types,
    # because build-in types have no definition. The only exception is the
    # "Header" type, which despite being a built-in is actually a "complex"
    # message type with a definition.
    if group == "rosmsgBuiltInType" and text == "Header":
        group, text = "rosmsgType", "std_msgs/Header"
    if group == "rosmsgType":
        # The type name may fully-qualified or relative to the package
        if "/" in text:
            package_name, msg_type = text.split("/")
        else:
            package_name, msg_type = vimp.var["b:ros_package_name"], text
        for f in rosp.Package(package_name).locate_files(msg_type + ".msg"):
            vimp.edit(f)
    elif group == "rosmsgBuiltInType":
        print('"{0}" is a built-in type and has no definition'.format(text))
    else:
        print("Not a message type")
コード例 #13
0
ファイル: launch.py プロジェクト: nus/vim-ros
def goto_file():
    tag = pxp.get_inner_tag(vim.current.buffer, vimp.buf.cursor)
    if 'file' in tag.attr:
        import roslaunch.substitution_args
        f = roslaunch.substitution_args.resolve_args(tag.attr['file'])
        vimp.edit(f)
コード例 #14
0
ファイル: xacro.py プロジェクト: 4eetah/dotfiles
def goto_file():
    tag = pxp.get_inner_tag(vim.current.buffer, vimp.buf.cursor)
    if 'filename' in tag.attr and tag.name != 'mesh':
        import roslaunch.substitution_args
        f = roslaunch.substitution_args.resolve_args(tag.attr['filename'])
        vimp.edit(f)