Add a (very WIP) module that expose vi/less like functionality - dotfiles - leot's dotfiles
(HTM) hg clone https://bitbucket.org/iamleot/dotfiles
(DIR) Log
(DIR) Files
(DIR) Refs
---
(DIR) changeset 424873a77b095d69b09e9cdf7f8db85bdffa452a
(DIR) parent 1b73c608e06076603c3d77712420ea54b9cecc26
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sun, 7 Oct 2018 03:02:43
Add a (very WIP) module that expose vi/less like functionality
Diffstat:
config/luakit/marks.lua | 33 +++++++++++++++++++++++++++++++++
config/luakit/userconf.lua | 2 ++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff -r 1b73c608e060 -r 424873a77b09 config/luakit/marks.lua
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config/luakit/marks.lua Sun Oct 07 03:02:43 2018 +0200
@@ -0,0 +1,33 @@
+--- Mark support.
+--
+-- TODO: description
+--
+-- @module marks
+-- @copyright 2018 Leonardo Taccari
+
+local modes = require("modes")
+
+local _M = {}
+
+_M.previous_y = nil
+_M.markers = {}
+
+modes.add_binds("normal", {
+ { "^m[a-zA-Z0-9]", "TODO", function (w, o)
+ local token = string.match(o.buffer, "^m(.)$")
+ _M.previous_y = w.view.scroll.y
+ _M.markers[token] = w.view.scroll.y
+ end },
+ { "^'[a-zA-Z0-9]", "TODO", function (w, o)
+ local token = string.match(o.buffer, "^'(.)$")
+ if _M.markers[token] then
+ _M.previous_y = w.view.scroll.y
+ w.view.scroll.y = _M.markers[token]
+ end
+ end },
+ { "''", "TODO", function (w, o)
+ _M.previous_y, w.view.scroll.y = w.view.scroll.y, _M.previous_y
+ end },
+})
+
+return _M
diff -r 1b73c608e060 -r 424873a77b09 config/luakit/userconf.lua
--- a/config/luakit/userconf.lua Sat Oct 06 01:02:08 2018 +0200
+++ b/config/luakit/userconf.lua Sun Oct 07 03:02:43 2018 +0200
@@ -6,6 +6,8 @@
local settings = require "settings"
local soup = require "soup"
+local marks = require "marks"
+
-- Cookie policy ("never", "no_third_party", "always")
soup.accept_policy = "never"