Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'textadept'
- -- _M.file_browser = require 'file_browser'
- --ui.set_theme(not CURSES and 'custom' or 'custom_term')
- if not CURSES then ui.set_theme('dark-custom') end
- textadept.editing.AUTOPAIR = false
- textadept.editing.TYPEOVER_CHARS = false
- --buffer.auto_c_auto_hide = false
- --buffer.end_at_last_line = false
- events.connect(events.BUFFER_NEW, function(...)
- buffer.end_at_last_line = false
- buffer.auto_c_auto_hide = false
- buffer.auto_c_drop_rest_of_word = true
- buffer.edge_colour = 0x800080
- buffer.edge_column = 80
- buffer.edge_mode = _SCINTILLA.constants.EDGE_LINE
- buffer.tab_width = 4
- buffer.use_tabs = true
- local INDIC_BRACEMATCH = textadept.editing.INDIC_BRACEMATCH
- buffer.indic_style[INDIC_BRACEMATCH] = buffer.INDIC_ROUNDBOX
- buffer.indic_fore[INDIC_BRACEMATCH] = 0x00FF00
- buffer.indic_alpha[INDIC_BRACEMATCH] = 192
- buffer.indic_under[INDIC_BRACEMATCH] = true
- end)
- --highlight the active pane
- events.connect(events.VIEW_BEFORE_SWITCH, function()
- buffer.h_scroll_bar = false
- buffer.v_scroll_bar = false
- buffer:marker_enable_highlight(false)
- end)
- events.connect(events.VIEW_AFTER_SWITCH, function()
- buffer.h_scroll_bar = true
- buffer.v_scroll_bar = true
- buffer:marker_enable_highlight(true)
- end)
- --magic auto wrapping
- --[[ keys[' '] = function()
- if buffer:get_lexer() == "container" then
- local buffer = buffer
- if buffer.column[buffer.current_pos] < buffer.edge_column then
- return false
- end
- buffer:begin_undo_action()
- while buffer.column[buffer.current_pos] > buffer.edge_column do
- buffer:word_left()
- end
- buffer:new_line()
- buffer:line_end()
- buffer:add_text(" ")
- buffer:end_undo_action()
- else return false
- end
- end ]]
- --redirect error messages to message buffer
- events.connect(events.ERROR, function(text)
- gui.print("Error: " .. tostring(text) .. '\n')
- return false
- end, 1)
- --make Alt+Left/Right reduce/increase indentation
- keys['aleft'] = buffer.back_tab
- keys['aright'] = buffer.tab
- --prevent accidentally closing buffer when saving
- local save = keys['cs']
- local close = keys['cw']
- local last_save_time = 0
- keys['cs'] = function(...)
- last_save_time = os.time()
- return save(...)
- end
- keys['cw'] = function(...)
- if os.time() - last_save_time >= 1 then close() end
- end
- --custom key bindings
- keys['f3'] = ui.find.find_next
- keys['sf3'] = ui.find.find_prev
- keys['cg'] = textadept.editing.goto_line
- keys['f9'] = textadept.bookmarks.toggle
- keys['sf9'] = {textadept.bookmarks.goto_mark}
- keys[not CURSES and 'c]' or 'f3'] = {textadept.bookmarks.goto_mark, false}
- keys[not CURSES and 'c[' or 'f2'] = {textadept.bookmarks.goto_mark, true}
- keys['c-'] = {view.split, view}
- keys['c\\'] = {view.split, view, true}
- keys['c\b'] = {view.unsplit, view}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement