aboutsummaryrefslogtreecommitdiff
path: root/init.lua
blob: 90e067e65f9123b13c0dbef4fe73d27536b52884 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-- Copyright 2007-2009 Mitchell mitchell<att>caladbolg.net. See LICENSE.

local mpath = _HOME..'/modules/?.lua;'.._HOME..'/modules/?/init.lua'
package.path  = mpath..';'..package.path

-- Core extension modules to load on startup.
require 'ext/keys' -- provides key command support
require 'ext/find' -- provides functionality for find/replace
require 'ext/command_entry' -- provides tab-completion for the command entry
require 'ext/mime_types' -- provides support for language detection based on
                         -- the file; loads its language-specific module if
                         -- it exists
require 'ext/pm' -- provides the dynamic browser (side pane) functionality
require 'ext/pm.buffer_browser'  -- buffer browser
require 'ext/pm.file_browser'    -- file browser
require 'ext/pm.project_browser' -- project browser
require 'ext/pm.modules_browser' -- modules browser
require 'ext/pm.macro_browser'   -- macro browser
if not WIN32 then
  require 'ext/pm.ctags_browser' -- ctags browser
  require 'ext/pm.find_browser'  -- find browser
end

-- Generic modules to load on startup.
require 'textadept'

-- Core extension modules that must be loaded last.
require 'ext/menu' -- provides the menu bar
--require 'ext/key_commands_std' -- key commands for Windows and Linux
--require 'ext/key_commands_mac' -- key commands for Mac OSX
require 'ext/key_commands' -- key commands for Mitchell (Nano-Emacs hybrid)

if not RESETTING then
  -- process command line arguments
  local textadept = textadept
  if MAC and arg[1] and arg[1]:match('^%-psn_0') then
    table.remove(arg, 1)
  end
  if #arg == 0 then
    textadept.io.load_session()
  else
    local base_dir = arg[0]:match('^.+/') or ''
    local filepath
    for _, filename in ipairs(arg) do
      if not filename:match('^~?/') then
        textadept.io.open(base_dir..filename)
      else
        textadept.io.open(filename)
      end
    end
    -- read only the Project Manager session settings
    if not textadept.io.load_session(nil, true) then
      textadept.pm.entry_text = 'buffers'
      textadept.pm.activate()
    end
  end
end