Re: [code] [textadept] Reorder tabs

From: Robert Gieseke <>
Date: Fri, 28 Jun 2019 21:59:27 +0200

Am 28.06.19 um 21:37 schrieb Qwerky:
>> So, that's what you probably would need to automate, have a shortcut,
>> that moves a tab/buffer left or right by manipulating a session object
>> or list of buffers and re-opening ...
> Is that doable with textadept?  I'm not very familiar with Lua, nor yet
> very experienced with textadept, but would be willing make an attempt,
> with a little help.  :-)

So, here is a quick proof of concept of moving the last buffer/tab to
the first position by closing and re-opening all buffers, should work
from your `init.lua`:

-- Ctrl-5
keys.c5 = function()
  local original_tabs = {}
  for i = 1, #_BUFFERS do
    local buffer = _BUFFERS[i]
    local filename = buffer.filename or buffer._type
    original_tabs[#original_tabs + 1] = filename
  for i = 1, #original_tabs - 1 do

This doesn't do a lot of things, keep cursor positions or properly
recover message buffers etc. Could likely be done based on the code in
Textadept's `session.lua`. Basically merging the save and load session
function from it with a order manipulation step in between.


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Fri 28 Jun 2019 - 15:59:27 EDT

This archive was generated by hypermail 2.2.0 : Sat 29 Jun 2019 - 06:42:07 EDT