Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
70e991e51c | |||
![]() |
4eda76f40c | ||
![]() |
40226016a3 | ||
![]() |
801b6f556a | ||
![]() |
babf417ed5 |
50
Readme.md
50
Readme.md
@ -13,9 +13,6 @@ tags:
|
|||||||
- Bepo
|
- Bepo
|
||||||
- Lisp
|
- Lisp
|
||||||
- Fennel
|
- Fennel
|
||||||
#images:
|
|
||||||
#- /telescope-repo-nvim/opengraph.png
|
|
||||||
#- /telescope-repo-nvim/opengraph.webp
|
|
||||||
---
|
---
|
||||||
{{< github_badge >}}
|
{{< github_badge >}}
|
||||||
|
|
||||||
@ -27,7 +24,7 @@ end_insert -->
|
|||||||
# ⌨️ bepo.nvim
|
# ⌨️ bepo.nvim
|
||||||
<!-- end_remove -->
|
<!-- end_remove -->
|
||||||
|
|
||||||
 [](https://cj.rs/riss) 
|
 [](https://cj.rs/riss)  
|
||||||
|
|
||||||
<!-- insert
|
<!-- insert
|
||||||
{{< rawhtml >}}
|
{{< rawhtml >}}
|
||||||
@ -39,13 +36,32 @@ 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`)
|
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`)
|
||||||
|
|
||||||
## Example Use
|
## Installation
|
||||||
|
|
||||||
You should call the extension early in your config, so that you can erase mappings later (or with later extensions) more easily.
|
Add the plugin `cljoly/bepo.nvim` to your package manager.
|
||||||
|
|
||||||
|
If you don’t 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:
|
||||||
|
|
||||||
``` lua
|
``` lua
|
||||||
require("bepo").setup()
|
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:
|
You can also apply only some mapping groups:
|
||||||
``` lua
|
``` lua
|
||||||
@ -57,6 +73,24 @@ require("bepo").window()
|
|||||||
|
|
||||||
See [the help file][help] for more details and the mappings installed.
|
See [the help file][help] for more details and the mappings installed.
|
||||||
|
|
||||||
[vb]: https://github.com/michamos/vim-bepo
|
## Reporting bugs
|
||||||
[help]: https://github.com/cljoly/bepo.nvim/blob/main/doc/bepo-nvim.txt
|
|
||||||
|
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 can’t 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/
|
[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
|
||||||
|
10
doc/tags
Normal file
10
doc/tags
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
!_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*
|
113
fnl/bepo.fnl
113
fnl/bepo.fnl
@ -1,4 +1,5 @@
|
|||||||
;;; bepo.nvim: bepo mapping for neovim
|
;;; bepo.nvim: bepo mapping for neovim
|
||||||
|
|
||||||
;; Copyright 2022 Clément Joly
|
;; Copyright 2022 Clément Joly
|
||||||
;;
|
;;
|
||||||
;; Licensed under the Apache License, Version 2.0 (the "License");
|
;; Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -36,7 +37,7 @@
|
|||||||
(map-normal key target)
|
(map-normal key target)
|
||||||
(map-text-object key target))
|
(map-text-object key target))
|
||||||
|
|
||||||
(macro 𝛅 [...]
|
(macro def-documented [...]
|
||||||
"When called with the right context, this will print the documentation of the
|
"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
|
mappings, instead of attempting to bind. Since we access _G, this needs to be
|
||||||
called with --no-compiler-sandbox (see
|
called with --no-compiler-sandbox (see
|
||||||
@ -68,55 +69,98 @@
|
|||||||
`(local ,doc-struct.fname ,doc-struct))
|
`(local ,doc-struct.fname ,doc-struct))
|
||||||
`(fn ,(unpack [...]))))
|
`(fn ,(unpack [...]))))
|
||||||
|
|
||||||
(𝛅 mapping-movement [] "on préserve {hjkl} pour les directions"
|
(def-documented mapping-movement []
|
||||||
(map-all :c :h) (map-all :t :j) (map-all :s :k) (map-all :r :l)
|
"on préserve {hjkl} pour les directions"
|
||||||
(map-all :C :H) ;; ------
|
(map-all :c :h)
|
||||||
|
(map-all :t :j)
|
||||||
|
(map-all :s :k)
|
||||||
|
(map-all :r :l)
|
||||||
|
(map-all :C :H)
|
||||||
|
;; ------
|
||||||
;; {JKL} devient [TSR]
|
;; {JKL} devient [TSR]
|
||||||
(map-all :T :J) (map-all :S :K) (map-all :R :L) ;; ------
|
(map-all :T :J)
|
||||||
|
(map-all :S :K)
|
||||||
|
(map-all :R :L)
|
||||||
|
;; ------
|
||||||
;; on préserve les variantes avec 'g'
|
;; on préserve les variantes avec 'g'
|
||||||
(map-all :gt :gj) (map-all :gs :gk) ;; ------
|
(map-all :gt :gj)
|
||||||
|
(map-all :gs :gk)
|
||||||
|
;; ------
|
||||||
;; on préserve les variantes avec 'z'
|
;; on préserve les variantes avec 'z'
|
||||||
(map-all :zT :zt) (map-all :zt :zj) (map-all :zk :zs) (map-all :zs :zk)
|
(map-all :zT :zt)
|
||||||
|
(map-all :zt :zj)
|
||||||
|
(map-all :zk :zs)
|
||||||
|
(map-all :zs :zk)
|
||||||
;; ------
|
;; ------
|
||||||
;; {t} devient [h] pour être proche de [f]
|
;; {t} devient [h] pour être proche de [f]
|
||||||
(map-all :h :t) ;; idem pour {T} et [H]
|
(map-all :h :t)
|
||||||
(map-all :H :T) ;; {c} devient [l]
|
;; idem pour {T} et [H]
|
||||||
(map-all :l :c) ;; {C} devient [L]
|
(map-all :H :T)
|
||||||
(map-all :L :C) ;; {j} devient [r]
|
;; {c} devient [l]
|
||||||
(map-all :j :r) ;; {J} devient [R]
|
(map-all :l :c)
|
||||||
(map-all :J :R) ;; {k} devient [s]
|
;; {C} devient [L]
|
||||||
(map-all :k :s) ;; {K} devient [S]
|
(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))
|
(map-all :K :S))
|
||||||
|
|
||||||
(𝛅 mapping-tabs [] "le couple [gb]/[gé] agit sur les tabs"
|
(def-documented mapping-tabs []
|
||||||
(map-normal :gb :gT) (map-normal "gé" :gt) ;; [gB] va au premier tab
|
"le couple [gb]/[gé] agit sur les tabs"
|
||||||
(map-normal :gB ":execute \"silent! tabfirst\"<CR>") ;; [gÉ] au dernier
|
(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>")
|
(map-normal "gÉ" ":execute \"silent! tablast\"<CR>")
|
||||||
;; [gT] est libéré et peut agir sur les tags
|
;; [gT] est libéré et peut agir sur les tags
|
||||||
(map-normal :gT "<C-]>"))
|
(map-normal :gT "<C-]>"))
|
||||||
|
|
||||||
(𝛅 mapping-easy-access [] ;; [<] est moins accessible que [«]
|
(def-documented mapping-easy-access [] ;; [<] est moins accessible que [«]
|
||||||
(map-normal "«" "<") (map-visual "«" :<gv) ;; idem pour [»] et [>]
|
(map-normal "«" "<")
|
||||||
(map-normal "»" ">") (map-visual "»" :>gv)
|
(map-visual "«" :<gv)
|
||||||
|
;; idem pour [»] et [>]
|
||||||
|
(map-normal "»" ">")
|
||||||
|
(map-visual "»" :>gv)
|
||||||
;; idem pour [g,] et [g;] qui sont permutés
|
;; idem pour [g,] et [g;] qui sont permutés
|
||||||
(map-all "g," "g;") (map-all "g;" "g,")
|
(map-all "g," "g;")
|
||||||
|
(map-all "g;" "g,")
|
||||||
;; [w] est peu accessible, on utilise [é]
|
;; [w] est peu accessible, on utilise [é]
|
||||||
(map-all "é" :w) ;; idem pour [W] et [É]
|
(map-all "é" :w)
|
||||||
(map-all "É" :W) ;; idem pour [aw] et [aé]
|
;; idem pour [W] et [É]
|
||||||
(map-text-object "aé" :aw) ;; idem pour [aW] et [aÉ]
|
(map-all "É" :W)
|
||||||
(map-text-object "aÉ" :aW) ;; idem pour [iw] et [ié]
|
;; idem pour [aw] et [aé]
|
||||||
(map-text-object "ié" :iw) ;; idem pour [iW] et [iÉ]
|
(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))
|
(map-text-object "iÉ" :iW))
|
||||||
|
|
||||||
(𝛅 mapping-window [] "[w] est libre pour faire <C-w>, grâce à easy_access"
|
(def-documented mapping-window []
|
||||||
(map-normal :w :<C-w>) ;; et [w] pour faire <C-w><C-w>
|
"[w] est libre pour faire <C-w>, grâce à easy_access"
|
||||||
(map-normal :W :<C-w><C-w>) ;; on map [w]+direction, miniscule + majuscule
|
(map-normal :w :<C-w>)
|
||||||
(map-normal :wc :<C-w>h) (map-normal :wt :<C-w>j) (map-normal :ws :<C-w>k)
|
;; et [w] pour faire <C-w><C-w>
|
||||||
(map-normal :wr :<C-w>l) (map-normal :wC :<C-w>H) (map-normal :wT :<C-w>J)
|
(map-normal :W :<C-w><C-w>)
|
||||||
(map-normal :wS :<C-w>K) (map-normal :wR :<C-w>L)
|
;; 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
|
;; crée un split _h_orizontal
|
||||||
(map-normal :wh :<C-w>s) ;; va en haut à gauche
|
(map-normal :wh :<C-w>s)
|
||||||
(map-normal "wé" :<C-w>t) ;; déplace sur un nouveau tab
|
;; va en haut à gauche
|
||||||
|
(map-normal "wé" :<C-w>t)
|
||||||
|
;; déplace sur un nouveau tab
|
||||||
(map-normal "wÉ" :<C-w>T))
|
(map-normal "wÉ" :<C-w>T))
|
||||||
|
|
||||||
(fn setup []
|
(fn setup []
|
||||||
@ -138,3 +182,4 @@
|
|||||||
:tabs mapping-tabs
|
:tabs mapping-tabs
|
||||||
:easy_access mapping-easy-access
|
:easy_access mapping-easy-access
|
||||||
:window mapping-window}
|
:window mapping-window}
|
||||||
|
|
||||||
|
24
lua/bepo.lua
generated
24
lua/bepo.lua
generated
@ -41,24 +41,24 @@ local function mapping_movement()
|
|||||||
end
|
end
|
||||||
local function mapping_tabs()
|
local function mapping_tabs()
|
||||||
map_normal("gb", "gT")
|
map_normal("gb", "gT")
|
||||||
map_normal("g\195\169", "gt")
|
map_normal("g\195\169", "gt") -- \195\169 = gé
|
||||||
map_normal("gB", ":execute \"silent! tabfirst\"<CR>")
|
map_normal("gB", ":execute \"silent! tabfirst\"<CR>")
|
||||||
map_normal("g\195\137", ":execute \"silent! tablast\"<CR>")
|
map_normal("g\195\137", ":execute \"silent! tablast\"<CR>") -- \195\137 = gÉ
|
||||||
return map_normal("gT", "<C-]>")
|
return map_normal("gT", "<C-]>")
|
||||||
end
|
end
|
||||||
local function mapping_easy_access()
|
local function mapping_easy_access()
|
||||||
map_normal("\194\171", "<")
|
map_normal("\194\171", "<") -- \194\171 = «
|
||||||
map_visual("\194\171", "<gv")
|
map_visual("\194\171", "<gv") -- \194\171 = «
|
||||||
map_normal("\194\187", ">")
|
map_normal("\194\187", ">") -- \194\187 = »
|
||||||
map_visual("\194\187", ">gv")
|
map_visual("\194\187", ">gv") -- \194\187 = »
|
||||||
map_all("g,", "g;")
|
map_all("g,", "g;")
|
||||||
map_all("g;", "g,")
|
map_all("g;", "g,")
|
||||||
map_all("\195\169", "w")
|
map_all("\195\169", "w") -- \195\169 = é
|
||||||
map_all("\195\137", "W")
|
map_all("\195\137", "W") -- \195\137 = É
|
||||||
map_text_object("a\195\169", "aw")
|
map_text_object("a\195\169", "aw") -- \195\169 = é
|
||||||
map_text_object("a\195\137", "aW")
|
map_text_object("a\195\137", "aW") -- \195\137 = É
|
||||||
map_text_object("i\195\169", "iw")
|
map_text_object("i\195\169", "iw") -- \195\169 = é
|
||||||
return map_text_object("i\195\137", "iW")
|
return map_text_object("i\195\137", "iW") -- \195\137 = É
|
||||||
end
|
end
|
||||||
local function mapping_window()
|
local function mapping_window()
|
||||||
map_normal("w", "<C-w>")
|
map_normal("w", "<C-w>")
|
||||||
|
5
test/mock_setup.lua
Normal file
5
test/mock_setup.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-- 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()
|
Loading…
x
Reference in New Issue
Block a user