robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

robinmerge: 1dc9728daa1d8a2702

master
19.1 KiB465 linesraw
1*plugins.txt*  Nvim
2
3
4                            NVIM REFERENCE MANUAL
5
6                                       Type |gO| to see the table of contents.
7
8==============================================================================
9Plugins and modules included with Nvim                       *standard-plugin*
10
11Nvim includes various Lua and Vim plugins or modules which may provide
12commands (such as :TOhtml) or modules that you can optionally require() or
13:packadd. The Lua ones are not part of the |lua-stdlib|, that is, they are not
14available from the global `vim` module namespace. Some of the plugins are
15loaded by default while others are not loaded until requested by |:packadd|.
16
17==============================================================================
18Standard plugins                                        *standard-plugin-list*
19
20Help-link		Loaded	Short description ~
21|dir|			Yes	Directory listing for |:edit|
22|difftool|		No	Compares directories (and files) side-by-side
23|editorconfig|		Yes	Detect and interpret editorconfig
24|ft-shada|		Yes	Allows editing binary |shada| files
25|man.lua|		Yes	View manpages in Nvim
26|matchit|		Yes	Extended |%| matching
27|matchparen|		Yes	Highlight matching pairs
28|netrw|			No	Reading and writing files over a network
29|zip|			Yes	Read-only zip archive browser
30|package-cfilter|	No	Filtering quickfix/location list
31|package-justify|	No	Justify text
32|package-nohlsearch|	No	Automatically run :nohlsearch
33|package-spellfile|	Yes	Install spellfile if missing
34|package-termdebug|	No	Debug inside Nvim with gdb
35|package-tohtml|	No	Convert buffer to html, syntax included
36|package-undotree|	No	Interactive textual undotree
37|pi_gzip.txt|		Yes	Reading and writing compressed files
38|pi_msgpack.txt|	No	msgpack utilities
39|pi_paren.txt|		Yes	Highlight matching parens
40|pi_spec.txt|		Yes	Filetype plugin to work with rpm spec files
41|pi_swapmouse|		No	Swap meaning of left and right mouse buttons
42|pi_tar.txt|		Yes	Tar file explorer
43|pi_tutor.txt|		Yes	Interactive tutorial
44|old-zip|		No	Legacy zip archive explorer
45
46==============================================================================
47Builtin plugin: dir                                                      *dir*
48
49Nvim opens a directory listing when you |:edit| a directory path, handled by
50the builtin "dir" plugin.  The listing is read-only, dir.lua does not provide
51actions which modify the filesystem.
52
53Each "dir" buffer is initialized as follows:
54- Sets 'filetype' to "directory".
55- Sets |current-directory| via |:bcd|, so |gf|, |:!| and friends work as
56  expected.
57- Keeps |alternate-file|, so |CTRL-^| returns to the buffer you came from.
58
59                                                    *g:loaded_nvim_dir_plugin*
60To disable the built-in directory browser, set this before startup: >lua
61    vim.g.loaded_nvim_dir_plugin = 1
62<
63
64GLOBAL MAPPINGS                                                 *dir-mappings*
65
66• - opens the parent directory of the current file or directory.
67• {count}- is like -, but a count of 1 opens the global working directory,
68  and a higher count goes up that many levels.
69
70BUFFER-LOCAL MAPPINGS                                    *dir-buffer-mappings*
71
72• <CR> opens the file or directory under the cursor.
73• a opens the file or directory under the cursor in a vertical split.
74• o opens the file or directory under the cursor in a horizontal split.
75• - opens the parent directory.
76• R reloads the directory listing.
77
78a and o are available for local directories and keep focus in the listing.
79'splitright' and 'splitbelow' control where the new window appears.
80
81These keys map to <Plug>(nvim-dir-open), <Plug>(nvim-dir-vsplit),
82<Plug>(nvim-dir-split), <Plug>(nvim-dir-up), and <Plug>(nvim-dir-reload); map those
83to use different keys. Default mappings are skipped when the target <Plug>
84mapping is already mapped. The default "-", "a", and "o" mappings are also
85skipped when their keys are already mapped.
86
87                                                                 *dir-config*
88Directory buffers follow the global 'hidden' option by default. To delete them
89after use: >vim
90    autocmd FileType directory setlocal bufhidden=delete
91<
92A discarded listing is rebuilt on the next visit, so the cursor starts at the
93first entry instead of the one it was left on. "wipe" discards the buffer
94itself, leaving no |alternate-file|; see 'bufhidden'.
95
96
97Reshaping the listing                                             *dir-render*
98
99                                                                 *DirReadPost*
100A |User| autocommand fired after each listing is rendered, including reloads.
101The buffer is writable for the duration, so a handler can sort or filter it
102with ordinary commands, and the cursor is placed afterwards.
103
104Handlers may reorder or remove lines, but each remaining line must still be an
105entry name: |dir-buffer-mappings| resolve the line under the cursor against the
106buffer name, so rewriting line text makes <CR> open a nonexistent path.
107
108Sort directories last: >vim
109    autocmd User DirReadPost silent keeppatterns sort r /\/$/
110<
111Hide dot-prefixed entries: >vim
112    autocmd User DirReadPost silent keeppatterns g/^\./d _
113<
114Sort by modification time, newest first: >lua
115    vim.api.nvim_create_autocmd('User', {
116      pattern = 'DirReadPost',
117      callback = function(args)
118        local dir = vim.api.nvim_buf_get_name(args.buf)
119        local names = vim.api.nvim_buf_get_lines(args.buf, 0, -1, true)
120        local mtime = {} --- @type table<string, integer>
121        for _, name in ipairs(names) do
122          local stat = vim.uv.fs_stat(vim.fs.joinpath(dir, name))
123          mtime[name] = stat and stat.mtime.sec or 0
124        end
125        table.sort(names, function(a, b)
126          return mtime[a] > mtime[b]
127        end)
128        vim.api.nvim_buf_set_lines(args.buf, 0, -1, true, names)
129      end,
130    })
131<
132
133Decorating the listing                                          *dir-decorate*
134
135A |nvim_set_decoration_provider()| sets |extmarks| on the visible lines of
136each redraw, so they survive reordering by a |DirReadPost| handler.
137
138Classify each entry, and show where a symbolic link points: >lua
139    local ns = vim.api.nvim_create_namespace('my.dir.classify')
140    local glyph = {
141      fifo = '|', socket = '=', char = '%', block = '#',
142    }
143    vim.api.nvim_set_decoration_provider(ns, {
144      on_win = function(_, _, buf)
145        return vim.bo[buf].filetype == 'directory'
146      end,
147      on_range = function(_, _, buf, row)
148        local dir = vim.api.nvim_buf_get_name(buf)
149        local name = vim.api.nvim_buf_get_lines(buf, row, row + 1, true)[1]
150        local path = vim.fs.joinpath(dir, (name:gsub('/$', '')))
151        local stat = vim.uv.fs_lstat(path) or {}
152        local exe = stat.type == 'file'
153          and bit.band(stat.mode, tonumber('111', 8)) ~= 0
154        local char = glyph[stat.type] or (exe and '*')
155        if char then
156          vim.api.nvim_buf_set_extmark(buf, ns, row, #name, {
157            virt_text = { { char, 'Dimmed' } },
158            virt_text_pos = 'overlay',
159            ephemeral = true,
160          })
161        end
162        if stat.type == 'link' then
163          local target = vim.uv.fs_readlink(path) or '?'
164          vim.api.nvim_buf_set_extmark(buf, ns, row, 0, {
165            virt_text = { { '-> ' .. target, 'Dimmed' } },
166            virt_text_pos = 'eol',
167            ephemeral = true,
168          })
169        end
170        return row + 1
171      end,
172    })
173<
174
175Replacing the directory browser                                  *dir-disable*
176
177To use another directory browser for the current session, delete the
178`nvim.dir` autocommand group on or after |VimEnter| and handle |FileType| "directory".
179This clears the built-in directory-opening autocommands. >lua
180
181    vim.api.nvim_del_augroup_by_name('nvim.dir')
182    vim.api.nvim_create_autocmd('FileType', {
183      pattern = 'directory',
184      callback = function(args)
185        require('my_browser').open(args.buf, vim.api.nvim_buf_get_name(args.buf))
186      end,
187    })
188<
189                                                                       *netrw*
190To enable the legacy "netrw" plugin: >vim
191
192    :packadd netrw
193
194The plugin and its mappings remain loaded (it is a core component used by
195other features such as |zip|). Define replacement keymaps explicitly, for
196example: >lua
197
198    vim.keymap.set('n', '-', function()
199      require('my_browser').open_parent()
200    end)
201<
202
203==============================================================================
204Builtin plugin: difftool                                            *difftool*
205
206:DiffTool {left} {right}                                           *:DiffTool*
207Compares two directories or files side-by-side.
208Supports directory diffing, rename detection, and highlights changes
209in quickfix list. Replaces the built-in `nvim -d` diff mode with this interface.
210
211The plugin is not loaded by default; use `:packadd` to activate it: >
212    :packadd nvim.difftool
213<
214
215Example `git difftool -d` integration using `nvim -d` replacement: >ini
216    [difftool "nvim_difftool"]
217      cmd = nvim -c \"packadd nvim.difftool\" -d \"$LOCAL\" \"$REMOTE\"
218    [diff]
219      tool = nvim_difftool
220<
221
222
223open({left}, {right}, {opt})                                 *difftool.open()*
224    Diff two files or directories
225
226    Parameters: ~
227      • {left}   (`string`)
228      • {right}  (`string`)
229      • {opt}    (`table?`)
230                 • {rename.detect} (`boolean`, default: `false`) Whether to
231                   detect renames
232                 • {rename.similarity} (`number`, default: `0.5`) Minimum
233                   similarity for rename detection (0 to 1)
234                 • {rename.chunk_size} (`number`, default: `4096`) Maximum
235                   chunk size to read from files for similarity calculation
236                 • {ignore} (`string[]`, default: `{}`) List of file patterns
237                   to ignore (for example: `'.git', '*.log'`)
238                 • {method} (`'auto'|'builtin'|'diffr'`, default: `auto`) Diff
239                   method to use
240                 • {rename} (`table`) Controls rename detection
241
242
243==============================================================================
244Builtin plugin: editorconfig                                    *editorconfig*
245
246EditorConfig is like 'modeline' for an entire (recursive) directory. When a
247file is opened, after running |ftplugin|s and |FileType| autocommands, the
248EditorConfig feature searches all parent directories of that file for
249`.editorconfig` files, parses them, and applies their properties. For more
250information see https://editorconfig.org/.
251
252Example `.editorconfig` file: >ini
253    root = true
254
255    [*]
256    charset = utf-8
257    end_of_line = lf
258    indent_size = 4
259    indent_style = space
260    max_line_length = 42
261    trim_trailing_whitespace = true
262
263    [*.{diff,md}]
264    trim_trailing_whitespace = false
265<
266
267                                               *g:editorconfig* *b:editorconfig*
268
269EditorConfig is enabled by default. To disable it, add to your config: >lua
270    vim.g.editorconfig = false
271<
272
273(Vimscript: `let g:editorconfig = v:false`). It can also be disabled
274per-buffer by setting the |b:editorconfig| buffer-local variable to `false`.
275
276Nvim stores the applied properties in |b:editorconfig| if it is not `false`.
277
278                                              *editorconfig-custom-properties*
279
280New properties can be added by adding a new entry to the "properties" table.
281The table key is a property name and the value is a callback function which
282accepts the number of the buffer to be modified, the value of the property in
283the `.editorconfig` file, and (optionally) a table containing all of the other
284properties and their values (useful for properties which depend on other
285properties). The value is always a string and must be coerced if necessary.
286Example: >lua
287
288    require('editorconfig').properties.foo = function(bufnr, val, opts)
289      if opts.charset and opts.charset ~= "utf-8" then
290        error("foo can only be set when charset is utf-8", 0)
291      end
292      vim.b[bufnr].foo = val
293    end
294<
295
296                                                     *editorconfig-properties*
297
298The following properties are supported by default:
299
300
301charset                                                 *editorconfig.charset*
302    One of `"utf-8"`, `"utf-8-bom"`, `"latin1"`, `"utf-16be"`, or
303    `"utf-16le"`. Sets the 'fileencoding' and 'bomb' options.
304
305end_of_line                                         *editorconfig.end_of_line*
306    One of `"lf"`, `"crlf"`, or `"cr"`. These correspond to setting
307    'fileformat' to "unix", "dos", or "mac", respectively.
308
309indent_size                                         *editorconfig.indent_size*
310    A number indicating the size of a single indent. Alternatively, use the
311    value "tab" to use the value of the tab_width property. Sets the
312    'shiftwidth' and 'softtabstop' options. If this value is not "tab" and the
313    tab_width property is not set, 'tabstop' is also set to this value.
314
315indent_style                                       *editorconfig.indent_style*
316    One of `"tab"` or `"space"`. Sets the 'expandtab' option.
317
318insert_final_newline                       *editorconfig.insert_final_newline*
319    `"true"` or `"false"` to ensure the file always has a trailing newline as
320    its last byte. Sets the 'fixendofline' and 'endofline' options.
321
322max_line_length                                 *editorconfig.max_line_length*
323    A number indicating the maximum length of a single line. Sets the
324    'textwidth' option.
325
326root                                                       *editorconfig.root*
327    If "true", then stop searching for `.editorconfig` files in parent
328    directories. This property must be at the top-level of the `.editorconfig`
329    file (i.e. it must not be within a glob section). It only controls the
330    search and is excluded from property callbacks and |b:editorconfig|.
331
332spelling_language                             *editorconfig.spelling_language*
333    A code of the format ss or ss-TT, where ss is an ISO 639 language code and
334    TT is an ISO 3166 territory identifier. Sets the 'spelllang' option.
335
336tab_width                                             *editorconfig.tab_width*
337    The display size of a single tab character. Sets the 'tabstop' option.
338
339trim_trailing_whitespace               *editorconfig.trim_trailing_whitespace*
340    When `"true"`, trailing whitespace is automatically removed when the
341    buffer is written.
342
343
344==============================================================================
345Builtin plugin: spellfile                                  *package-spellfile*
346
347Asks the user to download missing spellfiles. The spellfile is written to
348`stdpath('data') .. 'site/spell'` or the first writable directory in the
349'runtimepath'.
350
351The plugin can be disabled by setting `g:loaded_spellfile_plugin = 1`.
352
353
354*nvim.spellfile.Config*
355    A table with the following fields:
356
357    Fields: ~
358      • {confirm}     (`boolean`, default: `true`) Whether to ask user to
359                      confirm download.
360      • {timeout_ms}  (`integer`, default: 15000) Number of milliseconds after
361                      which the |vim.net.request()| times out.
362      • {url}         (`string`) The base URL from where the spellfiles are
363                      downloaded. Uses `g:spellfile_URL` if it's set,
364                      otherwise https://ftp.nluug.nl/pub/vim/runtime/spell.
365
366
367config({opts})                                            *spellfile.config()*
368    Configure spellfile download options. Omit {opts} to retrieve the current
369    configuration. Otherwise, update only the supplied fields.
370
371    For example: >lua
372        require('nvim.spellfile').config({ url = '...' })
373<
374
375    Parameters: ~
376      • {opts}  (`Partial<nvim.spellfile.Config>?`)
377
378    Return: ~
379        (`nvim.spellfile.Config?`) Current config if {opts} is omitted.
380
381get({lang})                                                  *spellfile.get()*
382    Download spellfiles for language {lang} if available.
383
384    Parameters: ~
385      • {lang}  (`string`) Language code.
386
387    Return: ~
388        (`table?`) A table with the following fields:
389        • {dir} (`string`)
390        • {encoding} (`string`)
391        • {files} (`string[]`)
392        • {key} (`string`)
393        • {lang} (`string`)
394
395
396==============================================================================
397Builtin plugin: tohtml                                        *package-tohtml*
398
399:[range]TOhtml {file}                                                *:TOhtml*
400Converts the buffer shown in the current window to HTML, opens the generated
401HTML in a new split window, and saves its contents to {file}. If {file} is not
402given, a temporary file (created by |tempname()|) is used.
403
404The plugin is not loaded by default; use `:packadd` to activate it: >
405    :packadd nvim.tohtml
406<
407
408
409tohtml({winid}, {opt})                                       *tohtml.tohtml()*
410    Converts the buffer shown in the window {winid} to HTML and returns the
411    output as a list of string.
412
413    Parameters: ~
414      • {winid}  (`integer?`) Window to convert (defaults to current window)
415      • {opt}    (`table?`) Optional parameters.
416                 • {font}? (`string[]|string`, default: `guifont`) Fonts to
417                   use.
418                 • {number_lines}? (`boolean`, default: `false`) Show line
419                   numbers.
420                 • {range}? (`integer[]`, default: entire buffer) Range of
421                   rows to use.
422                 • {title}? (`string|false`, default: buffer name) Title tag
423                   to set in the generated HTML code.
424                 • {width}? (`integer`, default: 'textwidth' if non-zero or
425                   window width otherwise) Width used for items which are
426                   either right aligned or repeat a character infinitely.
427
428    Return: ~
429        (`string[]`)
430
431
432==============================================================================
433Builtin plugin: undotree                                    *package-undotree*
434
435open({opts})                                                 *undotree.open()*
436    Open a window that displays a textual representation of the |undo-tree|,
437    or closes the window if it is already open. Can also be shown with
438    `:Undotree`.                                                   *:Undotree*
439
440    While in the window, moving the cursor changes the undo.
441
442    The plugin is not loaded by default; use `:packadd` to activate it: >
443        :packadd nvim.undotree
444<
445
446    Parameters: ~
447      • {opts}  (`table?`) A table with the following fields:
448                • {bufnr} (`integer?`) Buffer to draw the tree into. If
449                  omitted, a new buffer is created.
450                • {command} (`string?`) Vimscript command to create the
451                  window. Default value is "30vnew". Only used when {winid} is
452                  nil.
453                • {title} (`(string|fun(bufnr:integer):string?)?`) Title of
454                  the window. If a function, it accepts the buffer number of
455                  the source buffer as its only argument and should return a
456                  string.
457                • {winid} (`integer?`) Window id to display the tree buffer
458                  in. If omitted, a new window is created with {command}.
459
460    Return: ~
461        (`boolean?`) Returns true if the window was already open, nil
462        otherwise
463
464
465 vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: