Compare commits

..

1 Commits

Author SHA1 Message Date
Clément Joly
bbce509a37 feat: attempt to use macro in fennel to improve preformance
That seems to mess up the JIT optimisations, so doing that is actually
slower.
2022-11-13 13:01:21 +00:00
7 changed files with 284 additions and 284 deletions

View File

@ -13,6 +13,9 @@ tags:
- Bepo
- Lisp
- Fennel
#images:
#- /telescope-repo-nvim/opengraph.png
#- /telescope-repo-nvim/opengraph.webp
---
{{< github_badge >}}
@ -24,7 +27,7 @@ end_insert -->
# ⌨️ bepo.nvim
<!-- end_remove -->
![Neovim version](https://img.shields.io/badge/Neovim-0.5-57A143?style=flat&logo=neovim) [![](https://img.shields.io/badge/powered%20by-riss-lightgrey)](https://cj.rs/riss) ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/cljoly/bepo.nvim?color=darkgreen&sort=semver) ![Endpoint Badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fd.cj.rs%2Fnvim%2Fbepo.json&cacheSeconds=90000)
![Neovim version](https://img.shields.io/badge/Neovim-0.5-57A143?style=flat&logo=neovim) [![](https://img.shields.io/badge/powered%20by-riss-lightgrey)](https://cj.rs/riss) ![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/cljoly/bepo.nvim?color=darkgreen&sort=semver)
<!-- insert
{{< rawhtml >}}
@ -36,32 +39,13 @@ Mappings for the [bepo][] layout in Lua, inspired by [vim-bepo][vb]
It aims to be faster (takes only 0.4ms at startup on my machine, while [vim-bepo][vb] requires 1.6ms) and more customizable (see `:help bepo.nvim-cherry-pick`)
## Installation
## Example Use
Add the plugin `cljoly/bepo.nvim` to your package manager.
If you dont have a package manager yet, I use [paq.nvim][paq].
You can give it a try :).
Look at the [installation instructions][paq_install] and then add the following to your config:
```lua
require "paq" {
"cljoly/bepo.nvim",
-- ... other packages
}
```
Then restart neovim and run `PaqInstall`. That will install the bepo.nvim plugin.
## Usage
Once the plugin is installed, you can add a call to set up the bepo mappings to your config:
You should call the extension early in your config, so that you can erase mappings later (or with later extensions) more easily.
``` lua
require("bepo").setup()
```
You should call the extension early in your `init.lua`, so that you can erase mappings later (or with other extensions) more easily.
## Advanced Usage
You can also apply only some mapping groups:
``` lua
@ -73,24 +57,6 @@ require("bepo").window()
See [the help file][help] for more details and the mappings installed.
## Reporting bugs
Thanks for considering reporting a bug!
We want to know if the issue is caused by:
1. the plugin itself
2. your user configuration
3. the system configuration
Please try to reproduce the bug in nvim stripped of your user configuration by running:
```
nvim --clean -u test/mock_setup.lua
```
If you cant reproduce the bug in that “clean” nvim instance, it suggests that the bug comes from an interaction of the plugin with your user configuration. Please feel free to open an issue, mentioning that.
[bepo]: https://bepo.fr/
[help]: https://github.com/cljoly/bepo.nvim/blob/main/doc/bepo-nvim.txt
[paq]: https://github.com/savq/paq-nvim
[paq_install]: https://github.com/savq/paq-nvim?tab=readme-ov-file#installation
[vb]: https://github.com/michamos/vim-bepo
[help]: https://github.com/cljoly/bepo.nvim/blob/main/doc/bepo-nvim.txt
[bepo]: https://bepo.fr/

View File

@ -43,14 +43,33 @@ only the “window” and “movement” groups of mapping, use this instead of
The following subsections go into details of exactly what mappings are
in each group. “Modes” have the same meaning as in the |map-table|.
--------------------------------------------------------------------------------
require("bepo").window() *bepo.nvim-window*
[w] est libre pour faire <C-w>, grâce à easy_access
Modes Bepo Qwerty
n w <C-w>
n W <C-w><C-w>
n wc <C-w>h
n wt <C-w>j
n ws <C-w>k
n wr <C-w>l
n wC <C-w>H
n wT <C-w>J
n wS <C-w>K
n wR <C-w>L
n wh <C-w>s
n wé <C-w>t
n wÉ <C-w>T
--------------------------------------------------------------------------------
require("bepo").easy_access() *bepo.nvim-easy_access*
Modes Bepo Qwerty
n « <
x « <gv
v « <gv
n » >
x » >gv
v » >gv
nx g, g;
nx g; g,
nx é w
@ -60,6 +79,17 @@ require("bepo").easy_access() *bepo.nvim-easy_acces
ox ié iw
ox iÉ iW
--------------------------------------------------------------------------------
require("bepo").tabs() *bepo.nvim-tabs*
le couple [gb]/[gé] agit sur les tabs
Modes Bepo Qwerty
n gb gT
n gé gt
n gB :execute "silent! tabfirst"<CR>
n gÉ :execute "silent! tablast"<CR>
n gT <C-]>
--------------------------------------------------------------------------------
require("bepo").movement() *bepo.nvim-movement*
on préserve {hjkl} pour les directions
@ -88,35 +118,5 @@ on préserve {hjkl} pour les directions
nx k s
nx K S
--------------------------------------------------------------------------------
require("bepo").tabs() *bepo.nvim-tabs*
le couple [gb]/[gé] agit sur les tabs
Modes Bepo Qwerty
n gb gT
n gé gt
n gB :execute "silent! tabfirst"<CR>
n gÉ :execute "silent! tablast"<CR>
n gT <C-]>
--------------------------------------------------------------------------------
require("bepo").window() *bepo.nvim-window*
[w] est libre pour faire <C-w>, grâce à easy_access
Modes Bepo Qwerty
n w <C-w>
n W <C-w><C-w>
n wc <C-w>h
n wt <C-w>j
n ws <C-w>k
n wr <C-w>l
n wC <C-w>H
n wT <C-w>J
n wS <C-w>K
n wR <C-w>L
n wh <C-w>s
n wé <C-w>t
n wÉ <C-w>T
vim:tw=78:ts=8:ft=help:norl:

View File

@ -1,10 +0,0 @@
!_TAG_FILE_ENCODING utf-8 //
bepo.nvim bepo-nvim.txt /*bepo.nvim*
bepo.nvim-always-free bepo-nvim.txt /*bepo.nvim-always-free*
bepo.nvim-cherry-pick bepo-nvim.txt /*bepo.nvim-cherry-pick*
bepo.nvim-easy_access bepo-nvim.txt /*bepo.nvim-easy_access*
bepo.nvim-movement bepo-nvim.txt /*bepo.nvim-movement*
bepo.nvim-setup bepo-nvim.txt /*bepo.nvim-setup*
bepo.nvim-tabs bepo-nvim.txt /*bepo.nvim-tabs*
bepo.nvim-usage bepo-nvim.txt /*bepo.nvim-usage*
bepo.nvim-window bepo-nvim.txt /*bepo.nvim-window*

View File

@ -1,5 +1,4 @@
;;; bepo.nvim: bepo mapping for neovim
;; Copyright 2022 Clément Joly
;;
;; Licensed under the Apache License, Version 2.0 (the "License");
@ -16,37 +15,38 @@
;;
;; Credit: Inspired by https://github.com/michamos/vim-bepo by Micha Moskovic
(fn map-text-object [key target]
(macro map-text-object [key target]
"For text-objects mappings"
(vim.api.nvim_set_keymap :o key target {:noremap true})
(vim.api.nvim_set_keymap :x key target {:noremap true})
nil)
`(do
(vim.api.nvim_set_keymap :o ,key ,target {:noremap true})
(vim.api.nvim_set_keymap :x ,key ,target {:noremap true})
nil))
(fn map-visual [key target]
"For visual mode mappings"
(vim.api.nvim_set_keymap :x key target {:noremap true})
nil)
(fn map-normal [key target]
(macro map-visual [key target]
"For normal mode mappings"
(vim.api.nvim_set_keymap :n key target {:noremap true})
nil)
`(vim.api.nvim_set_keymap :v ,key ,target {:noremap true}))
(fn map-all [key target]
(macro map-normal [key target]
"For normal mode mappings"
`(vim.api.nvim_set_keymap :n ,key ,target {:noremap true}))
(macro map-all [key target]
"For all directional mappings"
(map-normal key target)
(map-text-object key target))
`(do
(map-normal ,key ,target)
(map-text-object ,key ,target)
nil))
(macro def-documented [...]
(macro 𝛅 [...]
"When called with the right context, this will print the documentation of the
mappings, instead of attempting to bind. Since we access _G, this needs to be
called with --no-compiler-sandbox (see
https://fennel-lang.org/reference#compiler-environment)"
(fn fun-to-mods [fun]
"Converts a function to the modes it sets mappings for"
(case (tostring fun)
(match (tostring fun)
:map-text-object :ox
:map-visual :x
:map-visual :v
:map-normal :n
:map-all :nx
other (error (.. "Unsupported function " other))))
@ -69,99 +69,56 @@
`(local ,doc-struct.fname ,doc-struct))
`(fn ,(unpack [...]))))
(def-documented mapping-movement []
"on préserve {hjkl} pour les directions"
(map-all :c :h)
(map-all :t :j)
(map-all :s :k)
(map-all :r :l)
(map-all :C :H)
;; ------
;; {JKL} devient [TSR]
(map-all :T :J)
(map-all :S :K)
(map-all :R :L)
;; ------
;; on préserve les variantes avec 'g'
(map-all :gt :gj)
(map-all :gs :gk)
;; ------
;; on préserve les variantes avec 'z'
(map-all :zT :zt)
(map-all :zt :zj)
(map-all :zk :zs)
(map-all :zs :zk)
;; ------
;; {t} devient [h] pour être proche de [f]
(map-all :h :t)
;; idem pour {T} et [H]
(map-all :H :T)
;; {c} devient [l]
(map-all :l :c)
;; {C} devient [L]
(map-all :L :C)
;; {j} devient [r]
(map-all :j :r)
;; {J} devient [R]
(map-all :J :R)
;; {k} devient [s]
(map-all :k :s)
;; {K} devient [S]
(map-all :K :S))
(𝛅 mapping-movement [] "on préserve {hjkl} pour les directions"
(map-all :c :h) (map-all :t :j) (map-all :s :k) (map-all :r :l)
(map-all :C :H) ;; ------
;; {JKL} devient [TSR]
(map-all :T :J) (map-all :S :K) (map-all :R :L) ;; ------
;; on préserve les variantes avec 'g'
(map-all :gt :gj) (map-all :gs :gk) ;; ------
;; on préserve les variantes avec 'z'
(map-all :zT :zt) (map-all :zt :zj) (map-all :zk :zs) (map-all :zs :zk)
;; ------
;; {t} devient [h] pour être proche de [f]
(map-all :h :t) ;; idem pour {T} et [H]
(map-all :H :T) ;; {c} devient [l]
(map-all :l :c) ;; {C} devient [L]
(map-all :L :C) ;; {j} devient [r]
(map-all :j :r) ;; {J} devient [R]
(map-all :J :R) ;; {k} devient [s]
(map-all :k :s) ;; {K} devient [S]
(map-all :K :S))
(def-documented mapping-tabs []
"le couple [gb]/[gé] agit sur les tabs"
(map-normal :gb :gT)
(map-normal "gé" :gt)
;; [gB] va au premier tab
(map-normal :gB ":execute \"silent! tabfirst\"<CR>")
;; [gÉ] au dernier
(map-normal "gÉ" ":execute \"silent! tablast\"<CR>")
;; [gT] est libéré et peut agir sur les tags
(map-normal :gT "<C-]>"))
(𝛅 mapping-tabs [] "le couple [gb]/[gé] agit sur les tabs"
(map-normal :gb :gT) (map-normal "gé" :gt) ;; [gB] va au premier tab
(map-normal :gB ":execute \"silent! tabfirst\"<CR>") ;; [gÉ] au dernier
(map-normal "gÉ" ":execute \"silent! tablast\"<CR>")
;; [gT] est libéré et peut agir sur les tags
(map-normal :gT "<C-]>"))
(def-documented mapping-easy-access [] ;; [<] est moins accessible que [«]
(map-normal "«" "<")
(map-visual "«" :<gv)
;; idem pour [»] et [>]
(map-normal "»" ">")
(map-visual "»" :>gv)
;; idem pour [g,] et [g;] qui sont permutés
(map-all "g," "g;")
(map-all "g;" "g,")
;; [w] est peu accessible, on utilise [é]
(map-all "é" :w)
;; idem pour [W] et [É]
(map-all "É" :W)
;; idem pour [aw] et [aé]
(map-text-object "aé" :aw)
;; idem pour [aW] et [aÉ]
(map-text-object "aÉ" :aW)
;; idem pour [iw] et [ié]
(map-text-object "ié" :iw)
;; idem pour [iW] et [iÉ]
(map-text-object "iÉ" :iW))
(𝛅 mapping-easy-access [] ;; [<] est moins accessible que [«]
(map-normal "«" "<") (map-visual "«" :<gv) ;; idem pour [»] et [>]
(map-normal "»" ">") (map-visual "»" :>gv)
;; idem pour [g,] et [g;] qui sont permutés
(map-all "g," "g;") (map-all "g;" "g,")
;; [w] est peu accessible, on utilise [é]
(map-all "é" :w) ;; idem pour [W] et [É]
(map-all "É" :W) ;; idem pour [aw] et [aé]
(map-text-object "aé" :aw) ;; idem pour [aW] et [aÉ]
(map-text-object "aÉ" :aW) ;; idem pour [iw] et [ié]
(map-text-object "ié" :iw) ;; idem pour [iW] et [iÉ]
(map-text-object "iÉ" :iW))
(def-documented mapping-window []
"[w] est libre pour faire <C-w>, grâce à easy_access"
(map-normal :w :<C-w>)
;; et [w] pour faire <C-w><C-w>
(map-normal :W :<C-w><C-w>)
;; on map [w]+direction, miniscule + majuscule
(map-normal :wc :<C-w>h)
(map-normal :wt :<C-w>j)
(map-normal :ws :<C-w>k)
(map-normal :wr :<C-w>l)
(map-normal :wC :<C-w>H)
(map-normal :wT :<C-w>J)
(map-normal :wS :<C-w>K)
(map-normal :wR :<C-w>L)
;; crée un split _h_orizontal
(map-normal :wh :<C-w>s)
;; va en haut à gauche
(map-normal "wé" :<C-w>t)
;; déplace sur un nouveau tab
(map-normal "wÉ" :<C-w>T))
(𝛅 mapping-window [] "[w] est libre pour faire <C-w>, grâce à easy_access"
(map-normal :w :<C-w>) ;; et [w] pour faire <C-w><C-w>
(map-normal :W :<C-w><C-w>) ;; on map [w]+direction, miniscule + majuscule
(map-normal :wc :<C-w>h) (map-normal :wt :<C-w>j) (map-normal :ws :<C-w>k)
(map-normal :wr :<C-w>l) (map-normal :wC :<C-w>H) (map-normal :wT :<C-w>J)
(map-normal :wS :<C-w>K) (map-normal :wR :<C-w>L)
;; crée un split _h_orizontal
(map-normal :wh :<C-w>s) ;; va en haut à gauche
(map-normal "wé" :<C-w>t) ;; déplace sur un nouveau tab
(map-normal "wÉ" :<C-w>T))
(fn setup []
"In any case, the following keys are always free for you to remap as you see fit:

237
lua/bepo.lua generated
View File

@ -1,79 +1,178 @@
local function map_text_object(key, target)
vim.api.nvim_set_keymap("o", key, target, {noremap = true})
vim.api.nvim_set_keymap("x", key, target, {noremap = true})
return nil
end
local function map_visual(key, target)
vim.api.nvim_set_keymap("x", key, target, {noremap = true})
return nil
end
local function map_normal(key, target)
vim.api.nvim_set_keymap("n", key, target, {noremap = true})
return nil
end
local function map_all(key, target)
map_normal(key, target)
return map_text_object(key, target)
end
local function mapping_movement()
map_all("c", "h")
map_all("t", "j")
map_all("s", "k")
map_all("r", "l")
map_all("C", "H")
map_all("T", "J")
map_all("S", "K")
map_all("R", "L")
map_all("gt", "gj")
map_all("gs", "gk")
map_all("zT", "zt")
map_all("zt", "zj")
map_all("zk", "zs")
map_all("zs", "zk")
map_all("h", "t")
map_all("H", "T")
map_all("l", "c")
map_all("L", "C")
map_all("j", "r")
map_all("J", "R")
map_all("k", "s")
return map_all("K", "S")
do
vim.api.nvim_set_keymap("n", "c", "h", {noremap = true})
vim.api.nvim_set_keymap("o", "c", "h", {noremap = true})
vim.api.nvim_set_keymap("x", "c", "h", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "t", "j", {noremap = true})
vim.api.nvim_set_keymap("o", "t", "j", {noremap = true})
vim.api.nvim_set_keymap("x", "t", "j", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "s", "k", {noremap = true})
vim.api.nvim_set_keymap("o", "s", "k", {noremap = true})
vim.api.nvim_set_keymap("x", "s", "k", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "r", "l", {noremap = true})
vim.api.nvim_set_keymap("o", "r", "l", {noremap = true})
vim.api.nvim_set_keymap("x", "r", "l", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "C", "H", {noremap = true})
vim.api.nvim_set_keymap("o", "C", "H", {noremap = true})
vim.api.nvim_set_keymap("x", "C", "H", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "T", "J", {noremap = true})
vim.api.nvim_set_keymap("o", "T", "J", {noremap = true})
vim.api.nvim_set_keymap("x", "T", "J", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "S", "K", {noremap = true})
vim.api.nvim_set_keymap("o", "S", "K", {noremap = true})
vim.api.nvim_set_keymap("x", "S", "K", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "R", "L", {noremap = true})
vim.api.nvim_set_keymap("o", "R", "L", {noremap = true})
vim.api.nvim_set_keymap("x", "R", "L", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "gt", "gj", {noremap = true})
vim.api.nvim_set_keymap("o", "gt", "gj", {noremap = true})
vim.api.nvim_set_keymap("x", "gt", "gj", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "gs", "gk", {noremap = true})
vim.api.nvim_set_keymap("o", "gs", "gk", {noremap = true})
vim.api.nvim_set_keymap("x", "gs", "gk", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "zT", "zt", {noremap = true})
vim.api.nvim_set_keymap("o", "zT", "zt", {noremap = true})
vim.api.nvim_set_keymap("x", "zT", "zt", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "zt", "zj", {noremap = true})
vim.api.nvim_set_keymap("o", "zt", "zj", {noremap = true})
vim.api.nvim_set_keymap("x", "zt", "zj", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "zk", "zs", {noremap = true})
vim.api.nvim_set_keymap("o", "zk", "zs", {noremap = true})
vim.api.nvim_set_keymap("x", "zk", "zs", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "zs", "zk", {noremap = true})
vim.api.nvim_set_keymap("o", "zs", "zk", {noremap = true})
vim.api.nvim_set_keymap("x", "zs", "zk", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "h", "t", {noremap = true})
vim.api.nvim_set_keymap("o", "h", "t", {noremap = true})
vim.api.nvim_set_keymap("x", "h", "t", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "H", "T", {noremap = true})
vim.api.nvim_set_keymap("o", "H", "T", {noremap = true})
vim.api.nvim_set_keymap("x", "H", "T", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "l", "c", {noremap = true})
vim.api.nvim_set_keymap("o", "l", "c", {noremap = true})
vim.api.nvim_set_keymap("x", "l", "c", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "L", "C", {noremap = true})
vim.api.nvim_set_keymap("o", "L", "C", {noremap = true})
vim.api.nvim_set_keymap("x", "L", "C", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "j", "r", {noremap = true})
vim.api.nvim_set_keymap("o", "j", "r", {noremap = true})
vim.api.nvim_set_keymap("x", "j", "r", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "J", "R", {noremap = true})
vim.api.nvim_set_keymap("o", "J", "R", {noremap = true})
vim.api.nvim_set_keymap("x", "J", "R", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "k", "s", {noremap = true})
vim.api.nvim_set_keymap("o", "k", "s", {noremap = true})
vim.api.nvim_set_keymap("x", "k", "s", {noremap = true})
end
vim.api.nvim_set_keymap("n", "K", "S", {noremap = true})
do
vim.api.nvim_set_keymap("o", "K", "S", {noremap = true})
vim.api.nvim_set_keymap("x", "K", "S", {noremap = true})
end
return nil
end
local function mapping_tabs()
map_normal("gb", "gT")
map_normal("g\195\169", "gt") -- \195\169 = gé
map_normal("gB", ":execute \"silent! tabfirst\"<CR>")
map_normal("g\195\137", ":execute \"silent! tablast\"<CR>") -- \195\137 = gÉ
return map_normal("gT", "<C-]>")
vim.api.nvim_set_keymap("n", "gb", "gT", {noremap = true})
vim.api.nvim_set_keymap("n", "g\195\169", "gt", {noremap = true})
vim.api.nvim_set_keymap("n", "gB", ":execute \"silent! tabfirst\"<CR>", {noremap = true})
vim.api.nvim_set_keymap("n", "g\195\137", ":execute \"silent! tablast\"<CR>", {noremap = true})
return vim.api.nvim_set_keymap("n", "gT", "<C-]>", {noremap = true})
end
local function mapping_easy_access()
map_normal("\194\171", "<") -- \194\171 = «
map_visual("\194\171", "<gv") -- \194\171 = «
map_normal("\194\187", ">") -- \194\187 = »
map_visual("\194\187", ">gv") -- \194\187 = »
map_all("g,", "g;")
map_all("g;", "g,")
map_all("\195\169", "w") -- \195\169 = é
map_all("\195\137", "W") -- \195\137 = É
map_text_object("a\195\169", "aw") -- \195\169 = é
map_text_object("a\195\137", "aW") -- \195\137 = É
map_text_object("i\195\169", "iw") -- \195\169 = é
return map_text_object("i\195\137", "iW") -- \195\137 = É
vim.api.nvim_set_keymap("n", "\194\171", "<", {noremap = true})
vim.api.nvim_set_keymap("v", "\194\171", "<gv", {noremap = true})
vim.api.nvim_set_keymap("n", "\194\187", ">", {noremap = true})
vim.api.nvim_set_keymap("v", "\194\187", ">gv", {noremap = true})
do
vim.api.nvim_set_keymap("n", "g,", "g;", {noremap = true})
vim.api.nvim_set_keymap("o", "g,", "g;", {noremap = true})
vim.api.nvim_set_keymap("x", "g,", "g;", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "g;", "g,", {noremap = true})
vim.api.nvim_set_keymap("o", "g;", "g,", {noremap = true})
vim.api.nvim_set_keymap("x", "g;", "g,", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "\195\169", "w", {noremap = true})
vim.api.nvim_set_keymap("o", "\195\169", "w", {noremap = true})
vim.api.nvim_set_keymap("x", "\195\169", "w", {noremap = true})
end
do
vim.api.nvim_set_keymap("n", "\195\137", "W", {noremap = true})
vim.api.nvim_set_keymap("o", "\195\137", "W", {noremap = true})
vim.api.nvim_set_keymap("x", "\195\137", "W", {noremap = true})
end
do
vim.api.nvim_set_keymap("o", "a\195\169", "aw", {noremap = true})
vim.api.nvim_set_keymap("x", "a\195\169", "aw", {noremap = true})
end
do
vim.api.nvim_set_keymap("o", "a\195\137", "aW", {noremap = true})
vim.api.nvim_set_keymap("x", "a\195\137", "aW", {noremap = true})
end
do
vim.api.nvim_set_keymap("o", "i\195\169", "iw", {noremap = true})
vim.api.nvim_set_keymap("x", "i\195\169", "iw", {noremap = true})
end
vim.api.nvim_set_keymap("o", "i\195\137", "iW", {noremap = true})
vim.api.nvim_set_keymap("x", "i\195\137", "iW", {noremap = true})
return nil
end
local function mapping_window()
map_normal("w", "<C-w>")
map_normal("W", "<C-w><C-w>")
map_normal("wc", "<C-w>h")
map_normal("wt", "<C-w>j")
map_normal("ws", "<C-w>k")
map_normal("wr", "<C-w>l")
map_normal("wC", "<C-w>H")
map_normal("wT", "<C-w>J")
map_normal("wS", "<C-w>K")
map_normal("wR", "<C-w>L")
map_normal("wh", "<C-w>s")
map_normal("w\195\169", "<C-w>t")
return map_normal("w\195\137", "<C-w>T")
vim.api.nvim_set_keymap("n", "w", "<C-w>", {noremap = true})
vim.api.nvim_set_keymap("n", "W", "<C-w><C-w>", {noremap = true})
vim.api.nvim_set_keymap("n", "wc", "<C-w>h", {noremap = true})
vim.api.nvim_set_keymap("n", "wt", "<C-w>j", {noremap = true})
vim.api.nvim_set_keymap("n", "ws", "<C-w>k", {noremap = true})
vim.api.nvim_set_keymap("n", "wr", "<C-w>l", {noremap = true})
vim.api.nvim_set_keymap("n", "wC", "<C-w>H", {noremap = true})
vim.api.nvim_set_keymap("n", "wT", "<C-w>J", {noremap = true})
vim.api.nvim_set_keymap("n", "wS", "<C-w>K", {noremap = true})
vim.api.nvim_set_keymap("n", "wR", "<C-w>L", {noremap = true})
vim.api.nvim_set_keymap("n", "wh", "<C-w>s", {noremap = true})
vim.api.nvim_set_keymap("n", "w\195\169", "<C-w>t", {noremap = true})
return vim.api.nvim_set_keymap("n", "w\195\137", "<C-w>T", {noremap = true})
end
local function setup()
if (vim.g.loaded_bepo_nvim == nil) then

View File

@ -37,12 +37,11 @@
(local mapping-struct-header {:bepo :Bepo :modes :Modes :qwerty :Qwerty})
(fn print-mapping-struct [struct]
(case struct
(match struct
{: bepo : modes : qwerty}
(let [qw (if (= ">" qwerty) "> " qwerty)]
(print (.. (right-align modes 6) " " (left-align bepo 4) " " qw)))
_
(error (.. "Received an invalid struct" (fennel.view struct)))))
_ (error (.. "Received an invalid struct" (fennel.view struct)))))
(fn print-lua-import [name]
(->> (values (left-align (string.format "require(\"bepo\").%s()" name) 46)
@ -103,16 +102,12 @@ in each group. “Modes” have the same meaning as in the |map-table|.
(let [tbl (collect [name docstruct (pairs bepo)]
(if (= name :setup) nil
(= (type docstruct) :table) (values name docstruct)
(error (.. "Invalid type for " name))))
tbl_keys (icollect [name docstructy (pairs tbl)]
name)]
(error (.. "Invalid type for " name))))]
(do
(table.sort tbl_keys)
(each [_ name (pairs tbl_keys)]
(table.sort tbl)
(each [name docstruct (pairs tbl)]
(do
(local docstruct (. tbl name))
(var need-header true)
(fn print-header []
(do
(print-mapping-struct mapping-struct-header)
@ -126,13 +121,11 @@ in each group. “Modes” have the same meaning as in the |map-table|.
(print-header))
(each [i mapping-struct (pairs docstruct.body)]
(if need-header (print-hedear))
(case mapping-struct
{:comment c}
(do
(print (.. "\n" c))
(set need-header true))
_
(print-mapping-struct mapping-struct)))
(match mapping-struct
{:comment c} (do
(print (.. "\n" c))
(set need-header true))
_ (print-mapping-struct mapping-struct)))
(print "")))))
;; We split the vim and the : to prevent vim from picking up that for the fennel file

View File

@ -1,5 +0,0 @@
-- The assumption is that this file will be used as configuration file with nvim
-- running from the root of the repository
vim.opt.runtimepath:append(vim.fn.getcwd())
require("bepo").setup()