/extman/scite_lua/switch_buffers.lua
Lua | 31 lines | 23 code | 5 blank | 3 comment | 5 complexity | 5b11bcb8adb3dc2fec776ca90de609fd MD5 | raw file
Possible License(s): ISC
1--switch_buffers.lua 2--drops down a list of buffers, in recently-used order 3 4scite_Command 'Switch Buffer|do_buffer_list|Alt+F12' 5scite_Command 'Last Buffer|last_buffer|Ctrl+F12' 6 7local buffers = {} 8 9scite_OnOpenSwitch(function(f) 10--- swop the new current buffer with the last one! 11 local idx 12 for i,file in ipairs(buffers) do 13 if file == f then idx = i; break end 14 end 15 if idx then 16 table.remove(buffers,idx) 17 table.insert(buffers,1,f) 18 else 19 table.insert(buffers,1,f) 20 end 21end) 22 23function last_buffer() 24 if table.getn(buffers) > 1 then 25 scite.Open(buffers[2]) 26 end 27end 28 29function do_buffer_list() 30 scite_UserListShow(buffers,2,scite.Open) 31end