1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-23 11:32:20 +03:00

Modified base files to use modules

This commit is contained in:
Justin Frank 2019-03-13 11:15:59 -07:00
parent 1fab727f2b
commit c3f694a28f
19 changed files with 198 additions and 25 deletions

View File

@ -1,8 +1,6 @@
# http://clojure.org
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# require lisp.kak
# Detection
# ‾‾‾‾‾‾‾‾‾
@ -16,6 +14,8 @@ hook -once global BufSetOption filetype=clojure %{
provide-module clojure %{
require-module lisp
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾

View File

@ -11,7 +11,32 @@ hook global BufCreate .*/etc/env.d/.* %{ set-option buffer fil
hook global BufCreate .*/etc/profile(\.(csh|env))? %{ set-option buffer filetype sh }
hook global BufCreate .*/etc/profile\.d/.* %{ set-option buffer filetype sh }
hook -once global BufSetOption filetype=etc-hosts %{
require-module etc-hosts
}
hook -once global BufSetOption filetype=etc-resolv-conf %{
require-module etc-resolv-conf
}
hook -once global BufSetOption filetype=etc-shadow %{
require-module etc-shadow
}
hook -once global BufSetOption filetype=etc-passwd %{
require-module etc-passwd
}
hook -once global BufSetOption filetype=etc-gshadow %{
require-module etc-gshadow
}
hook -once global BufSetOption filetype=etc-group %{
require-module etc-group
}
hook -once global BufSetOption filetype=etc-fstab %{
require-module etc-fstab
}
# Highlighters
provide-module etc-resolv-conf %{
## /etc/resolv.conf
add-highlighter shared/etc-resolv-conf group
add-highlighter shared/etc-resolv-conf/ regex ^#.*?$ 0:comment
@ -20,8 +45,9 @@ add-highlighter shared/etc-resolv-conf/ regex ^(nameserver|server|domain|sortlis
hook -group etc-resolv-conf-highlight global WinSetOption filetype=etc-resolv-conf %{
add-highlighter window/etc-resolv-conf ref etc-resolv-conf
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-resolv-conf }
}
}}
provide-module etc-hosts %{
## /etc/hosts
add-highlighter shared/etc-hosts group
add-highlighter shared/etc-hosts/ regex ^(.+?)[\s\t]+?(.*?)$ 1:type 2:attribute
@ -30,8 +56,9 @@ add-highlighter shared/etc-hosts/ regex '#.*?$' 0:comment
hook -group etc-hosts-highlight global WinSetOption filetype=etc-hosts %{
add-highlighter window/etc-hosts ref etc-hosts
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-hosts }
}
}}
provide-module etc-fstab %{
## /etc/fstab
add-highlighter shared/etc-fstab group
add-highlighter shared/etc-fstab/ regex ^(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})(?:\s+)?$ 1:keyword 2:value 3:type 4:string 5:attribute 6:attribute
@ -40,8 +67,9 @@ add-highlighter shared/etc-fstab/ regex '#.*?$' 0:comment
hook -group etc-fstab-highlight global WinSetOption filetype=etc-fstab %{
add-highlighter window/etc-fstab ref etc-fstab
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-fstab }
}
}}
provide-module etc-group %{
## /etc/group
add-highlighter shared/etc-group group
add-highlighter shared/etc-group/ regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string
@ -49,8 +77,9 @@ add-highlighter shared/etc-group/ regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keywo
hook -group etc-group-highlight global WinSetOption filetype=etc-group %{
add-highlighter window/etc-group ref etc-group
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-group }
}
}}
provide-module etc-gshadow %{
## /etc/gshadow
add-highlighter shared/etc-gshadow group
add-highlighter shared/etc-gshadow/ regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string
@ -58,8 +87,9 @@ add-highlighter shared/etc-gshadow/ regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:key
hook -group etc-gshadow-highlight global WinSetOption filetype=etc-gshadow %{
add-highlighter window/etc-gshadow ref etc-gshadow
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-gshadow }
}
}}
provide-module etc-shadow %{
## /etc/shadow
add-highlighter shared/etc-shadow group
add-highlighter shared/etc-shadow/ regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:(.*?)?$ 1:keyword 2:type 3:value 4:value 5:value 6:value 7:value 8:value
@ -67,8 +97,9 @@ add-highlighter shared/etc-shadow/ regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?)?:([0
hook -group etc-shadow-highlight global WinSetOption filetype=etc-shadow %{
add-highlighter window/etc-shadow ref etc-shadow
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-shadow }
}
}}
provide-module etc-passwd %{
## /etc/passwd
add-highlighter shared/etc-passwd group
add-highlighter shared/etc-passwd/ regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?):(.*?)?:(.+?):(.+?)$ 1:keyword 2:type 3:value 4:value 5:string 6:attribute 7:attribute
@ -76,4 +107,4 @@ add-highlighter shared/etc-passwd/ regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?):(.*?
hook -group etc-passwd-highlight global WinSetOption filetype=etc-passwd %{
add-highlighter window/etc-passwd ref etc-passwd
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-passwd }
}
}}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](fish) %{
set-option buffer filetype fish
}
hook -once global BufSetOption filetype=fish %{
require-module fish
}
provide-module fish %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -71,3 +77,5 @@ hook global WinSetOption filetype=fish %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window fish-.+ }
}
}

View File

@ -4,6 +4,12 @@ hook global BufCreate .*\.(s|S|asm)$ %{
set-option buffer filetype gas
}
hook -once global BufSetOption filetype=gas %{
require-module gas
}
provide-module gas %{
add-highlighter shared/gas regions
add-highlighter shared/gas/code default-region group
add-highlighter shared/gas/string region '"' (?<!\\)(\\\\)*" fill string
@ -89,3 +95,5 @@ hook global WinSetOption filetype=gas %{
hook window InsertChar \n -group gas-indent gas-indent-on-new-line
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window gas-.+ }
}
}

View File

@ -10,6 +10,21 @@ hook global BufCreate .*(\.gitconfig|git/config) %{
set-option buffer filetype ini
}
hook global BufCreate .*git-rebase-todo %{
set-option buffer filetype git-rebase
}
hook -once global BufSetOption filetype=git-commit %{
require-module git-commit
}
hook -once global BufSetOption filetype=git-notes %{
require-module git-notes
}
hook -once global BufSetOption filetype=git-rebase %{
require-module git-rebase
}
provide-module git-commit %{
hook -group git-commit-highlight global WinSetOption filetype=git-commit %{
add-highlighter window/git-commit-highlight regions
add-highlighter window/git-commit-highlight/diff region '^diff --git' '^(?=diff --git)' ref diff # highlight potential diffs from the -v option
@ -18,23 +33,21 @@ hook -group git-commit-highlight global WinSetOption filetype=git-commit %{
add-highlighter window/git-commit-highlight/comments/ regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)$" 1:yellow 2:red 3:green 4:blue 5:magenta
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-commit-highlight }
}
}}
provide-module git-notes %{
hook -group git-commit-highlight global WinSetOption filetype=git-notes %{
add-highlighter window/git-notes-highlight regex '^\h*#[^\n]*$' 0:comment
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-notes-highlight }
}
}}
hook global BufCreate .*git-rebase-todo %{
set-option buffer filetype git-rebase
}
provide-module git-rebase %{
hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{
add-highlighter window/git-rebase-highlight group
add-highlighter window/git-rebase-highlight/ regex "#[^\n]*\n" 0:comment
add-highlighter window/git-rebase-highlight/ regex "^(pick|edit|reword|squash|fixup|exec|break|drop|label|reset|merge|[persfxbdltm]) (\w+)" 1:keyword 2:meta
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-rebase-highlight }
}
}}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](hs) %{
set-option buffer filetype haskell
}
hook -once global BufSetOption filetype=haskell %{
require-module haskell
}
provide-module haskell %[
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -103,3 +109,5 @@ hook global WinSetOption filetype=haskell %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haskell-.+ }
}
]

View File

@ -2,6 +2,12 @@ hook global BufCreate .+\.(repo|ini|cfg|properties) %{
set-option buffer filetype ini
}
hook -once global BufSetOption filetype=ini %{
require-module ini
}
provide-module ini %{
add-highlighter shared/ini regions
add-highlighter shared/ini/code default-region group
add-highlighter shared/ini/comment region '(^|\h)\K[#;]' $ fill comment
@ -13,3 +19,5 @@ hook -group ini-highlight global WinSetOption filetype=ini %{
add-highlighter window/ini ref ini
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ini }
}
}

View File

@ -2,6 +2,12 @@ hook global BufCreate .*\.java %{
set-option buffer filetype java
}
hook -once global BufSetOption filetype=java %{
require-module java
}
provide-module java %🦀
add-highlighter shared/java regions
add-highlighter shared/java/code default-region group
add-highlighter shared/java/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
@ -63,3 +69,5 @@ hook global WinSetOption filetype=java %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window java-.+ }
}
🦀

View File

