aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2023-07-24 23:43:57 +0200
committerMatěj Cepl <mcepl@cepl.eu>2023-07-24 23:43:57 +0200
commit3ec213b477c380ce1bb05d5b45f42b774fa18c25 (patch)
treeb26b02cdb9904fb5c6871faa8f85bb2cadcece7c
downloadvis-yank-highlight-3ec213b477c380ce1bb05d5b45f42b774fa18c25.tar.gz
Initial commit
-rw-r--r--LICENSE21
-rw-r--r--README.md10
-rw-r--r--init.lua15
3 files changed, 46 insertions, 0 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..216f0f6
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020 Matěj Cepl
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3a6873e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,10 @@
+Make the yanked region apparent!
+================================
+
+Code suggested by Randy Palamar on https://github.com/martanne/vis/issues/1062.
+
+All issues, questions, complaints, or (even better!) patches
+should be send via email to
+[~mcepl/devel@lists.sr.ht](mailto:~mcepl/devel@lists.sr.ht) email
+list (for patches use [git send-email](https://git-send-email.io/)).
+
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..df67bb0
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,15 @@
+require("vis")
+
+vis.events.subscribe(vis.events.INIT, function()
+ local yank = vis:action_register("highlighted-yank", function()
+ vis.win:style_define(vis.win.STYLE_SELECTION, "reverse")
+ vis:redraw()
+ local tstamp = os.clock()
+ while os.clock() - tstamp < 0.5 do end
+ vis.win:style_define(vis.win.STYLE_SELECTION, vis.lexers.STYLE_SELECTION)
+ vis:redraw()
+ end, "Yank operator with highlighting")
+ vis:map(vis.modes.OPERATOR_PENDING, "y", yank)
+ vis:map(vis.modes.VISUAL, "y", yank)
+ vis:map(vis.modes.VISUAL_LINE, "y", yank)
+end) \ No newline at end of file