Scite Word Select |
|
首先,將下列碼放入你的 Lua 啟動檔
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
之後,你需要為 SelectWord
繫結一個捷徑鍵。在你的屬性檔案裡,將以下碼取代為未使用過的指令編號 13。此外,不要猶豫,使用任何你喜歡的捷徑,比如說 Ctrl+J。
command.name.13.*=Select Word command.mode.13.*=subsystem:lua,savebefore:no,groupundo command.shortcut.13.*=Ctrl+J command.13.*=SelectWord