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 nvim with nix, this isnt needed.
45 But it cant 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 require('nixCatsUtils').packageBinPath
88
89
90
91 ---------------------------------------------------------------------------------
92 nixCats.luaUtils.lazy
93 For instructions on using the lazy wrapper, check out this template example!
94
95 Use the following command in a new directory and check it out!
96
97 nix flake init -t github:BirdeeHub/nixCats-nvim#kickstart-nvim
98
99
100
101
102
103 require('nixCatsUtils.lazyCat').setup(nixCats.pawsible({"allPlugins", "start", "lazy.nvim" }), lazySpec, opts)
104
105
106
107
108
109 The tutorial:
110
111 kickstart-nvim = {
112 path = ./kickstart-nvim;
113 description = ''
114 The entirety of kickstart.nvim implemented as a nixCats flake.
115 With additional nix lsps for editing the nix part.
116 This is to serve as the tutorial for using the nixCats lazy wrapper.
117 '';
118 };
119
120 In that template, all notes about the lazy wrapper are in comments that begin
121 with the string: NOTE: nixCats: so to find all of the info, search for that.
122
123 One other note.
124
125 If you install your grammars via lazy.nvim rather than nix,
126 you will need to add a c compiler to your lspsAndRuntimeDeps section
127 in your categoryDefinitions
128
129 If you install your grammars via nix rather than lazy.nvim,
130 the only methods supported via the lazy.nvim wrapper are the following.
131
132 pkgs.vimPlugins.nvim-treesitter.withAllGrammars
133
134 pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: with plugins; [
135 nix
136 lua
137
138 ]);
139
140 pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins: pkgs.vimPlugins.nvim-treesitter.allGrammars)
141
142 builtins.attrValues pkgs.vimPlugins.nvim-treesitter.grammarPlugins
143
144 pkgs.neovimUtils.grammarToPlugin pkgs.tree-sitter-grammars.somegrammar
145
146 Summary: as long as pkgs.neovimUtils.grammarToPlugin is called on it somehow, it will work.
147
148 Any other ways will still work in nixCats if they would work in other schemes,
149 but not necessarily when using the lazy wrapper,
150 because the lazy wrapper has to be given their paths from nix,
151 and thus need to be sorted from other plugins somehow.
152
153 ---------------------------------------------------------------------------------
154 nixCats.luaUtils.paq-nvim
155 load the plugins via paq-nvim when not on nix
156 YOU are in charge of putting the plugin
157 urls and build steps in there, which will only be used when not on nix,
158 and you should keep any setup functions
159 OUT of that file, as they are ONLY loaded when this
160 configuration is NOT loaded via nix.
161
162 The way to think of this is, its very
163 similar to the main nix file for nixCats
164
165 It can be used to download your plugins,
166 and it has an opt for optional plugins.
167
168 we will do all our loading and configuring
169 elsewhere in our configuration, so that
170 we dont have to write it twice.
171
172 All the rest of the setup will be done using the normal setup functions later,
173 thus working regardless of what method loads the plugins.
174 only stuff pertaining to downloading and building should be added to paq.
175
176 require('nixCatsUtils.catPacker').setup({
177 { "BirdeeHub/lze", },
178 { "stevearc/oil.nvim", },
179 { 'joshdick/onedark.vim', },
180 { 'nvim-tree/nvim-web-devicons', },
181 { 'nvim-lua/plenary.nvim', },
182 { 'tpope/vim-repeat', },
183
184 { 'nvim-treesitter/nvim-treesitter-textobjects', opt = true, },
185 { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', opt = true, },
186
187 { 'nvim-telescope/telescope-fzf-native.nvim', build = ':!which make && make', opt = true, },
188 { 'nvim-telescope/telescope-ui-select.nvim', opt = true, },
189 {'nvim-telescope/telescope.nvim', opt = true, },
190
191
192 { 'williamboman/mason.nvim', opt = true, },
193 { 'williamboman/mason-lspconfig.nvim', opt = true, },
194 { 'j-hui/fidget.nvim', opt = true, },
195 { 'neovim/nvim-lspconfig', opt = true, },
196
197
198
199
200 { 'folke/lazydev.nvim', opt = true, },
201
202
203 { 'onsails/lspkind.nvim', opt = true, },
204
205
206
207
208 { 'L3MON4D3/LuaSnip', opt = true, as = "luasnip", },
209
210 { 'saadparwaiz1/cmp_luasnip', opt = true, },
211 { 'hrsh7th/cmp-nvim-lsp', opt = true, },
212 { 'hrsh7th/cmp-nvim-lua', opt = true, },
213 { 'hrsh7th/cmp-nvim-lsp-signature-help', opt = true, },
214 { 'hrsh7th/cmp-path', opt = true, },
215 { 'rafamadriz/friendly-snippets', opt = true, },
216 { 'hrsh7th/cmp-buffer', opt = true, },
217 { 'hrsh7th/cmp-cmdline', opt = true, },
218 { 'dmitmel/cmp-cmdline-history', opt = true, },
219 { 'hrsh7th/nvim-cmp', opt = true, },
220
221
222 { 'mfussenegger/nvim-lint', opt = true, },
223 { 'stevearc/conform.nvim', opt = true, },
224
225
226 { 'nvim-neotest/nvim-nio', opt = true, },
227 { 'rcarriga/nvim-dap-ui', opt = true, },
228 { 'theHamsta/nvim-dap-virtual-text', opt = true, },
229 { 'jay-babu/mason-nvim-dap.nvim', opt = true, },
230 { 'mfussenegger/nvim-dap', opt = true, },
231
232
233 { 'mbbill/undotree', opt = true, },
234 { 'tpope/vim-fugitive', opt = true, },
235 { 'tpope/vim-rhubarb', opt = true, },
236 { 'tpope/vim-sleuth', opt = true, },
237 { 'folke/which-key.nvim', opt = true, },
238 { 'lewis6991/gitsigns.nvim', opt = true, },
239 { 'nvim-lualine/lualine.nvim', opt = true, },
240 { 'lukas-reineke/indent-blankline.nvim', opt = true, },
241 { 'numToStr/Comment.nvim', opt = true, as = "comment.nvim", },
242 { 'kylechui/nvim-surround', opt = true, },
243 {
244 "iamcco/markdown-preview.nvim",
245 build = ":call mkdp#util#install()",
246 opt = true,
247 },
248
249
250 })
251
252 OK, again, none of the stuff in this file is needed
253 if you only load this setup via nix, but it is an option.
254 =================================================================================
255 vim:tw=78:ts=8:ft=help:norl: