summaryrefslogtreecommitdiff
path: root/init.lua
blob: 596c4ed8958e7d1ac0dd2a3250388a4ea26ff2e2 (plain)
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
string.relpath = function(str, sub, n)
	local result = {}
	n = type(sub) == "string" and n or sub
	if type(n) == "number" and n > 0 then
		for match in (str .. "."):gmatch("(.-)%.") do
			table.insert(result, match)
		end
		while n > 0 do
			table.remove(result)
			n = n - 1
		end
	else
		table.insert(result, str)
	end
	if type(sub) == "string" then
		table.insert(result, sub)
	end
	return #result == 1 and result[1] or table.concat(result, ".")
end

if not table.pack then
	table.pack = function(...)
		return { n = select("#", ...), ... }
	end
end

vim.loader.enable()
vim.g.mapleader = " "
vim.g.maplocalleader = " "
vim.o.exrc = false
vim.g.netrw_liststyle = 0
vim.g.netrw_banner = 0

if vim.g.vscode == nil then
	require("bee")
end