summaryrefslogtreecommitdiff
path: root/config/essentials/vis
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-22 13:49:00 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-22 13:49:00 +0200
commit30f72f36d20e9757eddcd71301403920779f31d6 (patch)
tree24179cac49835de6570ea7ec38fb6a9076b4f39e /config/essentials/vis
parent32256e087aaf7744348a5ba33e802d5c8d9d97dd (diff)
checkpoint
Diffstat (limited to 'config/essentials/vis')
-rw-r--r--config/essentials/vis/visrc.lua30
1 files changed, 13 insertions, 17 deletions
diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua
index e35b436..9bc18f9 100644
--- a/config/essentials/vis/visrc.lua
+++ b/config/essentials/vis/visrc.lua
@@ -26,7 +26,6 @@ local format = require("format")
local fzfmru = require("fzf-mru")
fzfmru.fzfmru_path = 'grep "^' .. os.getenv("PWD") .. '" | fzf'
-
-- todo:
-- c-scope
-- c-tags
@@ -83,8 +82,12 @@ end, "Remove trailing whitespace")
--- MAPPINGS
-------------------------------------
-vis:map(m.NORMAL, "<C-p>", function() vis:command("fzf") end, "Open file with fzf")
-
+vis:map(m.NORMAL, " pf", function()
+ vis:command("fzf")
+end, "Open file with fzf")
+vis:map(m.NORMAL, " pr", function()
+ vis:command("fzfmru")
+end, "Open file with fzf")
vis:map(m.NORMAL, " r", function()
wrap_restore(vis.command, vis, "e $vis_filepath")
@@ -129,24 +132,17 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused a
"V:x/^(\\s*)(.+)$/ c/\\1>\\&2 printf '\\2: %s\\\\n' \"$\\2\"/<Enter><Escape>",
"Print variable"
)
- map_keys(
- m.NORMAL,
- ";v",
- "V:x/^(\\s*)(.+)$/ c/\\1\"$(\\2)\"/<Enter><Escape>",
- "Surround in variable"
- )
- map_keys(
- m.NORMAL,
- ";|",
- "V:x/\\| / c/|\n\t/<Enter><Escape>",
- "Wrap one-line multi pipe command"
- )
+ map_keys(m.NORMAL, ";v", 'V:x/^(\\s*)(.+)$/ c/\\1"$(\\2)"/<Enter><Escape>', "Surround in variable")
+ map_keys(m.NORMAL, ";|", "V:x/\\| / c/|\n\t/<Enter><Escape>", "Wrap one-line multi pipe command")
map_keys(
m.NORMAL,
";e",
- "V:x/^(\\s*)(.+)$/ c/\\1[ \"\\2\" ] || exit 1/<Enter><Escape>",
+ 'V:x/^(\\s*)(.+)$/ c/\\1[ "\\2" ] || exit 1/<Enter><Escape>',
"Condition exit if empty"
)
-
+ map_keys(m.NORMAL, ";sc", ":-/\\<case\\>/,/\\<esac\\>/<Enter>", "Expand to case")
+ map_keys(m.NORMAL, ";sw", ":-/\\<while/,/\\<done\\>/<Enter>", "Expand to while")
+ map_keys(m.NORMAL, ";sf", ":-/\\<for\\>/,/\\<done\\>/<Enter>", "Expand to for")
+ map_keys(m.NORMAL, ";si", ":-/\\<if\\>/,/\\<fi\\>/<Enter>", "Expand to if")
end
end)