Re: [textadept] Insert filename

From: Robert <>
Date: Thu, 26 Aug 2010 22:41:34 +0200

On Thu, Aug 26, 2010 at 9:02 PM, Ryan Pusztai <> wrote:
> Hi Mitchell,
> On Thu, Aug 26, 2010 at 10:48 AM, mitchell <> wrote:
>> Hi Ryan,
>>> Looks good. I just wish that Ctrl-Tab would go in most recently used
>>> order instead of by tab order.
>>> Is there any way to do this?
>> Simply maintain a list of buffers using a 'before_buffer_switch' event
>> instead of recording just the last one.
> Can I get a quick example of where I would put this code? Would it be in
> "~/.textadept/init.lua"? Thanks.
> --
> Regards,
> Ryan
You could put something like this in ~/.textadept/modules/common/tabswitch.lua
load it in your init.lua with
require 'common.tabswitch'

module('_m.common.tabswitch', package.seeall)
last_buffers = {}

    for index, b in ipairs(_BUFFERS) do
      if b == buffer then
        table.insert(last_buffers, 1, index)

keys['c\t'] = {
   view:goto_buffer(_m.common.tabswitch.last_buffers[1], true)

(Or remove the first line and the reference to _m.common.tabswitch and
put it directly
in your init.lua.)
Note that this needs some improvement, there are no checks for closed
buffers, so maybe
it would be better to keep a list of filenames and switch to those (as
their buffer index might
change if you close a file).
I'm not sure if this is what you wanted but I hope it helps.

Received on Thu 26 Aug 2010 - 16:41:34 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:51:30 EST