xmotions.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:VintageousPlus 作者: trishume 项目源码 文件源码
def run(self, count=1, mode=None, globally=False):

        def f(view, s):
            if mode == modes.NORMAL:
                return sublime.Region(location, location)

            elif mode == modes.VISUAL:
                return sublime.Region(s.a + 1, location)

            elif mode == modes.INTERNAL_NORMAL:
                return sublime.Region(s.a, location)

            return s

        current_sel = self.view.sel()[0]
        self.view.sel().clear()
        self.view.sel().add(current_sel)

        location = self.find_symbol(current_sel, globally=globally)
        if not location:
            return

        if globally:
            # Global symbol; simply open the file; not a motion.
            # TODO: Perhaps must be a motion if the target file happens to be
            #       the current one?
            self.view.window().open_file(
                location[0] + ':' + ':'.join([str(x) for x in location[2]]),
                sublime.ENCODED_POSITION)
            return

        # Local symbol; select.
        location = self.view.text_point(*location)
        regions_transformer(self.view, f)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号