this repo has no description
1-- ┌────────────────────┐
2-- │ Welcome to MiniMax │
3-- └────────────────────┘
4--
5-- This is a config designed to mostly use MINI. It provides out of the box
6-- a stable, polished, and feature rich Neovim experience. Its structure:
7--
8-- ├ init.lua Initial (this) file executed during startup
9-- ├ plugin/ Files automatically sourced during startup
10-- ├── 10_options.lua Built-in Neovim behavior
11-- ├── 20_keymaps.lua Custom mappings
12-- ├── 30_mini.lua MINI configuration
13-- ├── 40_plugins.lua Plugins outside of MINI
14-- ├ snippets/ User defined snippets (has demo file)
15-- ├ after/ Files to override behavior added by plugins
16-- ├── ftplugin/ Files for filetype behavior (has demo file)
17-- ├── lsp/ Language server configurations (has demo file)
18-- ├── snippets/ Higher priority snippet files (has demo file)
19--
20-- Config files are meant to be read, preferably inside a Neovim instance running
21-- this config and opened at its root. This will help you better understand your
22-- setup. Start with this file. Any order is possible, prefer the one listed above.
23-- Ways of navigating your config:
24-- - `<Space>` + `e` + (one of) `iokmp` - edit 'init.lua' or 'plugin/' files.
25-- - Inside config directory: `<Space>ff` (picker) or `<Space>ed` (explorer)
26-- - Navigate existing buffers with `[b`, `]b`, or `<Space>fb`.
27--
28-- Config files are also meant to be customized. Initially it is a baseline of
29-- a working config based on MINI. Modify it to make it yours. Some approaches:
30-- - Modify already existing files in a way that keeps them consistent.
31-- - Add new files in a way that keeps config consistent.
32-- Usually inside 'plugin/' or 'after/'.
33--
34-- Documentation comments like this can be found throughout the config.
35-- Common conventions:
36--
37-- - See `:h key-notation` for key notation used.
38-- - `:h xxx` means "documentation of helptag xxx". Either type text directly
39-- followed by Enter or type `<Space>fh` to open a helptag fuzzy picker.
40-- - "Type `<Space>fh`" means "press <Space>, followed by f, followed by h".
41-- Unless said otherwise, it assumes that Normal mode is current.
42-- - "See 'path/to/file'" means see open file at described path and read it.
43-- - `:SomeCommand ...` or `:lua ...` means execute mentioned command.
44
45-- Bootstrap 'mini.nvim' manually in a way that it gets managed by 'mini.deps'
46local mini_path = vim.fn.stdpath('data') .. '/site/pack/deps/start/mini.nvim'
47if not vim.loop.fs_stat(mini_path) then
48 vim.cmd('echo "Installing `mini.nvim`" | redraw')
49 local origin = 'https://github.com/nvim-mini/mini.nvim'
50 local clone_cmd = { 'git', 'clone', '--filter=blob:none', origin, mini_path }
51 vim.fn.system(clone_cmd)
52 vim.cmd('packadd mini.nvim | helptags ALL')
53 vim.cmd('echo "Installed `mini.nvim`" | redraw')
54end
55
56-- Plugin manager. Set up immediately for `now()`/`later()` helpers.
57-- Example usage:
58-- - `MiniDeps.add('...')` - use inside config to add a plugin
59-- - `:DepsUpdate` - update all plugins
60-- - `:DepsSnapSave` - save a snapshot of currently active plugins
61--
62-- See also:
63-- - `:h MiniDeps-overview` - how to use it
64-- - `:h MiniDeps-commands` - all available commands
65-- - 'plugin/30_mini.lua' - more details about 'mini.nvim' in general
66require('mini.deps').setup()
67
68-- Define config table to be able to pass data between scripts
69-- It is a global variable which can be use both as `_G.Config` and `Config`
70_G.Config = {}
71
72-- Define custom autocommand group and helper to create an autocommand.
73-- Autocommands are Neovim's way to define actions that are executed on events
74-- (like creating a buffer, setting an option, etc.).
75--
76-- See also:
77-- - `:h autocommand`
78-- - `:h nvim_create_augroup()`
79-- - `:h nvim_create_autocmd()`
80local gr = vim.api.nvim_create_augroup('custom-config', {})
81Config.new_autocmd = function(event, pattern, callback, desc)
82 local opts = { group = gr, pattern = pattern, callback = callback, desc = desc }
83 vim.api.nvim_create_autocmd(event, opts)
84end
85
86-- Some plugins and 'mini.nvim' modules only need setup during startup if Neovim
87-- is started like `nvim -- path/to/file`, otherwise delaying setup is fine
88Config.now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later
89
90
91
92-- CUSTOM
93
94vim.keymap.set('n', 'L', ':bn<CR>')
95vim.keymap.set('n', 'H', ':bp<CR>')
96
97MiniDeps.add({ source = 'projekt0n/github-nvim-theme', checkout = "main" })
98
99vim.api.nvim_create_autocmd("FileType", {
100 pattern = "qf",
101 callback = function()
102 -- Map <CR> to select the item and then close the quickfix/location list
103 vim.keymap.set("n", "<CR>", "<CR>:cclose<CR>", { buffer = true })
104 end,
105})