gpt4 book ai didi

sublimetext2 - 将文件 (foo.txt) 插入打开文件 (bar.txt) 的插入符号位置

转载 作者:行者123 更新时间:2023-12-03 13:36:11 25 4
gpt4 key购买 nike

请问,在插入符号位置将文件(foo.txt)插入打开文件(bar.txt)的最佳方法是什么?

最好有一个打开文件的对话框来选择要插入的任何内容。

此处的文字处理等效项是“插入文件”。

这里是 foo.sublime-snippet 的替代品,它可以链接到其他地方的表单文件:

import sublime, sublime_plugin    

class InsertFileCommand(sublime_plugin.TextCommand):
def run(self, edit):

v = self.view

template = open('foo.txt').read()

print template

v.run_command("insert_snippet", {"contents": template})

最佳答案

从文本命令中,您可以访问当前 View 。您可以使用 self.view.sel() 获取光标位置.我不知道如何在 python 中做 gui 的东西,但你可以使用快速面板进行文件选择(类似于 FuzzyFileNav )。

关于sublimetext2 - 将文件 (foo.txt) 插入打开文件 (bar.txt) 的插入符号位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15773814/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com