fix: gé and gB mappings

This commit is contained in:
Clément Joly 2022-05-07 20:06:08 +00:00
parent 5aff414d44
commit b81af2dace
2 changed files with 21 additions and 6 deletions

View File

@ -13,6 +13,7 @@
;; See the License for the specific language governing permissions and ;; See the License for the specific language governing permissions and
;; limitations under the License. ;; limitations under the License.
;; ;;
;; Credit: Inspired by https://github.com/michamos/vim-bepo by Micha Moskovic
(fn map-text-object [key target] (fn map-text-object [key target]
"For text-objects mappings" "For text-objects mappings"
@ -28,7 +29,7 @@
(vim.api.nvim_set_keymap :n key target {:noremap true}) (vim.api.nvim_set_keymap :n key target {:noremap true})
(map-text-object key target))) (map-text-object key target)))
(fn setup [] (fn mapping-setup []
;; Keys still free ;; Keys still free
;; , and ; as they may be used as leaders ;; , and ; as they may be used as leaders
;; à and À ;; à and À
@ -73,9 +74,9 @@
;; le couple [gb]/[gé] agit sur les tabs ;; le couple [gb]/[gé] agit sur les tabs
(map-all "gé" :gt) (map-all "gé" :gt)
;; le couple [gb]/[gé] agit sur les tabs ;; le couple [gb]/[gé] agit sur les tabs
(map-all :gB ":execute " silent! tabfirst :<CR>) (map-all :gB ":execute \"silent! tabfirst\"<CR>")
;; [gB] va au premier tab ;; [gB] va au premier tab
(map-all "gÉ" ":execute " silent! tablast "<CR> ") (map-all "gÉ" ":execute \"silent! tablast\"<CR>")
;; [gÉ] au dernier ;; [gÉ] au dernier
(map-all :gT "<C-]>") (map-all :gT "<C-]>")
;; [gT] est libéré et peut agir sur les tags ;; [gT] est libéré et peut agir sur les tags
@ -131,5 +132,10 @@
;; déplace sur un nouveau tab ;; déplace sur un nouveau tab
) )
(fn setup []
(when (= vim.g.loaded_bepo_nvim nil)
(mapping-setup)
(set vim.g.loaded_bepo_nvim 1)))
{: setup} {: setup}

View File

@ -14,7 +14,7 @@ local function map_all(key, target)
return map_text_object(key, target) return map_text_object(key, target)
end end
end end
local function setup() local function mapping_setup()
map_all("c", "h") map_all("c", "h")
map_all("t", "j") map_all("t", "j")
map_all("s", "k") map_all("s", "k")
@ -35,8 +35,8 @@ local function setup()
map_all("K", "S") map_all("K", "S")
map_all("gb", "gT") map_all("gb", "gT")
map_all("g\195\169", "gt") map_all("g\195\169", "gt")
map_all("gB", ":execute ", __fnl_global__silent_21, tabfirst, "<CR>") map_all("gB", ":execute \"silent! tabfirst\"<CR>")
map_all("g\195\137", ":execute ", __fnl_global__silent_21, tablast, "<CR> ") map_all("g\195\137", ":execute \"silent! tablast\"<CR>")
map_all("gT", "<C-]>") map_all("gT", "<C-]>")
map_all("\194\171", "<") map_all("\194\171", "<")
map_all("\194\187", ">") map_all("\194\187", ">")
@ -62,4 +62,13 @@ local function setup()
map_all("w\195\169", "<C-w>t") map_all("w\195\169", "<C-w>t")
return map_all("w\195\137", "<C-w>T") return map_all("w\195\137", "<C-w>T")
end end
local function setup()
if (vim.g.loaded_bepo_nvim == nil) then
mapping_setup()
vim.g.loaded_bepo_nvim = 1
return nil
else
return nil
end
end
return {setup = setup} return {setup = setup}