summaryrefslogtreecommitdiff
path: root/users/seth/programs/neovim/default.nix
blob: 58d8071be5fee66d7e3709bab40556c8f01e840c (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
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
90
91
92
93
94
95
96
97
98
99
{
	config,
	pkgs,
	...
}: let
	neovimConfig =
		if config.seth.devel.enable
		then "vim.g.use_lsp_plugins = true"
		else "vim.g.use_lsp_plugins = false";

	lspPackages =
		if config.seth.devel.enable
		then
			with pkgs; [
				alejandra
				clang
				codespell
				deadnix
				nodePackages.alex
				nodePackages.bash-language-server
				nodePackages.prettier
				nodePackages.pyright
				pylint
				rust-analyzer
				rustfmt
				statix
				stylua
				sumneko-lua-language-server
				yapf
			]
		else [];

	lspPlugins =
		if config.seth.devel.enable
		then
			with pkgs.vimPlugins; [
				nvim-lspconfig
				null-ls-nvim
				plenary-nvim
				nvim-treesitter.withAllGrammars
				nvim-cmp
				cmp-nvim-lsp
				cmp-buffer
				cmp-path
				cmp-vsnip
				vim-vsnip
				luasnip
				cmp_luasnip
				trouble-nvim
				telescope-nvim
				gitsigns-nvim
				editorconfig-nvim
			]
		else [];
in {
	programs.neovim = {
		enable = true;
		extraPackages = lspPackages;
		plugins = with pkgs.vimPlugins;
			[
				barbar-nvim
				catppuccin-nvim
				lightspeed-nvim
				lualine-nvim
				nvim-tree-lua
				nvim-web-devicons
			]
			++ lspPlugins;
	};

	xdg.configFile.nvim = {
		source = ./config;
		recursive = true;
	};
	xdg.configFile."nvim/init.lua" = {
		text =
			neovimConfig
			+ ''

				local cmd = vim.cmd
				local opt = vim.opt

				require("getchoo")

				-- text options
				opt.tabstop = 2
				opt.shiftwidth = 2
				opt.expandtab = false
				opt.smartindent = true
				opt.wrap = false

				-- appearance
				opt.syntax = "on"
				cmd("filetype plugin indent on")
				opt.termguicolors = true
				vim.api.nvim_command("colorscheme catppuccin")
			'';
	};
}