您确实可以自己编写(GPS 的最新发展不包括此功能,我相信以前从未要求过此功能)。
目标是定义一个操作,然后您可以将其绑定到快捷键。因此,例如插件将以以下内容开头:
import GPS, gps_utils
@gps_utils.interactive(name='My Completion', filter='Source editor'):
def my_completion():
buffer = GPS.EditorBuffer.get() # the current editor
loc = buffer.current_view().cursor() # the current location
start = loc.forward_word(-1) # beginning of word
end = loc.forward_word(1) # end of word
text = buffer.get_chars(start, end) # the text the user is currently typing
# then search in current buffer (or elsewhere) for matching text
match = buffer.beginning_of_buffer().search(text)
if match:
match_start, match_end = match
match_text = buffer.get_chars(match_start, match_end)
# then go back to initial location, remove text and replace with match
buffer.delete(start, end)
buffer.insert(start, match_text)
这是一个粗略的轮廓,可能有数百个我没有看的细节。它应该让你开始。