Skip to content

Instantly share code, notes, and snippets.

Created June 9, 2014 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5f346676a88447bba8a6 to your computer and use it in GitHub Desktop.
Save anonymous/5f346676a88447bba8a6 to your computer and use it in GitHub Desktop.
-[[
-- doeesn't work
--require 'luarocks.loader'
-- doesn't work
--eval `lua /usr/local/bin/luarocks path`
--doesn't work
package.path = table.concat({
'/usr/local/share/lua/5.2/',
package.path
}, ';');
-- nope
--require 'luarocks.loader'
--]]
if not CURSES then ui.set_theme('joe') end
if not CURSES then require 'highlight' end
-- textredux
events.connect(events.INITIALIZED, function()
require 'textredux.hijack'
end)
events.connect(events.FILE_AFTER_SAVE, function(filename)
if filename:find('[/\\]%.textadept[/\\]') then reset() end
end)
-- quicknav
_M.quicknav = require 'quicknav'
keys['c/'] = _M.quicknav.explore_search
-- emacs keys etc
keys.cw = function() buffer.cut(); buffer.cancel() end
keys.CLEAR = "cg" -- emacs ctrl-g clears
keys['esc'] =
{
-- actually i need to write a function
-- to get the word under the cursor
-- and uppercase it.
u = buffer.upper_case,
l = buffer.lower_case,
w = function() buffer.copy_allow_line(); buffer.cancel() end
}
keys['c '] = function() _G.buffer.selection_mode = 0 end
keys['c]'] = buffer.swap_main_anchor_caret
keys['cy'] = buffer.paste
ctrlk = function()
-- are we at end of line?
-- if so, join next line to this one
-- else cut from current pos to end of line
-- should add to the buffer that gets pasted.
end
keys['ck'] = ctrlk -- how to
-- ctrl-p to open command entry input
keys['cp'] = {ui.command_entry.enter_mode, 'lua_command'}
-- fix this - multiple cs should search to next entry
-- also, highlite all occurences in yellow and current
-- occurance in red.
keys['cs'] = ui.find.find_incremental
keys.f9 = reset
keys['ca'] = buffer.vc_home
keys['ce'] = buffer.line_end
keys['cd'] = buffer.clear -- why not called buffer.delete_next ?
--keys.cr = textredux.buffer_list
local view_next, view_prev = {ui.goto_view, 1, true}, {ui.goto_view, -1, true}
local view_splith, view_splitv = {view.split, view}, {view.split, view, true}
local view_unsplit = {view.unsplit, view}
-- Emacs ctl-x key map
keys['cx'] = {
r = buffer.reload,
u = buffer.undo,
s = buffer.save,
h = view_splith, -- how to make this "2" in addition to 'h'?
v = view_splitv, -- how to make this a "3" in addition to v?
o = view_next,
cc = quit,
cf = io.snapopen,
cr = io.open_recent_file,
cs = io.save_file,
cw = io.save_file_as,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment