summaryrefslogtreecommitdiff
path: root/rc
diff options
context:
space:
mode:
authorJustin Frank <justinpfrank@protonmail.com>2019-03-13 11:15:59 -0700
committerJustin Frank <justinpfrank@protonmail.com>2019-04-08 17:02:44 -0700
commitc3f694a28f2da1454119ff49540377f4370f940d (patch)
tree6a28a27479e9194949f67612e49945f0c9e07a58 /rc
parent1fab727f2be4be4e4b6e85887c283daf86aef722 (diff)
Modified base files to use modules
Diffstat (limited to 'rc')
-rw-r--r--rc/filetype/clojure.kak4
-rw-r--r--rc/filetype/etc.kak45
-rw-r--r--rc/filetype/fish.kak8
-rw-r--r--rc/filetype/gas.kak8
-rw-r--r--rc/filetype/git.kak27
-rw-r--r--rc/filetype/haskell.kak8
-rw-r--r--rc/filetype/ini.kak8
-rw-r--r--rc/filetype/java.kak8
-rw-r--r--rc/filetype/julia.kak8
-rw-r--r--rc/filetype/lua.kak8
-rw-r--r--rc/filetype/mail.kak8
-rw-r--r--rc/filetype/mercurial.kak13
-rw-r--r--rc/filetype/rust.kak8
-rw-r--r--rc/filetype/scala.kak8
-rw-r--r--rc/filetype/swift.kak8
-rw-r--r--rc/filetype/yaml.kak8
-rw-r--r--rc/windowing/screen.kak12
-rw-r--r--rc/windowing/tmux.kak14
-rw-r--r--rc/windowing/x11.kak12
19 files changed, 198 insertions, 25 deletions
diff --git a/rc/filetype/clojure.kak b/rc/filetype/clojure.kak
index d19708af..062e4f0c 100644
--- a/rc/filetype/clojure.kak
+++ b/rc/filetype/clojure.kak
@@ -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
# ‾‾‾‾‾‾‾‾‾‾‾‾
diff --git a/rc/filetype/etc.kak b/rc/filetype/etc.kak
index 1e2067fe..29c6296d 100644
--- a/rc/filetype/etc.kak
+++ b/rc/filetype/etc.kak
@@ -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 }
-}
+}}
diff --git a/rc/filetype/fish.kak b/rc/filetype/fish.kak
index 24da9d20..db62a354 100644
--- a/rc/filetype/fish.kak
+++ b/rc/filetype/fish.kak
@@ -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-.+ }
}
+
+}
diff --git a/rc/filetype/gas.kak b/rc/filetype/gas.kak
index 0c1f79f8..ba32472a 100644
--- a/rc/filetype/gas.kak
+++ b/rc/filetype/gas.kak
@@ -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-.+ }
}
+
+}
diff --git a/rc/filetype/git.kak b/rc/filetype/git.kak
index 13d58f0a..155d666c 100644
--- a/rc/filetype/git.kak
+++ b/rc/filetype/git.kak
@@ -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 }
-}
+}}
diff --git a/rc/filetype/haskell.kak b/rc/filetype/haskell.kak
index c51bcaf4..ecedbcfd 100644
--- a/rc/filetype/haskell.kak
+++ b/rc/filetype/haskell.kak
@@ -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-.+ }
}
+
+]
diff --git a/rc/filetype/ini.kak b/rc/filetype/ini.kak
index c03cae4e..24bae58d 100644
--- a/rc/filetype/ini.kak
+++ b/rc/filetype/ini.kak
@@ -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 }
}
+
+}
diff --git a/rc/filetype/java.kak b/rc/filetype/java.kak
index 7caa5aee..21c28858 100644
--- a/rc/filetype/java.kak
+++ b/rc/filetype/java.kak
@@ -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-.+ }
}
+
+🦀
diff --git a/rc/filetype/julia.kak b/rc/filetype/julia.kak
index abdf547a..ade63480 100644
--- a/rc/filetype/julia.kak
+++ b/rc/filetype/julia.kak
@@ -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 }
}
+
+}
diff --git a/rc/filetype/lua.kak b/rc/filetype/lua.kak
index 605148e0..c3411c91 100644
--- a/rc/filetype/lua.kak
+++ b/rc/filetype/lua.kak
@@ -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
}
}
+
+]
diff --git a/rc/filetype/mail.kak b/rc/filetype/mail.kak
index 4323d28c..73998d90 100644
--- a/rc/filetype/mail.kak
+++ b/rc/filetype/mail.kak
@@ -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 }
}
+
+}
diff --git a/rc/filetype/mercurial.kak b/rc/filetype/mercurial.kak
index 3f84eea2..5c014ee7 100644
--- a/rc/filetype/mercurial.kak
+++ b/rc/filetype/mercurial.kak
@@ -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 }
}
+
+}
diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak
index 28cb98c3..7018ff31 100644
--- a/rc/filetype/rust.kak
+++ b/rc/filetype/rust.kak
@@ -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'
]
+
+🦀
diff --git a/rc/filetype/scala.kak b/rc/filetype/scala.kak
index 1e62e2ad..ce890058 100644
--- a/rc/filetype/scala.kak
+++ b/rc/filetype/scala.kak
@@ -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-.+ }
]
+
+}
diff --git a/rc/filetype/swift.kak b/rc/filetype/swift.kak
index 1526cadb..4cf71613 100644
--- a/rc/filetype/swift.kak
+++ b/rc/filetype/swift.kak
@@ -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 }
}
+
+}
diff --git a/rc/filetype/yaml.kak b/rc/filetype/yaml.kak
index 7076e13d..8e0f3487 100644
--- a/rc/filetype/yaml.kak
+++ b/rc/filetype/yaml.kak
@@ -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-.+ }
}
+
+}
diff --git a/rc/windowing/screen.kak b/rc/windowing/screen.kak
index e4ddd2e9..8c77e1e9 100644
--- a/rc/windowing/screen.kak
+++ b/rc/windowing/screen.kak
@@ -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
+
+}
diff --git a/rc/windowing/tmux.kak b/rc/windowing/tmux.kak
index acc5c097..b3c3dbdc 100644
--- a/rc/windowing/tmux.kak
+++ b/rc/windowing/tmux.kak
@@ -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
+
+}
diff --git a/rc/windowing/x11.kak b/rc/windowing/x11.kak
index 27b637ae..a1a747cf 100644
--- a/rc/windowing/x11.kak
+++ b/rc/windowing/x11.kak
@@ -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
+
+}