32 lines
1.1 KiB
Fennel
32 lines
1.1 KiB
Fennel
(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")
|
|
|
|
;; set uxntal build commands
|
|
(set textadept.run.compile_commands.uxntal "/home/nico/.local/bin/uxnasm \"%f\" \"%f.rom\"")
|
|
(set textadept.run.run_commands.uxntal "/home/nico/.local/bin/uxnemu \"%f.rom\"")
|
|
|
|
;; 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)))))
|
|
|
|
(table.insert textadept.menu.context_menu 1
|
|
["Follow Link" _G.follow-link]) |