Scite Word Select |
|
First of all, put the following code into your Lua startup file:
function isWordChar(char) local strChar = string.char(char) local beginIndex = string.find(strChar, '%w') if beginIndex ~= nil then return true end if strChar == '_' then return true end return false end function SelectWord() local beginPos = editor.CurrentPos local endPos = beginPos while isWordChar(editor.CharAt[beginPos-1]) do beginPos = beginPos - 1 end while isWordChar(editor.CharAt[endPos]) do endPos = endPos + 1 end if beginPos ~= endPos then editor.SelectionStart = beginPos editor.SelectionEnd = endPos end end
After that, you need to bind a shortcut key for SelectWord.
In your properties file place the following code, replacing 13 with an unused command number. Also, feel free to use whatever shortcut you like instead of Ctrl+J.
command.name.13.*=Select Word command.mode.13.*=subsystem:lua,savebefore:no,groupundo command.shortcut.13.*=Ctrl+J command.13.*=SelectWord