Add bépo mappings

This commit is contained in:
Fabrice Mouhartem 2023-12-24 00:01:01 +01:00
parent 0deb9c900a
commit 3aca44bf20
2 changed files with 74 additions and 0 deletions

View File

@ -620,5 +620,7 @@ cmp.setup {
},
}
-- Personnalisation
require('bepo')
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

72
lua/bepo.lua Normal file
View File

@ -0,0 +1,72 @@
-- colorise les nbsp
-- highlight NbSp ctermbg=lightgray guibg=lightred
--hi NbSps ctermbg=lightred guibg=lightred
--match NbSps /\%xa0\|\%u202F/
-- bépo
vim.opt.listchars:append({nbsp = "·", trail = "¤"})
vim.opt.list = true
-- ii devient Esc
vim.api.nvim_set_keymap('i', 'ii', '<Esc>', {noremap = true, silent = true})
-- Y pour copier dans le presse papier
vim.api.nvim_set_keymap('', 'Y', '"+y', {})
-- {W} -> [É]
-- ——————————
-- On remappe W sur É :
-- Pour faciliter les manipulations de fenêtres, on utilise {W} comme un Ctrl+W :
local keymap = vim.keymap.set
local opts = {noremap = true, silent = true}
local map_list = {['é'] = 'w', ['É'] = 'W', ['w'] = '<C-w>'}
for key,binding in pairs(map_list) do
keymap('n', key, binding, opts)
end
-- Corollaire: on remplace les text objects aw, aW, iw et iW
-- pour effacer/remplacer un mot quand on nest pas au début (daé / laé).
local omap_list = {[''] = 'w', [''] = 'aW', [''] = 'iw', [''] = 'iW'}
for key,binding in pairs(omap_list) do
keymap('o', key, binding, opts)
end
-- [HJKL] <-> {CTSR}
-- ————————————————
map_list = {
['c'] = 'h', ['r'] = 'l', ['t'] = 'j', ['s'] = 'k', ['C'] = 'H', ['R'] = 'L', ['T'] = 'J', ['S'] = 'K', -- [HJKL] -> [CTSR]
['j'] = 't', ['J'] = 'T', ['l'] = 'c', ['L'] = 'C', ['h'] = 'r', ['H'] = 'R', ['k'] = 's', ['K'] = 'S', -- [CTSR] -> [HJKL]: J = jusqu'à, L = change, h = remplace, k = substitute
['zs'] = 'zj', ['zt'] = 'zk', -- Pour les replis
[']k'] = ']s', ['[k'] = '[s' , -- correction orthographique
}
for key, binding in pairs(map_list) do
keymap({'n', 'x'}, key, binding, opts)
end
-- Désambiguation de {g}
-- —————————————————————
-- ligne écran précédente / suivante (à l'intérieur d'une phrase)
-- onglets précédent/suivant : gé/gb, premier/dernier onglet : gÉ/gB,
-- g" = première ligne de lécran
local map_list = {['gs'] = 'gk', ['gt'] = 'gj', ['gb'] = 'gT', [''] = 'gt', ['gB'] = ':tabfirst<CR>', [''] = ':tablast<CR>', ['g"'] = 'g0', }
for key, binding in pairs(map_list) do
keymap({'n', 'x'}, key, binding, opts)
end
-- <> en direct
-- ————————————
vim.api.nvim_set_keymap('', '«', '<', {noremap = false, silent = true})
vim.api.nvim_set_keymap('', '»', '>', {noremap = false, silent = true})
-- Chiffres en accès direct
-- ————————————————————————
-- À décommenter si on souhaite les avoir
--local map_list = { ['"'] = '1', ['1'] = '"', ['«'] = '2', ['2'] = '<', ['»'] = '3', ['3'] = '>', ['('] = '4', ['4'] = '(', [')'] = '5', ['5'] = ')', ['@'] = '6', ['6'] = '@', ['+'] = '7', ['7'] = '+', ['-'] = '8', ['8'] = '-', ['/'] = '9', ['9'] = '/', ['*'] = '0', ['0'] = '*', }
--for key, binding in pairs(map_list) do
-- vim.api.nvim_set_keymap('', key, binding, { noremap = true, silent = true })
--end
-- Remaper la gestion des fenêtres
-- ———————————————————————————————
map_list = {['wt'] = '<C-w>j', ['ws'] = '<C-w>k', ['wc'] = '<C-w>h', ['wr'] = '<C-w>l', ['wd'] = '<C-w>c', ['wo'] = '<C-w>s', ['wp'] = '<C-w>o', ['w<SPACE>'] = ':split<CR>', ['w<CR>'] = ':vsplit<CR>', ['<A-w>'] = '<C-w><C-w>', }
for key, binding in pairs(map_list) do
vim.api.nvim_set_keymap('', key, binding, {noremap = true, silent = true})
end