this repo has no description
1-- ┌─────────────────────────┐
2-- │ Filetype config example │
3-- └─────────────────────────┘
4--
5-- This is an example of a configuration that will apply only to a particular
6-- filetype, which is the same as file's basename ('markdown' in this example;
7-- which is for '*.md' files).
8--
9-- It can contain any code which will be usually executed when the file is opened
10-- (strictly speaking, on every 'filetype' option value change to target value).
11-- Usually it needs to define buffer/window local options and variables.
12-- So instead of `vim.o` to set options, use `vim.bo` for buffer-local options and
13-- `vim.cmd('setlocal ...')` for window-local options (currently more robust).
14--
15-- This is also a good place to set buffer-local 'mini.nvim' variables.
16-- See `:h mini.nvim-buffer-local-config` and `:h mini.nvim-disabling-recipes`.
17
18-- Enable spelling and wrap for window
19vim.cmd('setlocal spell wrap')
20
21-- Fold with tree-sitter
22vim.cmd('setlocal foldmethod=expr foldexpr=v:lua.vim.treesitter.foldexpr()')
23
24-- Disable built-in `gO` mapping in favor of 'mini.basics'
25vim.keymap.del('n', 'gO', { buffer = 0 })
26
27-- Set markdown-specific surrounding in 'mini.surround'
28vim.b.minisurround_config = {
29 custom_surroundings = {
30 -- Markdown link. Common usage:
31 -- `saiwL` + [type/paste link] + <CR> - add link
32 -- `sdL` - delete link
33 -- `srLL` + [type/paste link] + <CR> - replace link
34 L = {
35 input = { '%[().-()%]%(.-%)' },
36 output = function()
37 local link = require('mini.surround').user_input('Link: ')
38 return { left = '[', right = '](' .. link .. ')' }
39 end,
40 },
41 },
42}