Scite Buffer Switch |
|
buffers.zorder.switching=1
模式,但它不穩定)。這個指令碼會提供一個依最近使用順序排列的已開啟快取的下拉清單。方法是觀察 OnOpen
和 OnSwitchFile
事件。這會將 Ctrl+K 繫結到函數 do_buffer_list
。
command.name.4.*=Switch Buffers command.4.*=do_buffer_list command.subsystem.4.*=3 command.mode.4.*=savebefore:no command.shortcut.4.*=Ctrl+K
將這放入您的啟動指令碼,或設定 ext.lua.startup.script
。
--switch_buffers.lua --drops down a list of buffers, in recently-used order local buffers = {} local append = table.insert local function buffer_switch(f) --- swop the new current buffer with the last one! local idx for i,file in ipairs(buffers) do if file == f then idx = i; break end end if idx then table.remove(buffers,idx) table.insert(buffers,1,f) else append(buffers,f) end end function OnOpen(f) buffer_switch(f) end function OnSwitchFile(f) buffer_switch(f) end function do_buffer_list() local s = '' local sep = ';' local n = table.getn(buffers) for i = 2,n-1 do s = s..buffers[i]..sep end s = s..buffers[n] _UserListSelection = fn editor.AutoCSeparator = string.byte(sep) editor:UserListShow(12,s) editor.AutoCSeparator = string.byte(' ') end function OnUserListSelection(t,str) if t == 12 then scite.Open(str) return true else return false end end