This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Rectangular selection | |
-- Add the following to your init.lua | |
keys.ar = { function() | |
local events = events | |
local gui = gui | |
local KEYSYMS = _m.textadept.keys.KEYSYMS | |
gui.statusbar_text = 'Rectangular selection' | |
events.emit('update_ui') | |
rselect = events.connect('keypress', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Experimental command line arguments processing | |
args = {} | |
local helptext = [[ | |
Textadept - Version ... | |
Usage: | |
textadept [arguments] [file ..] - edit text files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Experimental search for Textadept using the status bar | |
-- ctrl-f, ctrl-g: next, ctrl-shift-g: previous | |
-- backspace: delete all, delete: delete one char | |
keys.cf = {function() | |
local KEYSYMS = _m.textadept.keys.KEYSYMS | |
local string_char = string.char | |
local search_term = '' | |
gui.statusbar_text = 'Search: ' | |
events.emit('update_ui') | |
events.connect('keypress', function(code, shift, control, alt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module('_m.common.filename', package.seeall) | |
function insert_filename() | |
local current_dir = (buffer.filename or ''):match('.+[/\\]') | |
if not current_dir then | |
current_dir = _HOME | |
end | |
filename = | |
gui.dialog('fileselect', | |
'--title', "Insert filename", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module('_m.common.open', package.seeall) | |
local filtered_folders = {'^%.?$', '%.hg$', '%.git'} | |
function open(path) | |
local lfs = require 'lfs' | |
local items, files = {}, {} | |
for item in lfs.dir(path) do | |
if lfs.attributes(path..'/'..item).mode == 'directory' then | |
if not _m.textadept.snapopen.exclude(item, filtered_folders) then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module('_m.common.vc', package.seeall) | |
function hg_status() | |
local path = buffer.filename:match('(.+)/') | |
local command = 'cd '..path..'; hg root 2>&1' | |
local f = io.popen(command) | |
local ans = f:read("*a") | |
f:close() | |
if ans:match(".hg not found") then | |
_m.textadept.snapopen.open({path}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'textadept' | |
-- requires latest menu.lua from hg: | |
-- http://code.google.com/p/textadept/source/browse/modules/textadept/menu.lua | |
-- toggle menubar | |
local menubar_visible = true | |
keys['af10'] = { | |
function () | |
if menubar_visible then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events.connect('file_after_save', | |
function() -- show Python syntax errors as annotations | |
if buffer:get_lexer() == 'python' then | |
local lfs = require 'lfs' | |
local buffer = buffer | |
buffer:annotation_clear_all() | |
local filepath = buffer.filename:iconv(_CHARSET, 'UTF-8') | |
local filedir, filename = '', filepath | |
if filepath:find('[/\\]') then | |
filedir, filename = filepath:match('^(.+[/\\])([^/\\]+)$') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
keys['c+'] = {function() | |
local buffer = buffer | |
buffer.zoom = buffer.zoom + 1 | |
local c = _SCINTILLA.constants | |
buffer.margin_width_n[0] = 4 * buffer:text_width(c.STYLE_LINENUMBER, "9") | |
end | |
} | |
keys['c-'] = {function() | |
local buffer = buffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module('_m.common.ack', package.seeall) | |
-- load with | |
-- require 'common.ack' | |
-- in init.lua | |
options = '--nocolor --nogroup ' | |
local L = _G.locale.localize | |
local sep = '/' |
OlderNewer