commit 8d9fe0e6fd337531dbc2eff3a571efc9a28ee3d1
parent 19608fa3fff9a487798a9c176f29007cc3bef460
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Wed, 17 Jul 2019 08:28:59 +0200
Simplify snippets and fix binding to enter snippets config
Diffstat:
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/.config/vis/plugins/snippets.lua b/.config/vis/plugins/snippets.lua
@@ -1,15 +1,21 @@
-vis:map(vis.modes.INSERT, '`sig',
+snipleader = '@@'
+
+insert_snippets = { ae = 'æ',
+ AE = 'Æ',
+ oe = 'ø',
+ OE = 'Ø',
+ aa = 'å',
+ AA = 'Å',
+ sig =
'-- \n' ..
'Anders Damsgaard\n' ..
'--\n' ..
'Academia: https://adamsgaard.dk\n' ..
'Photography: https://andersdamsgaard.com\n' ..
'PGP public key: https://adamsgaard.dk/ad-public-key.txt\n' ..
- 'PGP fingerprint: 5C95 9DF2 43CE 4DD1 7A5B 2610 B790 F4AD 1BF8 58FE')
+ 'PGP fingerprint: 5C95 9DF2 43CE 4DD1 7A5B 2610 B790 F4AD 1BF8 58FE',
+ }
-vis:map(vis.modes.INSERT, '`ae', 'æ')
-vis:map(vis.modes.INSERT, '`AE', 'Æ')
-vis:map(vis.modes.INSERT, '`oe', 'ø')
-vis:map(vis.modes.INSERT, '`OE', 'Ø')
-vis:map(vis.modes.INSERT, '`aa', 'å')
-vis:map(vis.modes.INSERT, '`AA', 'Å')
+for k,v in pairs(insert_snippets) do
+ vis:map(vis.modes.INSERT, snipleader..k, v)
+end
diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua
@@ -70,7 +70,7 @@ vis.events.subscribe(vis.events.INIT, function()
vis:map(vis.modes.NORMAL, leader..'A', ':rg<Enter>')
vis:map(vis.modes.NORMAL, leader..'B', ':e "$BIB"<Enter>')
vis:map(vis.modes.NORMAL, leader..'CC', ':e ~/.config/vis/visrc.lua<Enter>')
- vis:map(vis.modes.NORMAL, leader..'CS', ':e ~/.config/vis/plugins/snippetsv.lua<Enter>')
+ vis:map(vis.modes.NORMAL, leader..'CS', ':e ~/.config/vis/plugins/snippets.lua<Enter>')
vis:map(vis.modes.NORMAL, leader..'d', ':< date')
vis:map(vis.modes.NORMAL, leader..'e', ':fzf true<Enter>')
vis:map(vis.modes.NORMAL, leader..'ga', ':!git add "$vis_filepath"<Enter>')