add textadept config
This commit is contained in:
parent
010352ab33
commit
eec26e2dd9
|
@ -0,0 +1,29 @@
|
|||
(var fennel (include "fennel"))
|
||||
|
||||
;; config stuff
|
||||
(view:set_theme "base16-tomorrow-night" {:font "Fantasque Sans Mono" :size 14})
|
||||
(set view.wrap_mode view.WRAP_WORD)
|
||||
|
||||
;; add uxntal lexer
|
||||
(tset textadept.file_types.extensions "tal" "uxntal")
|
||||
|
||||
|
||||
;; extensions!
|
||||
|
||||
;; markdown link matching pattern
|
||||
(var markdown-link "%[[^%]]+%]%(([^%)]+)%)")
|
||||
;; zettel link matching pattern
|
||||
(var zettel-link "%[%[([^%]]+)%]%]")
|
||||
|
||||
(fn _G.follow-link []
|
||||
"opens the file (in a new tab) of the markdown or zettelkasten link under the cursor"
|
||||
(let [(line cpos) (buffer.get_cur_line)
|
||||
md (line:match markdown-link)
|
||||
zettel (line:match zettel-link)
|
||||
dir (string.match buffer.filename "(.+)/.+%..+" )]
|
||||
(if
|
||||
(not= md nil) (io.open_file (.. dir "/" md))
|
||||
(not= zettel nil) (io.open_file (.. dir "/" zettel)))))
|
||||
|
||||
(tset textadept.menu.context_menu (+ 1 (length textadept.menu.context_menu))
|
||||
["Follow Link" _G.follow-link])
|
|
@ -0,0 +1,4 @@
|
|||
local fennel = require("fennel")
|
||||
fennel.path = "/home/nico/.textadept/?.fnl"
|
||||
table.insert(package.loaders or package.searchers, fennel.searcher)
|
||||
local config = require("config")
|
|
@ -0,0 +1,45 @@
|
|||
-- uxntal LPeg lexer.
|
||||
|
||||
local lexer = require('lexer')
|
||||
local token, word_match = lexer.token, lexer.word_match
|
||||
local P, S = lpeg.P, lpeg.S
|
||||
|
||||
local lex = lexer.new('uxntal')
|
||||
|
||||
-- opcodes
|
||||
|
||||
local words =
|
||||
P("BRK") + P("LIT") + P("INC") + P("POP") +
|
||||
P("DUP") + P("NIP") + P("SWP") + P("OVR") +
|
||||
P("ROT") + P("EQU") + P("NEQ") + P("GTH") +
|
||||
P("LTH") + P("JMP") + P("JCN") + P("JSR") +
|
||||
P("STH") + P("LDZ") + P("STZ") + P("LDR") +
|
||||
P("STR") + P("LDA") + P("STA") + P("DEI") +
|
||||
P("DEO") + P("ADD") + P("SUB") + P("MUL") +
|
||||
P("DIV") + P("AND") + P("ORA") + P("EOR") +
|
||||
P("SFT")
|
||||
|
||||
lex:add_rule('keyword', token(lexer.KEYWORD, words * S(" rk2")^-3))
|
||||
|
||||
-- numbers
|
||||
|
||||
lex:add_rule('number', token(lexer.NUMBER, S("$#") * lexer.xdigit^1))
|
||||
|
||||
-- comments
|
||||
|
||||
local comment = token(lexer.COMMENT, lexer.range('( ', ' )'))
|
||||
|
||||
lex:add_rule('comment', comment)
|
||||
|
||||
-- address references
|
||||
local ref = token(lexer.IDENTIFIER, S(";.,") * (lexer.word + S('&/-_'))^1)
|
||||
|
||||
lex:add_rule('reference', ref)
|
||||
|
||||
-- labels
|
||||
|
||||
local label = token(lexer.LABEL, S("@&") * (lexer.word + S('&/-_'))^1)
|
||||
|
||||
lex:add_rule('label', label)
|
||||
|
||||
return lex
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,112 @@
|
|||
-- Base16 Theme: Tomorrow Night
|
||||
-- http://chriskempson.com/projects/base16/
|
||||
-- Theme author: Chris Kempson (http://chriskempson.com)
|
||||
-- Template Repository: https://github.com/rgieseke/base16-textadept
|
||||
-- Template adapted from Textadept's default templates
|
||||
-- Copyright 2007-2020 Mitchell mitchell.att.foicica.com. MIT licensed.
|
||||
|
||||
local view, colors, styles = view, lexer.colors, lexer.styles
|
||||
|
||||
-- Base16 colors
|
||||
colors.base00 = 0x211f1d
|
||||
colors.base01 = 0x2e2a28
|
||||
colors.base02 = 0x413b37
|
||||
colors.base03 = 0x969896
|
||||
colors.base04 = 0xb4b7b4
|
||||
colors.base05 = 0xc6c8c5
|
||||
colors.base06 = 0xe0e0e0
|
||||
colors.base07 = 0xffffff
|
||||
colors.base08 = 0x6666cc
|
||||
colors.base09 = 0x5f93de
|
||||
colors.base0A = 0x74c6f0
|
||||
colors.base0B = 0x68bdb5
|
||||
colors.base0C = 0xb7be8a
|
||||
colors.base0D = 0xbea281
|
||||
colors.base0E = 0xbb94b2
|
||||
colors.base0F = 0x5a68a3
|
||||
|
||||
-- Default font.
|
||||
if not font then
|
||||
font = WIN32 and 'Courier New' or OSX and 'Monaco' or
|
||||
'Bitstream Vera Sans Mono'
|
||||
end
|
||||
if not size then size = not OSX and 10 or 12 end
|
||||
|
||||
-- Predefined styles.
|
||||
styles.default = {
|
||||
font = font, size = size, fore = colors.base05, back = colors.base00
|
||||
}
|
||||
styles.line_number = {fore = colors.base04, back = colors.base00}
|
||||
--styles.control_char =
|
||||
styles.indent_guide = {fore = colors.base03}
|
||||
styles.call_tip = {fore = colors.base04, back = colors.base01}
|
||||
styles.fold_display_text = {fore = colors.base01}
|
||||
|
||||
-- Token styles.
|
||||
styles.class = {fore = colors.base0A}
|
||||
styles.comment = {fore = colors.base03}
|
||||
styles.constant = {fore = colors.base09}
|
||||
styles.embedded = {fore = colors.base0F, back = colors.base01}
|
||||
styles.error = {fore = colors.base08, italics = true}
|
||||
styles['function'] = {fore = colors.base0D}
|
||||
styles.identifier = {}
|
||||
styles.keyword = {fore = colors.base0E}
|
||||
styles.label = {fore = colors.base08}
|
||||
styles.number = {fore = colors.base09}
|
||||
styles.operator = {fore = colors.base05}
|
||||
styles.preprocessor = {fore = colors.base0B}
|
||||
styles.regex = {fore = colors.base0C}
|
||||
styles.string = {fore = colors.base0B}
|
||||
styles.type = {fore = colors.base0A}
|
||||
styles.variable = {fore = colors.base08}
|
||||
styles.whitespace = {}
|
||||
|
||||
-- Multiple Selection and Virtual Space
|
||||
--view.additional_sel_alpha =
|
||||
--view.additional_sel_fore =
|
||||
--view.additional_sel_back =
|
||||
--view.additional_caret_fore =
|
||||
|
||||
-- Caret and Selection Styles.
|
||||
view:set_sel_fore(true, colors.base06)
|
||||
view:set_sel_back(true, colors.base02)
|
||||
--view.sel_alpha =
|
||||
view.caret_fore = colors.base05
|
||||
view.caret_line_back = colors.base01
|
||||
--view.caret_line_back_alpha =
|
||||
|
||||
-- Fold Margin.
|
||||
view:set_fold_margin_color(true, colors.base00)
|
||||
view:set_fold_margin_hi_color(true, colors.base00)
|
||||
|
||||
-- Markers.
|
||||
--view.marker_fore[textadept.bookmarks.MARK_BOOKMARK] = colors.base00
|
||||
view.marker_back[textadept.bookmarks.MARK_BOOKMARK] = colors.base0B
|
||||
--view.marker_fore[textadept.run.MARK_WARNING] = colors.base00
|
||||
view.marker_back[textadept.run.MARK_WARNING] = colors.base0E
|
||||
--view.marker_fore[textadept.run.MARK_ERROR] = colors.base00
|
||||
view.marker_back[textadept.run.MARK_ERROR] = colors.base08
|
||||
for i = view.MARKNUM_FOLDEREND, view.MARKNUM_FOLDEROPEN do -- fold margin
|
||||
view.marker_fore[i] = colors.base00
|
||||
view.marker_back[i] = colors.base03
|
||||
view.marker_back_selected[i] = colors.base02
|
||||
end
|
||||
|
||||
-- Indicators.
|
||||
view.indic_fore[ui.find.INDIC_FIND] = colors.base09
|
||||
view.indic_alpha[ui.find.INDIC_FIND] = 255
|
||||
view.indic_fore[textadept.editing.INDIC_BRACEMATCH] = colors.base06
|
||||
view.indic_fore[textadept.editing.INDIC_HIGHLIGHT] = colors.base07
|
||||
view.indic_alpha[textadept.editing.INDIC_HIGHLIGHT] = 64
|
||||
view.indic_fore[textadept.snippets.INDIC_PLACEHOLDER] = colors.base04
|
||||
|
||||
-- Call tips.
|
||||
view.call_tip_fore_hlt = colors.base06
|
||||
|
||||
-- Long Lines.
|
||||
view.edge_color = colors.base02
|
||||
|
||||
-- Add red, green, and yellow for diff lexer.
|
||||
colors.red = colors.base08
|
||||
colors.green = colors.base0B
|
||||
colors.yellow = colors.base0E
|
Reference in New Issue