Is tab key completion possible with SciTE currently?

45 views
Skip to first unread message

nkmathew

unread,
Jan 2, 2022, 6:32:12 AM1/2/22
to scite-interest
It's been years since I saw a similar question and I'd like to imagine SciTE's improved enough for this to be possible somehow even with Lua. Basically triggering the completion menu using the tab key while also retaining the indentation function

Neil Hodgson

unread,
Jan 3, 2022, 10:28:47 PM1/3/22
to scite-i...@googlegroups.com
nkmathew:

> It's been years since I saw a similar question and I'd like to imagine SciTE's improved enough for this to be possible somehow even with Lua. Basically triggering the completion menu using the tab key while also retaining the indentation function

You can attach a Lua function (defined in the Lua Startup Script) to the Tab key with settings similar to:

command.name.37.*=MyTab
command.37.*=MyTab
command.mode.37.*=subsystem:lua,savebefore:no,quiet:yes
command.shortcut.37.*=Tab

Neil

nkmathew

unread,
Jan 16, 2022, 5:17:39 PM1/16/22
to scite-interest
Simple version for anyone interested:

function MyTab()
  char = editor.CharAt[editor.CurrentPos - 1]
  column = editor.Column[editor.CurrentPos]
  _space = 32
  _tab = 9
  _newline = 10
  seltext = editor:GetSelText() or ''
  canTab = char == _space or char == _tab or char == _newline or column == 0
  if canTab or #seltext > 2 then
    editor:Tab()
  else
    scite.MenuCommand(IDM_COMPLETEWORD)
  end
end
Reply all
Reply to author
Forward
0 new messages