summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/plugins.lua
blob: a99b72a01dc817947f07adeafa15ef70772a3785 (plain) (blame)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
local packer = require 'ipacker'
local compiled = vim.fn.stdpath 'data' .. '/packer_compiled.lua'

local function plugn(plug) -- plug name
	return plug:gsub([[^.*/([^./]*)%.?.*$]], '%1')
end

local function plugi(conf) -- plug initialization string
	-- you can pass it the plugin spec
	if conf:find '/' then conf = plugn(conf) end
	return 'plugins.' .. conf
end

local sust = {}
colors = {
	default = 'default', -- in case of no packer
	scheme = 'tokyonight', -- in case of yes packer
	lualine = 'tokyonight', -- per plugin stuff from here on
}
packer.startup({function(iuse)
	local tf  = require 'transformer'
	local use = tf(iuse)

	local sus = tf(function(spec)
		table.insert(sust, plugi(spec[1]))
		iuse(spec)
	end)
	local kbd = sus { requires = {'folke/which-key.nvim'} }

	use 'wbthomason/packer.nvim'
	use 'Olical/aniseed'

	-- colors
	use 'folke/tokyonight.nvim'

	-- editor
	use { run = function()
			require 'nvim-treesitter.install'.update { with_sync = true }
		end }
		{ config = function() require 'nvim-treesitter.configs'.setup {
			ensure_installed = 'all',
			sync_install = true,
		} end }
		'nvim-treesitter/nvim-treesitter'
	sus 'neovim/nvim-lspconfig'
	kbd 'echasnovski/mini.nvim'

	sus 'linty-org/readline.nvim'
	sus 'nvim-lualine/lualine.nvim'
	kbd 'kyazdani42/nvim-tree.lua'
	use 'folke/which-key.nvim'

	-- interactive features
	use { run = 'make' } 'nvim-telescope/telescope-fzf-native.nvim'
	kbd { requires = 'nvim-lua/plenary.nvim' } 'nvim-telescope/telescope.nvim'

	kbd 'ggandor/leap.nvim'
	kbd 'Olical/conjure'

	-- language features
	use { ft = 'janet' } 'janet-lang/janet.vim'
	use { ft = {'scm', 'janet' } }
		'gpanders/nvim-parinfer'
end, config = {
	compile_path = compiled,
}})

local function configure()
	vim.cmd(':colo ' .. colors.scheme)
	for _, v in ipairs(sust) do require(v) end
	require 'which-key'.setup{}
	require 'bindings'
end

if ipacker == 0 then
	-- no packer
	vim.cmd(':colo ' .. colors.default)
elseif ipacker == 1 then
	-- run sync and wait for it before configuring
	packer.sync()
	vim.api.nvim_create_autocmd({'User PackerComplete'}, { callback = function()
		configure()
	end })
else
	-- run things normally
	if vim.fn.filereadable(compiled) > 0 then dofile(compiled) end
	configure()
end