This repository has been archived on 2022-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/textadept/.textadept/config.fnl

29 lines
929 B
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")
;; 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])