Re: [textadept] Could I use Textadept as an outline tool?

From: Robert <ro....at.web.de>
Date: Wed, 17 Nov 2010 10:13:49 +0100

On Wed, Nov 17, 2010 at 2:35 AM, phayz <russelldicken....at.gmail.com> wrote:
> I would like to be able to work on a large, structured document but in
> small "chunks" and I wonder if Textadept might help? The idea would be
> that I first create a document which is essentially a table of
> contents, and then write each piece in a separate document (read
> "file"). Textadept would hopefully help in that I could move the
> cursor to a specific line on which I had written the name of a section
> (of the document), press a key sequence, and if a file with the
> matching name already existed, it would be opened, otherwise an empty
> buffer with that name would be created.

I've done something like this when writing tex.
In my tex module I have a function

function goto_input()
  -- TODO add suffix .tex if not there
  local buffer = buffer
  local line = buffer:get_cur_line()
  local pattern = '\\input (.+)'
  local file = line:match(pattern)
  if not file then return end
  local path = buffer.filename:match('^.+/')..file
  local lfs = require 'lfs'
  io.open_file(path:iconv('UTF-8', _CHARSET))
end

if type(keys) == 'table' then
  keys.tex = {
    am = {
    -- ...
      g = { goto_input },
    -- ...
  }

and in my main document

\input something.tex
\input else.tex

On each line I can press "alt-m", then "g", to either open or create
the buffer. This is obviously based on the function in the Lua module
so you should have a look there too.

Robert
Received on Wed 17 Nov 2010 - 04:13:49 EST

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:54:02 EST