Scite 缓冲区切换 |
|
这将把 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