From aded6f2aebaacfd2face07831a76b7a91f76127a Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 25 Oct 2025 14:17:48 +0530 Subject: Move orgmode out + faces changes --- autoload/grep.kak | 5 ---- autoload/orgmode.kak | 61 ++++++++++++++++++++++++++++++++++++++++++++ autoload/orgmode/orgmode.kak | 61 -------------------------------------------- colors/phenax.kak | 14 ++++++++-- 4 files changed, 73 insertions(+), 68 deletions(-) create mode 100644 autoload/orgmode.kak delete mode 100644 autoload/orgmode/orgmode.kak diff --git a/autoload/grep.kak b/autoload/grep.kak index 27b6d65..c0d1010 100644 --- a/autoload/grep.kak +++ b/autoload/grep.kak @@ -17,8 +17,3 @@ hook global -always BufOpenFifo '\*make\*' %{ map global file ] ': make-next-error' map global file [ ': make-previous-error' } - -# TODO: Prevent exiting command mode from grep -# define-command live-grep %{ -# prompt -on-change %{ eval %sh{ [ -z "$kak_text" ] || echo "grep $kak_text" } } 'live-grep: ' %{ info done } -# } diff --git a/autoload/orgmode.kak b/autoload/orgmode.kak new file mode 100644 index 0000000..7c44039 --- /dev/null +++ b/autoload/orgmode.kak @@ -0,0 +1,61 @@ +declare-user-mode org +hook global BufSetOption filetype=org %{ + map buffer normal ': orgmode-jump-link' -docstring 'Jump to link' + map buffer user o ': enter-user-mode org' -docstring 'Org mode' + map buffer org ': orgmode-toggle' -docstring 'Toggle checkbox/task' +} + +define-command orgmode-toggle %{ + evaluate-commands -save-regs '#/' %{ + try %{ orgmode-toggle-checkbox } catch %{ orgmode-toggle-task-state } catch %{ } + } +} + +define-command orgmode-jump-link %{ + # TODO: support multiple links in single line + evaluate-commands %{ try %{ + execute-keys ',xs\[\[([^\n\]]+)\]' + evaluate-commands %sh{ + [ -z "$kak_reg_1" ] && exit 0 + case "$kak_reg_1" in + https://*|http://*) xdg-open "$kak_reg_1" >/dev/null 2>&1 ;; + /*|~/*) echo "edit %{$kak_reg_1}" ;; + *) + current_path="${kak_buffile:-"$kak_bufname"}" + path="$(realpath -s "$(dirname "$kak_buffile")/$kak_reg_1")" + echo "edit %{$path}" + ;; + esac + } + } } +} + +define-command orgmode-toggle-checkbox %{ + evaluate-commands %{ + execute-keys ',xs^(\h*-\h+)\[([Xx\- ])\]' + evaluate-commands %sh{ + next="$kak_reg_2" + case "$kak_reg_2" in + X|x) next=" " ;; + -) next="X" ;; + *) next="-" ;; + esac + echo "execute-keys 'c1[$next]'" + } + } +} + +define-command orgmode-toggle-task-state %{ + evaluate-commands %{ + execute-keys ',xs^(\*+\h+)(TODO|ACTIVE|DONE)?' + evaluate-commands %sh{ + next="TODO " # Add space at end when no state + case "$kak_reg_2" in + TODO) next="ACTIVE" ;; + ACTIVE) next="DONE" ;; + DONE) next="TODO" ;; + esac + echo "execute-keys 'c1$next'" + } + } +} diff --git a/autoload/orgmode/orgmode.kak b/autoload/orgmode/orgmode.kak deleted file mode 100644 index 170a73b..0000000 --- a/autoload/orgmode/orgmode.kak +++ /dev/null @@ -1,61 +0,0 @@ -declare-user-mode org -hook global WinSetOption filetype=org %{ - map window normal ': orgmode-jump-link' -docstring 'Jump to link' - map window user o ': enter-user-mode org' -docstring 'Org mode' - map window org ': orgmode-toggle' -docstring 'Toggle checkbox/task' -} - -define-command orgmode-toggle %{ - evaluate-commands -save-regs '#/' %{ - try %{ orgmode-toggle-checkbox } catch %{ orgmode-toggle-task-state } catch %{ } - } -} - -define-command orgmode-jump-link %{ - # TODO: support multiple links in single line - evaluate-commands %{ try %{ - execute-keys ',xs\[\[([^\n\]]+)\]' - evaluate-commands %sh{ - [ -z "$kak_reg_1" ] && exit 0 - case "$kak_reg_1" in - https://*|http://*) xdg-open "$kak_reg_1" >/dev/null 2>&1 ;; - /*|~/*) echo "edit %{$kak_reg_1}" ;; - *) - current_path="${kak_buffile:-"$kak_bufname"}" - path="$(realpath -s "$(dirname "$kak_buffile")/$kak_reg_1")" - echo "edit %{$path}" - ;; - esac - } - } } -} - -define-command orgmode-toggle-checkbox %{ - evaluate-commands %{ - execute-keys ',xs^(\h*-\h+)\[([Xx\- ])\]' - evaluate-commands %sh{ - next="$kak_reg_2" - case "$kak_reg_2" in - X|x) next=" " ;; - -) next="X" ;; - *) next="-" ;; - esac - echo "execute-keys 'c1[$next]'" - } - } -} - -define-command orgmode-toggle-task-state %{ - evaluate-commands %{ - execute-keys ',xs^(\*+\h+)(TODO|ACTIVE|DONE)?' - evaluate-commands %sh{ - next="TODO " # Add space at end when no state - case "$kak_reg_2" in - TODO) next="ACTIVE" ;; - ACTIVE) next="DONE" ;; - DONE) next="TODO" ;; - esac - echo "execute-keys 'c1$next'" - } - } -} diff --git a/colors/phenax.kak b/colors/phenax.kak index 8b4576e..191080b 100644 --- a/colors/phenax.kak +++ b/colors/phenax.kak @@ -2,7 +2,7 @@ evaluate-commands %sh{ foreground="rgb:c5c8c6" foreground2="rgb:90a0a0" foreground3="rgb:709090" - foreground4="rgb:304040" + foreground4="rgb:405050" background="default" accent1="rgb:007070" accent2="rgb:009090" @@ -73,7 +73,8 @@ evaluate-commands %sh{ face global orgTaskStateTodo ${black},${red}+b face global orgTaskStateDone ${black},${green}+b face global orgTaskStateActive ${black},${orange}+b - face global orgCodeBlock ${foreground2},${mildhighlight1}+a + face global markup_codeblock ${foreground2},${mildhighlight1}+a + face global orgCodeBlock markup_codeblock " ## Custom @@ -122,6 +123,15 @@ evaluate-commands %sh{ ## treesitter echo " + face global ts_title title + face global ts_heading heading + face global ts_markup_heading_1 header1 + face global ts_markup_heading_2 header2 + face global ts_markup_heading_3 header3 + face global ts_markup_heading_4 header4 + face global ts_markup_heading_5 header5 + face global ts_markup_heading_6 header6 + face global ts_markup_raw_inline markup_codeblock face global ts_value value face global ts_type type face global ts_variable variable -- cgit v1.3.1