1
0
Fork 0
dot/.config/vis/visrc.lua

80 lines
2.4 KiB
Lua

require('vis')
vis.events.subscribe(vis.events.INIT, function()
vis.options.theme = require("themes.basic")
vis:map(vis.modes.NORMAL, 'y', '<vis-register>+<vis-operator-yank>')
vis:map(vis.modes.VISUAL, 'y', '<vis-register>+<vis-operator-yank>')
vis:map(vis.modes.NORMAL, 'y', '<vis-register>+<vis-operator-yank>')
vis:map(vis.modes.VISUAL, 'd', '<vis-register>+<vis-operator-delete>')
vis:map(vis.modes.VISUAL_LINE, 'd', '<vis-register>+<vis-operator-delete>')
vis:map(vis.modes.VISUAL_LINE, 'd', '<vis-register>+<vis-operator-delete>')
vis:map(vis.modes.NORMAL, 'p', '<vis-register>+<vis-put-after>')
vis:map(vis.modes.VISUAL, 'p', '<vis-register>+<vis-put-after>')
vis:map(vis.modes.VISUAL_LINE, 'p', '<vis-register>+<vis-put-after>')
vis:map(vis.modes.NORMAL, 'P', '<vis-register>+<vis-put-before>')
vis:map(vis.modes.VISUAL, 'P', '<vis-register>+<vis-put-before>')
vis:map(vis.modes.VISUAL_LINE, 'P', '<vis-register>+<vis-put-before>')
vis.options.autoindent = true
vis.options.ignorecase = true
end)
vis.events.subscribe(vis.events.WIN_OPEN, function(win)
win.options.breakat = " .])}_"
win.options.colorcolumn = 81
win.options.relativenumbers = true
win.options.tabwidth = 2
win.options.wrapcolumn = 81
end)
local modes = {
[vis.modes.NORMAL] = 'NORMAL',
[vis.modes.OPERATOR_PENDING] = 'OPERATOR-PENDING',
[vis.modes.VISUAL] = 'VISUAL',
[vis.modes.VISUAL_LINE] = 'VISUAL-LINE',
[vis.modes.INSERT] = 'INSERT',
[vis.modes.REPLACE] = 'REPLACE',
}
vis.events.subscribe(vis.events.WIN_STATUS, function(win)
local left_parts = {}
local right_parts = {}
local file = win.file
local selection = win.selection
local file_info = (file.name or '[No Name]')..(file.modified and '[+]' or '')
if vis.win == win then
-- mode
table.insert(left_parts, modes[vis.mode])
-- selection
table.insert(left_parts, selection.number..'/'..#win.selections)
-- file info
file_info =
file_info
..':'
..(vis.count or '')
..(vis.input_queue or '')
..(vis.recording and '@' or '')
-- character under cursor
table.insert(right_parts,
'<'
..(string.byte(file:content(selection.pos, 1)) or '0')
..'>')
end
table.insert(left_parts, file_info)
-- line and column count
table.insert(right_parts, #file.lines..'/'..selection.line)
table.insert(right_parts, selection.col)
local left = table.concat(left_parts, " ")
local right = table.concat(right_parts, " ")
win:status(left, right);
end)