@ -8,6 +8,12 @@ hook global BufCreate .*\.(jl) %{
set-option buffer filetype julia
}
hook -once global BufSetOption filetype=julia %{
require-module julia
}
provide-module julia %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -28,3 +34,5 @@ hook -group julia-highlight global WinSetOption filetype=julia %{
add-highlighter window/julia ref julia
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/julia }
}
}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](lua) %{
set-option buffer filetype lua
}
hook -once global BufSetOption filetype=lua %{
require-module lua
}
provide-module lua %[
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -101,3 +107,5 @@ hook global WinSetOption filetype=lua %{
unalias window alt lua-alternative-file
}
}
]

View File

@ -2,6 +2,12 @@ hook global BufCreate .+\.eml %{
set-option buffer filetype mail
}
hook -once global BufSetOption filetype=mail %{
require-module mail
}
provide-module mail %{
add-highlighter shared/mail group
add-highlighter shared/mail/ regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To|Date):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
add-highlighter shared/mail/ regex <[^@>]+@.*?> 0:string
@ -11,3 +17,5 @@ hook -group mail-highlight global WinSetOption filetype=mail %{
add-highlighter window/mail ref mail
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/mail }
}
}

View File

@ -8,6 +8,17 @@ hook global BufCreate .*hg-editor-\w+\.txt$ %{
set-option buffer filetype hg-commit
}
hook -once global BufSetOption filetype=hg-commit %{
require-module hg-commit
}
provide-module hg-commit %{
# Faces
# ‾‾‾‾‾
set-face global MercurialCommitComment cyan
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -16,3 +27,5 @@ hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{
add-highlighter window/hg-commit-highlight regex '^HG:[^\n]*' 0:comment
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hg-commit-highlight }
}
}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](rust|rs) %{
set-option buffer filetype rust
}
hook -once global BufSetOption filetype=rust %{
require-module rust
}
provide-module rust %🦀
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -93,3 +99,5 @@ hook global WinSetOption filetype=rust %[
hook global WinSetOption filetype=rust %[
set window formatcmd 'rustfmt'
]
🦀

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](scala) %{
set-option buffer filetype scala
}
hook -once global BufSetOption filetype=scala %{
require-module scala
}
provide-module scala %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -73,3 +79,5 @@ hook global WinSetOption filetype=scala %[
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scala-.+ }
]
}

View File

@ -2,6 +2,12 @@ hook global BufCreate .*\.(swift) %{
set-option buffer filetype swift
}
hook -once global BufSetOption filetype=swift %{
require-module swift
}
provide-module swift %{
add-highlighter shared/swift regions
add-highlighter shared/swift/code default-region group
add-highlighter shared/swift/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
@ -26,3 +32,5 @@ hook -group swift-highlight global WinSetOption filetype=swift %{
add-highlighter window/swift ref swift
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/swift }
}
}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](ya?ml) %{
set-option buffer filetype yaml
}
hook -once global BufSetOption filetype=yaml %{
require-module yaml
}
provide-module yaml %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -56,3 +62,5 @@ hook global WinSetOption filetype=yaml %{
hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window yaml-.+ }
}
}

View File

@ -3,12 +3,11 @@
hook -group GNUscreen global KakBegin .* %sh{
[ -z "${STY}" ] && exit
echo "
alias global focus screen-focus
alias global terminal screen-terminal-vertical
"
echo "require-module screen"
}
provide-module screen %{
define-command screen-terminal-impl -hidden -params 3.. %{
nop %sh{
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
@ -67,3 +66,8 @@ If no client is passed then the current one is used' \
fi
}
}
alias global focus screen-focus
alias global terminal screen-terminal-vertical
}

View File

@ -1,16 +1,14 @@
# http://tmux.github.io/
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
## The default behaviour for the `new` command is to open an horizontal pane in a tmux session
hook global KakBegin .* %sh{
if [ -n "$TMUX" ]; then
echo "
alias global focus tmux-focus
alias global terminal tmux-terminal-horizontal
"
echo "require-module tmux"
fi
}
provide-module tmux %{
define-command -hidden -params 2.. tmux-terminal-impl %{
evaluate-commands %sh{
tmux=${kak_client_env_TMUX:-$TMUX}
@ -59,3 +57,9 @@ If no client is passed then the current one is used' \
fi
}
}
## The default behaviour for the `new` command is to open an horizontal pane in a tmux session
alias global focus tmux-focus
alias global terminal tmux-terminal-horizontal
}

View File

@ -1,3 +1,13 @@
# x11
hook global KakBegin .* %sh{
if [ -n "$DISPLAY" ]; then
echo "require-module x11"
fi
}
provide-module x11 %{
# termcmd should be set such as the next argument is the whole
# command line to execute
declare-option -docstring %{shell command run to spawn a new terminal
@ -71,3 +81,5 @@ If no client is passed, then the current client is used' \
alias global focus x11-focus
alias global terminal x11-terminal
}