New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Org-mode language support #2835
Closed
Closed
Changes from 5 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
acaa77a
add initial org mode syntax highlighting script, based on markdown.kak
andreyorst 3c9b85b
fix src_blocks, add list highlighting
andreyorst 7cf7dee
case-isensetive src blocks
andreyorst 654ef9c
remove unnedeed slashes
andreyorst 3afb526
update regexes for inline formatting
andreyorst 3eac6b9
Merge remote-tracking branch 'upstream/master' into org-mode
andreyorst e806a34
use builtin faces for bold, italics, and underline. use add underline…
andreyorst d26192f
add strikethrough highlighter for org. add strikethrough face to themes
andreyorst d890516
Merge remote-tracking branch 'upstream/master' into org-mode
andreyorst f561fdf
add more blocks
andreyorst ffac001
provide indentation copying rules for lists
andreyorst 51ce3a1
discard list indentation in case no text entered
andreyorst 32bb577
add emacs-lisp
andreyorst 00cff94
fix table being detected mid line
andreyorst da8bb68
fix wrapping search
andreyorst fcbc44d
rework highlighters to support singel newlinesd matching
andreyorst b8f54f0
add highlighting for title and requisites
andreyorst 5bb8ecf
fix end of src block was highlighted along with the code inside it
andreyorst 9a22a53
turn math blocks to region highlighter
andreyorst 848bc25
add math blocks starting with square bracket
andreyorst 9e0642a
add section, subsection, and subsubsection faces
andreyorst a76a294
use new sections, adjust bold
andreyorst e9c228c
avoid bold headings
andreyorst 69c23e4
simplify markup regexps
andreyorst a1721d2
simplify markup regexps
andreyorst 01a88ce
add one level of iteration to sections
andreyorst bf81bde
merge bold highlighters into one
andreyorst f1c507c
define inner region for blocks
andreyorst fbe0bfe
fix links; sort languages
andreyorst 9c35e3f
rebase against master
andreyorst 5e066c7
handle TODO items
andreyorst 43e227a
adjust math blocks
andreyorst a1adafb
support tags in headings
andreyorst 61f5c0a
fix headings
andreyorst 23f0ec4
add timestamps; adjust markup to specification
andreyorst 8db594d
add timestamps; adjust markup to specification
andreyorst 5018a17
add latex area
andreyorst 86f6708
use match-capture for latex block
andreyorst 19b78f2
export snippets and footnotes
andreyorst 90dc15d
extend links, targets, add cookies
andreyorst 888626c
fix link regex
andreyorst d74a54d
update commants and docstrings
andreyorst 3fed694
better detection of TODO items on startup
andreyorst 3467e04
better heading highlighting
andreyorst 58fdee0
fix link
andreyorst 9282240
tweak markup to handle three chars correctly
andreyorst 5c4073b
provide reparse command
andreyorst d5bd2e6
tweak timestamp and link
andreyorst 73ac8a1
Merge remote-tracking branch 'upstream/master' into org-mode
andreyorst 838cc0d
provide orgmode module
andreyorst 8458cb0
create new faces based on existing ones, adjust detection
andreyorst e10e764
remove section highlighters, as they are now declared by org.kak
andreyorst 75b4bc2
remove underline and strikethrough faces from builtin colorschemes, d…
andreyorst d60a6f8
remove modifications to themes completely
andreyorst d9cbdf7
remove modifications to themes completely
andreyorst 3de4874
add heading comments
andreyorst bae86c7
use whitespace as Comment delimiter
andreyorst 6434ce9
adjust comment face
andreyorst ceef4e4
Merge remote-tracking branch 'upstream/master' into org-mode
andreyorst fa784ee
support loading language modules like in #2924
andreyorst 097fbd1
regex simplifications; latex ref
andreyorst cd4da0f
Merge remote-tracking branch 'upstream/master' into org-mode
andreyorst 45ef1dd
simplify priorities parsing
andreyorst File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# https://orgmode.org/ - your life in plain text | ||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ | ||
|
||
# Detection | ||
# ‾‾‾‾‾‾‾‾‾ | ||
|
||
hook global BufCreate .*[.]org %{ | ||
set-option buffer filetype org | ||
} | ||
|
||
# Highlighters | ||
# ‾‾‾‾‾‾‾‾‾‾‾‾ | ||
|
||
add-highlighter shared/org regions | ||
add-highlighter shared/org/inline default-region regions | ||
add-highlighter shared/org/inline/text default-region group | ||
|
||
evaluate-commands %sh{ | ||
languages=" | ||
c cabal clojure coffee cpp css cucumber d diff dockerfile fish gas go | ||
haml haskell html ini java javascript json julia kak kickstart latex | ||
lisp emacs-lisp scheme lua makefile org moon objc perl pug python ragel ruby rust | ||
sass scala scss sh swift toml tupfile typescript yaml sql | ||
" | ||
for lang in ${languages}; do | ||
printf "%s\n" "add-highlighter shared/org/${lang} region '#\+(?i)BEGIN_SRC(?I)\h+${lang}\b' '#\+(?i)END_SRC' regions" | ||
printf "%s\n" "add-highlighter shared/org/${lang}/ default-region fill meta" | ||
case ${lang} in | ||
kak) ref="kakrc" ;; | ||
emacs-lisp) ref="lisp" ;; | ||
*) ref="${lang}" ;; | ||
esac | ||
printf "%s\n" "add-highlighter shared/org/${lang}/inner region \A#\+(?i)BEGIN_SRC(?I)[^\n]*\K '(?=#\+(?i)END_SRC)' ref ${ref}" | ||
done | ||
} | ||
|
||
# Comment | ||
add-highlighter shared/org/comment region (^|\h)\K#[^+] $ fill comment | ||
|
||
# No-language SRC block | ||
add-highlighter shared/org/src_block region ^(\h*)(?i)#\+BEGIN_SRC(\h+|\n) ^(\h*)(?i)#\+END_SRC\h*$ fill meta | ||
|
||
# Example block | ||
add-highlighter shared/org/example_block region ^(\h*)(?i)#\+BEGIN_EXAMPLE(\h+|\n) ^(\h*)(?i)#\+END_EXAMPLE\h*$ fill mono | ||
|
||
# Small example block | ||
add-highlighter shared/org/inline/text/example regex ^(\h*)[:]\h+[^\n]* 0:mono | ||
|
||
# Unordered list items start with `-', `+', or `*' | ||
add-highlighter shared/org/inline/text/unordered-lists regex ^(?:\h*)([-+])\h+ 1:bullet | ||
# But `*' list must be indented with at least single space, if not it is treated as a heading | ||
add-highlighter shared/org/inline/text/star-list regex ^(?:\h+)([*])\h+ 1:bullet | ||
|
||
# Ordered list items start with a numeral followed by either a period or a right parenthesis, such as `1.' or `1)' | ||
add-highlighter shared/org/inline/text/ordered-lists regex ^(?:\h*)(\d+[.)])\h+ 1:bullet | ||
|
||
# Headings | ||
add-highlighter shared/org/inline/text/heading regex "^[*]+\h+[^\n]+" 0:header | ||
add-highlighter shared/org/inline/text/italic regex "\s([/][^\s/].*?[^\s/]*?[/])\W" 1:default,default+i | ||
add-highlighter shared/org/inline/text/verbatim regex "\s([=][^\s=].*?[^\s=]*?[=])\W" 1:meta | ||
andreyorst marked this conversation as resolved.
Show resolved
Hide resolved
|
||
add-highlighter shared/org/inline/text/code regex "\s([~][^\s~].*?[^\s~]*?[~])\W" 1:mono | ||
add-highlighter shared/org/inline/text/math regex "\s([$][^\s].*?[^\s]*?[$])\W" 1:mono | ||
add-highlighter shared/org/inline/text/underlined regex "\s([_][^\s_].*?[^\s_]*?[_])\W" 1:default,default+u | ||
add-highlighter shared/org/inline/text/bold regex "\s([*][^\s*].*?[^\s*]*?[*])\W" 1:default,default+b | ||
andreyorst marked this conversation as resolved.
Show resolved
Hide resolved
|
||
add-highlighter shared/org/inline/text/link regex "\[[^\n]+\]\]" 0:link | ||
add-highlighter shared/org/inline/text/option regex "(?i)#\+[a-z]\w*\b" 0:meta | ||
|
||
# Strikethrough highlighter is disabled because Kakoune doesn't support strikethrough attribute | ||
# add-highlighter shared/org/inline/text/strikethrough regex "\W*\+[^\s][^\n+]+[^\s]\+\W" 0:default,default+s | ||
andreyorst marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# Initialization | ||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ | ||
|
||
hook -group org-highlight global WinSetOption filetype=org %{ | ||
add-highlighter window/org ref org | ||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/org } | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a
regex
would be clearer here, e.g.