~yerinalexey/dotfiles

9ba6eb02f1ace1f44058c70b9b571925f9877f20 — Alexey Yerin 9 months ago b6cb1e4
vis: overall cleanup
2 files changed, 23 insertions(+), 35 deletions(-)

D vis/mail_detect.lua
M vis/visrc.lua
D vis/mail_detect.lua => vis/mail_detect.lua +0 -5
@@ 1,5 0,0 @@
vis.ftdetect.filetypes.mail = {
	ext  = { "%.eml$" },
	mime = { "message/rfc822" },
	cmd  = { "set cc 72" }, -- Standard width of an email
}

M vis/visrc.lua => vis/visrc.lua +23 -30
@@ 1,14 1,7 @@
-- Standard vis module, providing parts of the Lua API
require('vis')
require('mail_detect')

-- Standard widths
vis.ftdetect.filetypes.markdown.cmd = { "set cc 80" };
vis.ftdetect.filetypes.text.cmd     = { "set cc 80" };
vis.ftdetect.filetypes.ansi_c.cmd   = { "set cc 80" };
vis.ftdetect.filetypes.go.cmd       = { "set cc 80" };
vis.ftdetect.filetypes.rust.cmd = {
	"set cc 80",
	"set expandtab",
	"set tabwidth 4",
};


@@ 16,28 9,10 @@ vis.ftdetect.filetypes.python.cmd = {
	"set expandtab",
	"set tabwidth 4",
};
vis.ftdetect.filetypes.diff.ext = { "%.diff$", "%.patch$", "%.rej$" };
vis.ftdetect.filetypes["git-commit"] = {
	ext = { "^COMMIT_EDITMSG$" },
	cmd = { "set cc 72" },
};
vis.ftdetect.filetypes.kotlin = {
	ext = { "%.kt$", "%.kts$" },
	cmd = {
		"set expandtab",
		"set tabwidth 4",
	},
};
vis.ftdetect.filetypes.java.cmd = {
	"set expandtab",
	"set tabwidth 4",
};
vis.ftdetect.filetypes.latex.cmd = {
	"set cc 80",
};
vis.ftdetect.filetypes.hare.cmd = {
	"set cc 80",
};
vis.ftdetect.filetypes.html.cmd = {
	"set expandtab",
	"set tabwidth 2",


@@ 53,23 28,41 @@ vis.ftdetect.filetypes.scheme.cmd = {
	"set expandtab",
	"set tabwidth 4",
};
vis.ftdetect.filetypes.diff.ext = { "%.diff$", "%.patch$", "%.rej$" };

-- Custom filetypes
vis.ftdetect.filetypes.mail = {
	ext  = { "%.eml$" },
	mime = { "message/rfc822" },
	cmd  = { "set cc 72" }, -- Standard width of an email
}
vis.ftdetect.filetypes["git-commit"] = {
	ext = { "^COMMIT_EDITMSG$" },
	cmd = { "set cc 72" },
};
vis.ftdetect.filetypes.kotlin = {
	ext = { "%.kt$", "%.kts$" },
	cmd = {
		"set expandtab",
		"set tabwidth 4",
	},
};

vis.events.subscribe(vis.events.INIT, function()
	vis:command('langmap йцукенгшщзфывапролдячсмитьЙЦУКЕНГШЩЗФЫВАПРОЛДЯЧСМИТЬЖ qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM:')
	vis:command('set theme onedark')
	vis:command('set autoindent')
end)

vis.events.subscribe(vis.events.WIN_OPEN, function(win)
	vis:command('langmap йцукенгшщзфывапролдячсмитьЙЦУКЕНГШЩЗФЫВАПРОЛДЯЧСМИТЬЖ qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM:')

	-- Line numbers
	vis:command('set nu')
	vis:command('set rnu')

	-- Auto indent
	vis:command('set ai')

	-- Many have problems reading atomically rename()d files
	vis:command('set savemethod inplace')

	vis:command('set cc 80')
end)

vis:map(vis.modes.VISUAL, ",c", function(keys)