aboutsummaryrefslogtreecommitdiff
path: root/autoload/cursorword.kak
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/cursorword.kak')
-rw-r--r--autoload/cursorword.kak12
1 files changed, 12 insertions, 0 deletions
diff --git a/autoload/cursorword.kak b/autoload/cursorword.kak
new file mode 100644
index 0000000..9c30f99
--- /dev/null
+++ b/autoload/cursorword.kak
@@ -0,0 +1,12 @@
+declare-option -hidden regex curword
+
+hook global NormalIdle .* %{
+ eval -draft %{try %{
+ exec <space><a-i>w <a-k>\A\w+\z<ret>
+ set-option buffer curword "\b\Q%val{selection}\E\b"
+ } catch %{
+ set-option buffer curword ''
+ }}
+}
+
+add-highlighter global/ dynregex '%opt{curword}' 0:CurWord