-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
table.lua
48 lines (41 loc) · 936 Bytes
/
table.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
local M = {
'table',
requires = { 'dhruvasagar/vim-table-mode' },
desc = 'format table',
on = 'TableModeToggle',
}
M.defaultConfig = {
{ 'table' },
{
motion_up_map = '[{',
motion_down_map = ']}',
motion_left_map = '[[',
motion_right_map = ']]',
map_prefix = '<leader>T',
},
}
function M.config(config)
local g = vim.g
for key, value in pairs(config.table) do g['table_mode_' .. key] = value end
end
M.commands = {
TableModeToggleGFM = function()
local b = vim.b
b.table_mode_corner = '|'
b.table_mode_separator = '|'
b.table_mode_fillchar = '-'
b.table_mode_corner_corner = '|'
b.table_mode_align_char = ':'
vim.cmd.TableModeToggle()
end,
TableModeToggleNormal = function()
local b = vim.b
b.table_mode_corner = '+'
b.table_mode_separator = '|'
b.table_mode_fillchar = '-'
b.table_mode_corner_corner = '+'
b.table_mode_align_char = ':'
vim.cmd.TableModeToggle()
end,
}
return M