nvim-config-kickstart/lua/bepo.lua

68 lines
3.2 KiB
Lua
Raw Normal View History

2023-12-23 23:01:01 +00:00
-- colorise les nbsp
-- highlight NbSp ctermbg=lightgray guibg=lightred
--hi NbSps ctermbg=lightred guibg=lightred
--match NbSps /\%xa0\|\%u202F/
-- bépo
2023-12-25 13:49:47 +00:00
vim.opt.listchars:append({nbsp = "·", trail = "¤", eol = ''})
2023-12-23 23:01:01 +00:00
vim.opt.list = true
-- {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