1 =================================================================================
2 nixCats.luaUtils
3 ---------------------------------------------------------------------------------
4 nixCats.luaUtils.intro
5 nixCats has good integration with pckr and other similar Neovim package
6 managers.
7
8 Keep in mind they may not work so well on NixOS,
9 so when you are on NixOS you should load Neovim via Nix
10 (not sure if that part needs stating).
11
12 To get your Lua utils, run
13
14 nix flake init -t github:BirdeeHub/nixCats-nvim#luaUtils
15
16 ALSO keep in mind, if you are not using Nix, you will have to download
17 all your non-plugin, non-LSP dependencies manually, and this may suck.
18 Therefore, all this stuff about package managers may be of limited utility.
19
20 I have written some Lua utilities to enable this.
21 There is a template for them, and you can use the flake init -t
22 variable to import the luaUtils template in the root directory of your config
23 to add it to your project in the correct place.
24
25 -------------------------------------------------------------------------------
26 nixCats.luaUtils.setup
27 They are located within the lua/nixCatsUtils directory of the
28 flake. The main init.lua in it contains a require("nixCatsUtils").setup
29 function, and a require("nixCatsUtils").isNixCats variable.
30
31 The require("nixCatsUtils").isNixCats variable is true if
32 you installed Neovim via Nix, and otherwise it is false.
33 This is used to enable package managers only when not loaded via Nix.
34
35 You run the setup function in your init.lua file at the start, and tell it
36 what nixCats global command should default to if isNixCats is false.
37 The default is true.
38
39 IF YOU DO NOT DO THIS SETUP CALL:
40 the result will be that, when you load this folder without using Nix,
41 the global nixCats function which you use everywhere
42 to check for categories will throw an error.
43 This setup function will give it a default value.
44 Of course, if you only ever download Neovim with Nix, this isn't needed.
45 But it can't hurt to include anyway.
46
47 vim.g.mapleader = ' '
48 vim.g.maplocalleader = ' '
49
50
51 require('nixCatsUtils').setup {
52 non_nix_value = true,
53 }
54
55 if require('nixCatsUtils').isNixCats then
56 print('using nixCats')
57 end
58
59 it also has a few other things that may prove handy
60
61
62
63 require('nixCatsUtils').lazyAdd(v, o)
64
65
66
67
68
69
70 require('nixCatsUtils').enableForCategory(v, default)
71
72
73
74
75
76
77
78
79
80
81
82 require('nixCatsUtils').getCatOrDefault(v, default)
83
84
85
86 ---------------------------------------------------------------------------------
87 nixCats.luaUtils.lazy
88 For instructions on using the lazy wrapper, check out this template example!
89
90 Use the following command in a new directory and check it out!
91
92 nix flake init -t github:BirdeeHub/nixCats-nvim#kickstart-nvim
93
94
95
96
97
98 require('nixCatsUtils.lazyCat').setup(nixCats.pawsible({"allPlugins", "start", "lazy.nvim" }), lazySpec, opts)
99
100
101
102
103
104 The tutorial:
105
106 kickstart-nvim = {
107 path = ./kickstart-nvim;
108 description = ''
109 The entirety of kickstart.nvim implemented as a nixCats flake.
110 With additional Nix LSPs for editing the Nix part.
111 This is to serve as the tutorial for using the nixCats lazy wrapper.
112 '';
113 };
114
115 In that template, all notes about the lazy wrapper are in comments that begin
116 with the string: NOTE: nixCats: so to find all of the info, search for that.
117
118 One other note.
119
120 If you install your grammars via lazy.nvim rather than Nix,
121 you will need to add a c compiler to your lspsAndRuntimeDeps section
122 in your categoryDefinitions.
123
124 If you install your grammars via Nix rather than lazy.nvim,
125 the only methods supported via the lazy.nvim wrapper are the following.
126
127 pkgs.vimPlugins.nvim-treesitter.withAllGrammars
128
129 pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: with plugins; [
130 nix
131 lua
132
133 ]);
134
135 pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: pkgs.vimPlugins.nvim-treesitter.allGrammars)
136
137 builtins.attrValues pkgs.vimPlugins.nvim-treesitter.grammarPlugins
138
139 pkgs.neovimUtils.grammarToPlugin pkgs.tree-sitter-grammars.somegrammar
140
141 Summary: as long as pkgs.neovimUtils.grammarToPlugin is called on it somehow, it will work.
142
143 Any other ways will still work in nixCats if they would work in other schemes,
144 but not necessarily when using the lazy wrapper,
145 because the lazy wrapper has to be given their paths from Nix,
146 and thus need to be sorted from other plugins somehow.
147
148 ---------------------------------------------------------------------------------
149 nixCats.luaUtils.paq-nvim
150 Load the plugins via paq-nvim when not on Nix
151 YOU are in charge of putting the plugin
152 urls and build steps in there, which will only be used when not on Nix,
153 and you should keep any setup functions
154 OUT of that file, as they are ONLY loaded when this
155 configuration is NOT loaded via Nix.
156
157 The way to think of this is as very similar to the main Nix file for nixCats.
158
159 It can be used to download your plugins, and it has an opt for optional plugins.
160
161 We will do all our loading and configuring
162 elsewhere in our configuration, so that
163 we don't have to write it twice.
164
165 All the rest of the setup will be done using the normal setup functions later,
166 thus working regardless of what method loads the plugins.
167 only stuff pertaining to downloading and building should be added to paq.
168
169 require('nixCatsUtils.catPacker').setup({
170 { "BirdeeHub/lze", },
171 { "stevearc/oil.nvim", },
172 { 'joshdick/onedark.vim', },
173 { 'nvim-tree/nvim-web-devicons', },
174 { 'nvim-lua/plenary.nvim', },
175 { 'tpope/vim-repeat', },
176
177 { 'nvim-treesitter/nvim-treesitter-textobjects', opt = true, },
178 { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opt = true, },
179
180 { 'nvim-telescope/telescope-fzf-native.nvim', build = ':!which make && make', opt = true, },
181 { 'nvim-telescope/telescope-ui-select.nvim', opt = true, },
182 {'nvim-telescope/telescope.nvim', opt = true, },
183
184
185 { 'williamboman/mason.nvim', opt = true, },
186 { 'williamboman/mason-lspconfig.nvim', opt = true, },
187 { 'j-hui/fidget.nvim', opt = true, },
188 { 'neovim/nvim-lspconfig', opt = true, },
189
190
191
192
193 { 'folke/lazydev.nvim', opt = true, },
194
195
196 { 'onsails/lspkind.nvim', opt = true, },
197
198
199
200
201 { 'L3MON4D3/LuaSnip', opt = true, as = "luasnip", },
202
203 { 'saadparwaiz1/cmp_luasnip', opt = true, },
204 { 'hrsh7th/cmp-nvim-lsp', opt = true, },
205 { 'hrsh7th/cmp-nvim-lua', opt = true, },
206 { 'hrsh7th/cmp-nvim-lsp-signature-help', opt = true, },
207 { 'hrsh7th/cmp-path', opt = true, },
208 { 'rafamadriz/friendly-snippets', opt = true, },
209 { 'hrsh7th/cmp-buffer', opt = true, },
210 { 'hrsh7th/cmp-cmdline', opt = true, },
211 { 'dmitmel/cmp-cmdline-history', opt = true, },
212 { 'hrsh7th/nvim-cmp', opt = true, },
213
214
215 { 'mfussenegger/nvim-lint', opt = true, },
216 { 'stevearc/conform.nvim', opt = true, },
217
218
219 { 'nvim-neotest/nvim-nio', opt = true, },
220 { 'rcarriga/nvim-dap-ui', opt = true, },
221 { 'theHamsta/nvim-dap-virtual-text', opt = true, },
222 { 'jay-babu/mason-nvim-dap.nvim', opt = true, },
223 { 'mfussenegger/nvim-dap', opt = true, },
224
225
226 { 'mbbill/undotree', opt = true, },
227 { 'tpope/vim-fugitive', opt = true, },
228 { 'tpope/vim-rhubarb', opt = true, },
229 { 'tpope/vim-sleuth', opt = true, },
230 { 'folke/which-key.nvim', opt = true, },
231 { 'lewis6991/gitsigns.nvim', opt = true, },
232 { 'nvim-lualine/lualine.nvim', opt = true, },
233 { 'lukas-reineke/indent-blankline.nvim', opt = true, },
234 { 'numToStr/Comment.nvim', opt = true, as = "comment.nvim", },
235 { 'kylechui/nvim-surround', opt = true, },
236 {
237 "iamcco/markdown-preview.nvim",
238 build = ":call mkdp#util#install()",
239 opt = true,
240 },
241
242
243 })
244
245 Okay, again, none of the stuff in this file is needed
246 if you only load this setup via Nix, but it is an option.
247 =================================================================================
248 vim:tw=78:ts=8:ft=help:norl: