···66require('mini.deps').setup()
6768-- Define config table to be able to pass data between scripts
069_G.Config = {}
7071-- Define custom autocommand group and helper to create an autocommand.
···77-- - `:h nvim_create_augroup()`
78-- - `:h nvim_create_autocmd()`
79local gr = vim.api.nvim_create_augroup('custom-config', {})
80-_G.Config.new_autocmd = function(event, pattern, callback, desc)
81 local opts = { group = gr, pattern = pattern, callback = callback, desc = desc }
82 vim.api.nvim_create_autocmd(event, opts)
83end
8485-- Some plugins and 'mini.nvim' modules only need setup during startup if Neovim
86-- is started like `nvim -- path/to/file`, otherwise delaying setup is fine
87-_G.Config.now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later
888990
···66require('mini.deps').setup()
6768-- 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 = {}
7172-- Define custom autocommand group and helper to create an autocommand.
···78-- - `:h nvim_create_augroup()`
79-- - `:h nvim_create_autocmd()`
80local gr = vim.api.nvim_create_augroup('custom-config', {})
81+Config.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
8586-- 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
88+Config.now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later
899091
+47-47
.config/nvim/plugin/10_options.lua
···16-- reading. Consider preserving this or remove `-- stylua` lines to autoformat.
1718-- General ====================================================================
19-vim.g.mapleader = ' ' -- Use `<Space>` as <Leader> key
2021-vim.o.mouse = 'a' -- Enable mouse
22-- vim.o.mousescroll = 'ver:25,hor:6' -- Customize mouse scroll
23-vim.o.switchbuf = 'usetab' -- Use already opened buffers when switching
24-vim.o.undofile = true -- Enable persistent undo
2526-vim.o.shada = "'100,<50,s10,:1000,/100,@100,h" -- Limit ShaDa file (for startup)
2728-- Enable all filetype plugins and syntax (if not enabled, for better startup)
29vim.cmd('filetype plugin indent on')
30if vim.fn.exists('syntax_on') ~= 1 then vim.cmd('syntax enable') end
3132-- UI =========================================================================
33-vim.o.breakindent = true -- Indent wrapped lines to match line start
34-vim.o.breakindentopt = 'list:-1' -- Add padding for lists (if 'wrap' is set)
35-vim.o.colorcolumn = '+1' -- Draw column on the right of maximum width
36-vim.o.cursorline = true -- Enable current line highlighting
37-vim.o.linebreak = true -- Wrap lines at 'breakat' (if 'wrap' is set)
38-vim.o.list = true -- Show helpful text indicators
39-vim.o.number = true -- Show line numbers
40vim.wo.relativenumber = true
41-vim.o.pumheight = 10 -- Make popup menu smaller
42-vim.o.ruler = false -- Don't show cursor coordinates
43-vim.o.shortmess = 'CFOSWaco' -- Disable some built-in completion messages
44-vim.o.showmode = false -- Don't show mode in command line
45-vim.o.signcolumn = 'yes' -- Always show signcolumn (less flicker)
46-vim.o.splitbelow = true -- Horizontal splits will be below
47-vim.o.splitkeep = 'screen' -- Reduce scroll during window split
48-vim.o.splitright = true -- Vertical splits will be to the right
49-vim.o.winborder = 'single' -- Use border in floating windows
50-vim.o.wrap = false -- Don't visually wrap lines (toggle with \w)
5152-vim.o.cursorlineopt = 'screenline,number' -- Show cursor line per screen line
5354-- Special UI symbols. More is set via 'mini.basics' later.
55-vim.o.fillchars = 'eob: ,fold:╌'
56-vim.o.listchars = 'extends:…,nbsp:␣,precedes:…,tab:> '
5758-- Folds (see `:h fold-commands`, `:h zM`, `:h zR`, `:h zA`, `:h zj`)
59-vim.o.foldlevel = 10 -- Fold nothing by default; set to 0 or 1 to fold
60-vim.o.foldmethod = 'indent' -- Fold based on indent level
61-vim.o.foldnestmax = 10 -- Limit number of fold levels
62-vim.o.foldtext = '' -- Show text under fold with its highlighting
6364-- Editing ====================================================================
65-vim.o.autoindent = true -- Use auto indent
66-vim.o.expandtab = true -- Convert tabs to spaces
67-vim.o.formatoptions = 'rqnl1j'-- Improve comment editing
68-vim.o.ignorecase = true -- Ignore case during search
69-vim.o.incsearch = true -- Show search matches while typing
70-vim.o.infercase = true -- Infer case in built-in completion
71-vim.o.shiftwidth = 2 -- Use this number of spaces for indentation
72-vim.o.smartcase = true -- Respect case if search pattern has upper case
73-vim.o.smartindent = true -- Make indenting smart
74-vim.o.spelloptions = 'camel' -- Treat camelCase word parts as separate words
75-vim.o.tabstop = 2 -- Show tab as this number of spaces
76-vim.o.virtualedit = 'block' -- Allow going past end of line in blockwise mode
7778-vim.o.iskeyword = '@,48-57,_,192-255,-' -- Treat dash as `word` textobject part
7980-- Pattern for a start of numbered list (used in `gw`). This reads as
81-- "Start of list item is: at least one special character (digit, -, +, *)
82-- possibly followed by punctuation (. or `)`) followed by at least one space".
83-vim.o.formatlistpat = [[^\s*[0-9\-\+\*]\+[\.\)]*\s\+]]
8485-- Built-in completion
86-vim.o.complete = '.,w,b,kspell' -- Use less sources
87-vim.o.completeopt = 'menuone,noselect,fuzzy,nosort' -- Use custom behavior
8889-- Autocommands ===============================================================
9091-- Don't auto-wrap comments and don't insert comment leader after hitting 'o'.
92-- Do on `FileType` to always override these changes from filetype plugins.
93-local f = function() vim.cmd('setlocal formatoptions-=c formatoptions-=o') end
94-_G.Config.new_autocmd('FileType', nil, f, "Proper 'formatoptions'")
9596-- There are other autocommands created by 'mini.basics'. See 'plugin/30_mini.lua'.
97
···16-- reading. Consider preserving this or remove `-- stylua` lines to autoformat.
1718-- General ====================================================================
19+vim.g.mapleader = ' ' -- Use `<Space>` as <Leader> key
2021+vim.o.mouse = 'a' -- Enable mouse
22-- vim.o.mousescroll = 'ver:25,hor:6' -- Customize mouse scroll
23+vim.o.switchbuf = 'usetab' -- Use already opened buffers when switching
24+vim.o.undofile = true -- Enable persistent undo
2526+vim.o.shada = "'100,<50,s10,:1000,/100,@100,h" -- Limit ShaDa file (for startup)
2728-- Enable all filetype plugins and syntax (if not enabled, for better startup)
29vim.cmd('filetype plugin indent on')
30if vim.fn.exists('syntax_on') ~= 1 then vim.cmd('syntax enable') end
3132-- UI =========================================================================
33+vim.o.breakindent = true -- Indent wrapped lines to match line start
34+vim.o.breakindentopt = 'list:-1' -- Add padding for lists (if 'wrap' is set)
35+vim.o.colorcolumn = '+1' -- Draw column on the right of maximum width
36+vim.o.cursorline = true -- Enable current line highlighting
37+vim.o.linebreak = true -- Wrap lines at 'breakat' (if 'wrap' is set)
38+vim.o.list = true -- Show helpful text indicators
39+vim.o.number = true -- Show line numbers
40vim.wo.relativenumber = true
41+vim.o.pumheight = 10 -- Make popup menu smaller
42+vim.o.ruler = false -- Don't show cursor coordinates
43+vim.o.shortmess = 'CFOSWaco' -- Disable some built-in completion messages
44+vim.o.showmode = false -- Don't show mode in command line
45+vim.o.signcolumn = 'yes' -- Always show signcolumn (less flicker)
46+vim.o.splitbelow = true -- Horizontal splits will be below
47+vim.o.splitkeep = 'screen' -- Reduce scroll during window split
48+vim.o.splitright = true -- Vertical splits will be to the right
49+vim.o.winborder = 'single' -- Use border in floating windows
50+vim.o.wrap = false -- Don't visually wrap lines (toggle with \w)
5152+vim.o.cursorlineopt = 'screenline,number' -- Show cursor line per screen line
5354-- Special UI symbols. More is set via 'mini.basics' later.
55+vim.o.fillchars = 'eob: ,fold:╌'
56+vim.o.listchars = 'extends:…,nbsp:␣,precedes:…,tab:> '
5758-- Folds (see `:h fold-commands`, `:h zM`, `:h zR`, `:h zA`, `:h zj`)
59+vim.o.foldlevel = 10 -- Fold nothing by default; set to 0 or 1 to fold
60+vim.o.foldmethod = 'indent' -- Fold based on indent level
61+vim.o.foldnestmax = 10 -- Limit number of fold levels
62+vim.o.foldtext = '' -- Show text under fold with its highlighting
6364-- Editing ====================================================================
65+vim.o.autoindent = true -- Use auto indent
66+vim.o.expandtab = true -- Convert tabs to spaces
67+vim.o.formatoptions = 'rqnl1j' -- Improve comment editing
68+vim.o.ignorecase = true -- Ignore case during search
69+vim.o.incsearch = true -- Show search matches while typing
70+vim.o.infercase = true -- Infer case in built-in completion
71+vim.o.shiftwidth = 2 -- Use this number of spaces for indentation
72+vim.o.smartcase = true -- Respect case if search pattern has upper case
73+vim.o.smartindent = true -- Make indenting smart
74+vim.o.spelloptions = 'camel' -- Treat camelCase word parts as separate words
75+vim.o.tabstop = 2 -- Show tab as this number of spaces
76+vim.o.virtualedit = 'block' -- Allow going past end of line in blockwise mode
7778+vim.o.iskeyword = '@,48-57,_,192-255,-' -- Treat dash as `word` textobject part
7980-- Pattern for a start of numbered list (used in `gw`). This reads as
81-- "Start of list item is: at least one special character (digit, -, +, *)
82-- possibly followed by punctuation (. or `)`) followed by at least one space".
83+vim.o.formatlistpat = [[^\s*[0-9\-\+\*]\+[\.\)]*\s\+]]
8485-- Built-in completion
86+vim.o.complete = '.,w,b,kspell' -- Use less sources
87+vim.o.completeopt = 'menuone,noselect,fuzzy,nosort' -- Use custom behavior
8889-- Autocommands ===============================================================
9091-- Don't auto-wrap comments and don't insert comment leader after hitting 'o'.
92-- Do on `FileType` to always override these changes from filetype plugins.
93+local f = function() vim.cmd('setlocal formatoptions-=c formatoptions-=o') end
94+Config.new_autocmd('FileType', nil, f, "Proper 'formatoptions'")
9596-- There are other autocommands created by 'mini.basics'. See 'plugin/30_mini.lua'.
97
+1-1
.config/nvim/plugin/20_keymaps.lua
···49-- Create a global table with information about Leader groups in certain modes.
50-- This is used to provide 'mini.clue' with extra clues.
51-- Add an entry if you create a new group.
52-_G.Config.leader_group_clues = {
53 { mode = 'n', keys = '<Leader>b', desc = '+Buffer' },
54 { mode = 'n', keys = '<Leader>e', desc = '+Explore/Edit' },
55 { mode = 'n', keys = '<Leader>f', desc = '+Find' },
···49-- Create a global table with information about Leader groups in certain modes.
50-- This is used to provide 'mini.clue' with extra clues.
51-- Add an entry if you create a new group.
52+Config.leader_group_clues = {
53 { mode = 'n', keys = '<Leader>b', desc = '+Buffer' },
54 { mode = 'n', keys = '<Leader>e', desc = '+Explore/Edit' },
55 { mode = 'n', keys = '<Leader>f', desc = '+Find' },
+132-128
.config/nvim/plugin/30_mini.lua
···25-- Sometimes is needed only if Neovim is started as `nvim -- path/to/file`.
26-- - Everything else is delayed until the first draw with `later()`.
27local now, later = MiniDeps.now, MiniDeps.later
28-local now_if_args = _G.Config.now_if_args
2930-- Step one ===================================================================
31-- Enable 'miniwinter' color scheme. It comes with 'mini.nvim' and uses 'mini.hues'.
···88 later(MiniIcons.tweak_lsp_kind)
89end)
9091--- Miscellaneous small but useful functions. Example usage:
92--- - `<Leader>oz` - toggle between "zoomed" and regular view of current buffer
93--- - `<Leader>or` - resize window to its "editable width"
94--- - `:lua put_text(vim.lsp.get_clients())` - put output of a function below
95--- cursor in current buffer. Useful for a detailed exploration.
96--- - `:lua put(MiniMisc.stat_summary(MiniMisc.bench_time(f, 100)))` - run
97--- function `f` 100 times and report statistical summary of execution times
98---
99--- Uses `now()` for `setup_xxx()` to work when started like `nvim -- path/to/file`
100-now_if_args(function()
101- -- Makes `:h MiniMisc.put()` and `:h MiniMisc.put_text()` public
102- require('mini.misc').setup()
103-104- -- Change current working directory based on the current file path. It
105- -- searches up the file tree until the first root marker ('.git' or 'Makefile')
106- -- and sets their parent directory as a current directory.
107- -- This is helpful when simultaneously dealing with files from several projects.
108- MiniMisc.setup_auto_root()
109-110- -- Restore latest cursor position on file open
111- MiniMisc.setup_restore_cursor()
112-113- -- Synchronize terminal emulator background with Neovim's background to remove
114- -- possibly different color padding around Neovim instance
115- MiniMisc.setup_termbg_sync()
116-end)
117118-- Notifications provider. Shows all kinds of notifications in the upper right
119-- corner (by default). Example usage:
···159-- Buffers are ordered as they were created. Navigate with `[b` and `]b`.
160now(function() require('mini.tabline').setup() end)
16100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000162-- Step two ===================================================================
163164-- Extra 'mini.nvim' functionality.
···338-- still enabled as it provides more customization opportunities.
339later(function() require('mini.comment').setup() end)
340341--- Completion and signature help. Implements async "two stage" autocompletion:
342--- - Based on attached LSP servers that support completion.
343--- - Fallback (based on built-in keyword completion) if there is no LSP candidates.
344---
345--- Example usage in Insert mode with attached LSP:
346--- - Start typing text that should be recognized by LSP (like variable name).
347--- - After 100ms a popup menu with candidates appears.
348--- - Press `<Tab>` / `<S-Tab>` to navigate down/up the list. These are set up
349--- in 'mini.keymap'. You can also use `<C-n>` / `<C-p>`.
350--- - During navigation there is an info window to the right showing extra info
351--- that the LSP server can provide about the candidate. It appears after the
352--- candidate stays selected for 100ms. Use `<C-f>` / `<C-b>` to scroll it.
353--- - Navigating to an entry also changes buffer text. If you are happy with it,
354--- keep typing after it. To discard completion completely, press `<C-e>`.
355--- - After pressing special trigger(s), usually `(`, a window appears that shows
356--- the signature of the current function/method. It gets updated as you type
357--- showing the currently active parameter.
358---
359--- Example usage in Insert mode without an attached LSP or in places not
360--- supported by the LSP (like comments):
361--- - Start typing a word that is present in current or opened buffers.
362--- - After 100ms popup menu with candidates appears.
363--- - Navigate with `<Tab>` / `<S-Tab>` or `<C-n>` / `<C-p>`. This also updates
364--- buffer text. If happy with choice, keep typing. Stop with `<C-e>`.
365---
366--- It also works with snippet candidates provided by LSP server. Best experience
367--- when paired with 'mini.snippets' (which is set up in this file).
368-later(function()
369- -- Customize post-processing of LSP responses for a better user experience.
370- -- Don't show 'Text' suggestions (usually noisy) and show snippets last.
371- local process_items_opts = { kind_priority = { Text = -1, Snippet = 99 } }
372- local process_items = function(items, base)
373- return MiniCompletion.default_process_items(items, base, process_items_opts)
374- end
375- require('mini.completion').setup({
376- lsp_completion = {
377- -- Without this config autocompletion is set up through `:h 'completefunc'`.
378- -- Although not needed, setting up through `:h 'omnifunc'` is cleaner
379- -- (sets up only when needed) and makes it possible to use `<C-u>`.
380- source_func = 'omnifunc',
381- auto_setup = false,
382- process_items = process_items,
383- },
384- })
385-386- -- Set 'omnifunc' for LSP completion only when needed.
387- local on_attach = function(ev)
388- vim.bo[ev.buf].omnifunc = 'v:lua.MiniCompletion.completefunc_lsp'
389- end
390- _G.Config.new_autocmd('LspAttach', nil, on_attach, "Set 'omnifunc'")
391-392- -- Advertise to servers that Neovim now supports certain set of completion and
393- -- signature features through 'mini.completion'.
394- vim.lsp.config('*', { capabilities = MiniCompletion.get_lsp_capabilities() })
395-end)
396-397-- Autohighlight word under cursor with a customizable delay.
398-- Word boundaries are defined based on `:h 'iskeyword'` option.
399--
···416-- - `:h MiniDiff-diff-summary` - available summary information
417-- - `:h MiniDiff.gen_source` - available built-in sources
418later(function() require('mini.diff').setup() end)
419-420--- Navigate and manipulate file system
421---
422--- Navigation is done using column view (Miller columns) to display nested
423--- directories, they are displayed in floating windows in top left corner.
424---
425--- Manipulate files and directories by editing text as regular buffers.
426---
427--- Example usage:
428--- - `<Leader>ed` - open current working directory
429--- - `<Leader>ef` - open directory of current file (needs to be present on disk)
430---
431--- Basic navigation:
432--- - `l` - go in entry at cursor: navigate into directory or open file
433--- - `h` - go out of focused directory
434--- - Navigate window as any regular buffer
435--- - Press `g?` inside explorer to see more mappings
436---
437--- Basic manipulation:
438--- - After any following action, press `=` in Normal mode to synchronize, read
439--- carefully about actions, press `y` or `<CR>` to confirm
440--- - New entry: press `o` and type its name; end with `/` to create directory
441--- - Rename: press `C` and type new name
442--- - Delete: type `dd`
443--- - Move/copy: type `dd`/`yy`, navigate to target directory, press `p`
444---
445--- See also:
446--- - `:h MiniFiles-navigation` - more details about how to navigate
447--- - `:h MiniFiles-manipulation` - more details about how to manipulate
448--- - `:h MiniFiles-examples` - examples of common setups
449-later(function()
450- -- Enable directory/file preview
451- require('mini.files').setup({ windows = { preview = true } })
452-453- -- Add common bookmarks for every explorer. Example usage inside explorer:
454- -- - `'c` to navigate into your config directory
455- -- - `g?` to see available bookmarks
456- local add_marks = function()
457- MiniFiles.set_bookmark('c', vim.fn.stdpath('config'), { desc = 'Config' })
458- local minideps_plugins = vim.fn.stdpath('data') .. '/site/pack/deps/opt'
459- MiniFiles.set_bookmark('p', minideps_plugins, { desc = 'Plugins' })
460- MiniFiles.set_bookmark('w', vim.fn.getcwd, { desc = 'Working directory' })
461- end
462- _G.Config.new_autocmd('User', 'MiniFilesExplorerOpen', add_marks, 'Add bookmarks')
463-end)
464465-- Git integration for more straightforward Git actions based on Neovim's state.
466-- It is not meant as a fully featured Git client, only to provide helpers that
···25-- Sometimes is needed only if Neovim is started as `nvim -- path/to/file`.
26-- - Everything else is delayed until the first draw with `later()`.
27local now, later = MiniDeps.now, MiniDeps.later
28+local now_if_args = Config.now_if_args
2930-- Step one ===================================================================
31-- Enable 'miniwinter' color scheme. It comes with 'mini.nvim' and uses 'mini.hues'.
···88 later(MiniIcons.tweak_lsp_kind)
89end)
90000000000000000000000000009192-- Notifications provider. Shows all kinds of notifications in the upper right
93-- corner (by default). Example usage:
···133-- Buffers are ordered as they were created. Navigate with `[b` and `]b`.
134now(function() require('mini.tabline').setup() end)
135136+137+-- Step one or two ============================================================
138+-- Load now if Neovim is started like `nvim -- path/to/file`, otherwise - later.
139+-- This ensures a correct behavior for files opened during startup.
140+141+-- Completion and signature help. Implements async "two stage" autocompletion:
142+-- - Based on attached LSP servers that support completion.
143+-- - Fallback (based on built-in keyword completion) if there is no LSP candidates.
144+--
145+-- Example usage in Insert mode with attached LSP:
146+-- - Start typing text that should be recognized by LSP (like variable name).
147+-- - After 100ms a popup menu with candidates appears.
148+-- - Press `<Tab>` / `<S-Tab>` to navigate down/up the list. These are set up
149+-- in 'mini.keymap'. You can also use `<C-n>` / `<C-p>`.
150+-- - During navigation there is an info window to the right showing extra info
151+-- that the LSP server can provide about the candidate. It appears after the
152+-- candidate stays selected for 100ms. Use `<C-f>` / `<C-b>` to scroll it.
153+-- - Navigating to an entry also changes buffer text. If you are happy with it,
154+-- keep typing after it. To discard completion completely, press `<C-e>`.
155+-- - After pressing special trigger(s), usually `(`, a window appears that shows
156+-- the signature of the current function/method. It gets updated as you type
157+-- showing the currently active parameter.
158+--
159+-- Example usage in Insert mode without an attached LSP or in places not
160+-- supported by the LSP (like comments):
161+-- - Start typing a word that is present in current or opened buffers.
162+-- - After 100ms popup menu with candidates appears.
163+-- - Navigate with `<Tab>` / `<S-Tab>` or `<C-n>` / `<C-p>`. This also updates
164+-- buffer text. If happy with choice, keep typing. Stop with `<C-e>`.
165+--
166+-- It also works with snippet candidates provided by LSP server. Best experience
167+-- when paired with 'mini.snippets' (which is set up in this file).
168+now_if_args(function()
169+ -- Customize post-processing of LSP responses for a better user experience.
170+ -- Don't show 'Text' suggestions (usually noisy) and show snippets last.
171+ local process_items_opts = { kind_priority = { Text = -1, Snippet = 99 } }
172+ local process_items = function(items, base)
173+ return MiniCompletion.default_process_items(items, base, process_items_opts)
174+ end
175+ require('mini.completion').setup({
176+ lsp_completion = {
177+ -- Without this config autocompletion is set up through `:h 'completefunc'`.
178+ -- Although not needed, setting up through `:h 'omnifunc'` is cleaner
179+ -- (sets up only when needed) and makes it possible to use `<C-u>`.
180+ source_func = 'omnifunc',
181+ auto_setup = false,
182+ process_items = process_items,
183+ },
184+ })
185+186+ -- Set 'omnifunc' for LSP completion only when needed.
187+ local on_attach = function(ev)
188+ vim.bo[ev.buf].omnifunc = 'v:lua.MiniCompletion.completefunc_lsp'
189+ end
190+ Config.new_autocmd('LspAttach', nil, on_attach, "Set 'omnifunc'")
191+192+ -- Advertise to servers that Neovim now supports certain set of completion and
193+ -- signature features through 'mini.completion'.
194+ vim.lsp.config('*', { capabilities = MiniCompletion.get_lsp_capabilities() })
195+end)
196+197+-- Navigate and manipulate file system
198+--
199+-- Navigation is done using column view (Miller columns) to display nested
200+-- directories, they are displayed in floating windows in top left corner.
201+--
202+-- Manipulate files and directories by editing text as regular buffers.
203+--
204+-- Example usage:
205+-- - `<Leader>ed` - open current working directory
206+-- - `<Leader>ef` - open directory of current file (needs to be present on disk)
207+--
208+-- Basic navigation:
209+-- - `l` - go in entry at cursor: navigate into directory or open file
210+-- - `h` - go out of focused directory
211+-- - Navigate window as any regular buffer
212+-- - Press `g?` inside explorer to see more mappings
213+--
214+-- Basic manipulation:
215+-- - After any following action, press `=` in Normal mode to synchronize, read
216+-- carefully about actions, press `y` or `<CR>` to confirm
217+-- - New entry: press `o` and type its name; end with `/` to create directory
218+-- - Rename: press `C` and type new name
219+-- - Delete: type `dd`
220+-- - Move/copy: type `dd`/`yy`, navigate to target directory, press `p`
221+--
222+-- See also:
223+-- - `:h MiniFiles-navigation` - more details about how to navigate
224+-- - `:h MiniFiles-manipulation` - more details about how to manipulate
225+-- - `:h MiniFiles-examples` - examples of common setups
226+now_if_args(function()
227+ -- Enable directory/file preview
228+ require('mini.files').setup({ windows = { preview = true } })
229+230+ -- Add common bookmarks for every explorer. Example usage inside explorer:
231+ -- - `'c` to navigate into your config directory
232+ -- - `g?` to see available bookmarks
233+ local add_marks = function()
234+ MiniFiles.set_bookmark('c', vim.fn.stdpath('config'), { desc = 'Config' })
235+ local minideps_plugins = vim.fn.stdpath('data') .. '/site/pack/deps/opt'
236+ MiniFiles.set_bookmark('p', minideps_plugins, { desc = 'Plugins' })
237+ MiniFiles.set_bookmark('w', vim.fn.getcwd, { desc = 'Working directory' })
238+ end
239+ Config.new_autocmd('User', 'MiniFilesExplorerOpen', add_marks, 'Add bookmarks')
240+end)
241+242+-- Miscellaneous small but useful functions. Example usage:
243+-- - `<Leader>oz` - toggle between "zoomed" and regular view of current buffer
244+-- - `<Leader>or` - resize window to its "editable width"
245+-- - `:lua put_text(vim.lsp.get_clients())` - put output of a function below
246+-- cursor in current buffer. Useful for a detailed exploration.
247+-- - `:lua put(MiniMisc.stat_summary(MiniMisc.bench_time(f, 100)))` - run
248+-- function `f` 100 times and report statistical summary of execution times
249+now_if_args(function()
250+ -- Makes `:h MiniMisc.put()` and `:h MiniMisc.put_text()` public
251+ require('mini.misc').setup()
252+253+ -- Change current working directory based on the current file path. It
254+ -- searches up the file tree until the first root marker ('.git' or 'Makefile')
255+ -- and sets their parent directory as a current directory.
256+ -- This is helpful when simultaneously dealing with files from several projects.
257+ MiniMisc.setup_auto_root()
258+259+ -- Restore latest cursor position on file open
260+ MiniMisc.setup_restore_cursor()
261+262+ -- Synchronize terminal emulator background with Neovim's background to remove
263+ -- possibly different color padding around Neovim instance
264+ MiniMisc.setup_termbg_sync()
265+end)
266+267-- Step two ===================================================================
268269-- Extra 'mini.nvim' functionality.
···443-- still enabled as it provides more customization opportunities.
444later(function() require('mini.comment').setup() end)
44500000000000000000000000000000000000000000000000000000000446-- Autohighlight word under cursor with a customizable delay.
447-- Word boundaries are defined based on `:h 'iskeyword'` option.
448--
···465-- - `:h MiniDiff-diff-summary` - available summary information
466-- - `:h MiniDiff.gen_source` - available built-in sources
467later(function() require('mini.diff').setup() end)
000000000000000000000000000000000000000000000468469-- Git integration for more straightforward Git actions based on Neovim's state.
470-- It is not meant as a fully featured Git client, only to provide helpers that
+6-9
.config/nvim/plugin/40_plugins.lua
···1011-- Make concise helpers for installing/adding plugins in two stages
12local add, later = MiniDeps.add, MiniDeps.later
13-local now_if_args = _G.Config.now_if_args
1415-- Tree-sitter ================================================================
16···41 -- Update tree-sitter parser after plugin is updated
42 hooks = { post_checkout = function() vim.cmd('TSUpdate') end },
43 })
44- add({
45- source = 'nvim-treesitter/nvim-treesitter-textobjects',
46- -- Use `main` branch since `master` branch is frozen, yet still default
47- -- It is needed for compatibility with 'nvim-treesitter' `main` branch
48- checkout = 'main',
49- })
5051 -- Define languages which will have parsers installed and auto enabled
0052 local languages = {
53 -- These are already pre-installed with Neovim. Used as an example.
54 'lua',
···64 -- To see available languages:
65 -- - Execute `:=require('nvim-treesitter').get_available()`
66 -- - Visit 'SUPPORTED_LANGUAGES.md' file at
67- -- https://github.com/nvim-treesitter/nvim-treesitter/blob/main
68 }
69 local isnt_installed = function(lang)
70 return #vim.api.nvim_get_runtime_file('parser/' .. lang .. '.*', false) == 0
···80 end
81 end
82 local ts_start = function(ev) vim.treesitter.start(ev.buf) end
83- _G.Config.new_autocmd('FileType', filetypes, ts_start, 'Start tree-sitter')
84end)
8586-- Language servers ===========================================================
···1011-- Make concise helpers for installing/adding plugins in two stages
12local add, later = MiniDeps.add, MiniDeps.later
13+local now_if_args = Config.now_if_args
1415-- Tree-sitter ================================================================
16···41 -- Update tree-sitter parser after plugin is updated
42 hooks = { post_checkout = function() vim.cmd('TSUpdate') end },
43 })
44+ add('nvim-treesitter/nvim-treesitter-textobjects')
000004546 -- Define languages which will have parsers installed and auto enabled
47+ -- After changing this, restart Neovim once to install necessary parsers. Wait
48+ -- for the installation to finish before opening a file for added language(s).
49 local languages = {
50 -- These are already pre-installed with Neovim. Used as an example.
51 'lua',
···61 -- To see available languages:
62 -- - Execute `:=require('nvim-treesitter').get_available()`
63 -- - Visit 'SUPPORTED_LANGUAGES.md' file at
64+ -- https://github.com/nvim-treesitter/nvim-treesitter
65 }
66 local isnt_installed = function(lang)
67 return #vim.api.nvim_get_runtime_file('parser/' .. lang .. '.*', false) == 0
···77 end
78 end
79 local ts_start = function(ev) vim.treesitter.start(ev.buf) end
80+ Config.new_autocmd('FileType', filetypes, ts_start, 'Start tree-sitter')
81end)
8283-- Language servers ===========================================================