Neovim Documentation

website·Indexed 30 days ago

https://cmgriffing.github.io/neovim-docs-web/en/

Web-based version of the Neovim :help pages, covering a wide range of topics including basic navigation, advanced text editing, window management, key mapping, syntax definition, and vim-script fundamentals. It includes detailed guides on builtin functions, remote editing, and plugin configuration.

Tokens
353.2K
Snippets
2.2K
Records
2.9K
Agent score
74%

What's inside Neovim

  1. Overview of Neovim Channels and Asynchronous IO

    Channels are Neovim's mechanism for communicating with external processes. Each channel is identified by a unique integer channel-id for the duration of the session. Channels can operate in raw byte mode, using the msgpack-rpc protocol for remote calls, or as PTY channels for terminal emulation.
  2. Overview of msgpack.vim utility functions

    The msgpack.vim plugin provides utility functions to handle MessagePack values, including support for msgpack-special-dict types. These functions are intended to be used alongside Neovim's built-in msgpackdump() and msgpackparse() functions.
  3. Overview of Quickfix and Location Lists

    Neovim provides a Quickfix system to manage lists of positions in files, typically used for the edit-compile-edit cycle by capturing compiler error messages.

    • Quickfix List: A global list of positions. It can be populated via commands like :vimgrep, :grep, or :make. You can start Neovim with a pre-existing error file using vim -q filename.
    • Location List: A window-local version of the quickfix list. Each window can have its own separate location list. Commands that create location lists usually prefix the quickfix command with 'l' (e.g., :lvimgrep, :lmake).
    • Changedtick: Both list types have a read-only changedtick variable that increments whenever the list is modified, allowing scripts to detect changes via getqflist() or getloclist().
  4. Overview of Neovim tabpages

    A tab page in Neovim is a collection of one or more windows. They allow developers to maintain several different window layouts simultaneously and switch between them. Most window-related commands (like CTRL-W or :windo) operate only within the current tab page unless a specific tab modifier is used. Tabs are particularly useful for temporarily editing a buffer without disrupting the current window layout.
  5. Overview of basic Neovim modes

    Neovim operates using different modes that change how keyboard input is interpreted:

    • Normal mode: The default mode used for entering editor commands. Also known as command mode.
    • Visual mode: Similar to Normal mode, but movement commands extend a highlighted text area. Non-movement commands are executed on the highlighted area.
    • Select mode: Similar to standard GUI text selection. Typing a printable character deletes the selection and enters Insert mode.
  6. Overview of the Neovim sign system

    Signs are visual indicators (icons or text) displayed in the left-hand column of a window, typically used by debuggers for breakpoints or by plugins for build errors and version control status. Using signs involves two steps: defining the sign (specifying its appearance and highlighting) and placing the sign (specifying the file and line number).

    Key concepts:

    • Sign Column: Automatically appears when signs are defined for a file. Controlled by the signcolumn option. Highlighting is managed via the SignColumn and CursorLineSign highlight groups.
    • Sign Identifier: A unique number assigned to each placed sign, used for removal or jumping.
    • Sign Groups: Used to prevent identifier collisions between different plugins. Signs are placed in the global group by default.
    • Sign Priority: Determines which sign is displayed when multiple signs occupy the same line. The default priority is 10; the highest priority wins.
  7. Introduction to luv (libuv Lua bindings)

    The luv library provides Lua access to the multi-platform libuv support library. In Neovim, this is accessible via vim.loop.

    Key Concepts:

    • Module Layout: The library is exposed as the uv module. Most functions correspond to libuv C functions (e.g., uv_tcp_bind becomes uv.tcp_bind()).
    • Method-style API: Many functions support a method-style call. For example, uv.tcp_bind(server, host, port) can be called as server:bind(host, port).
    • Synchronous vs Asynchronous:
      • Functions with a callback are asynchronous; execution is deferred to the next loop iteration.
      • Functions without a callback are synchronous and return results immediately.
      • Some functions (FS and DNS) behave based on whether a callback is provided.
    • Pseudo-Types:
      • fail: An assertable nil, string, string tuple.
      • callable: A function, or a table/userdata with a __call metamethod.
      • buffer: A string or a sequential table of strings.
      • threadargs: Variable arguments (...) of type nil, boolean, number, string, or userdata.
    local uv = vim.loop
    
    -- TCP Echo Server Example
    local server = uv.new_tcp()
    server:bind("127.0.0.1", 1337)
    server:listen(128, function (err)
      assert(not err, err)
      local client = uv.new_tcp()
      server:accept(client)
      client:read_start(function (err, chunk)
        assert(not err, err)
        if chunk then
          client:write(chunk)
        else
          client:shutdown()
          client:close()
        end
      end)
    end)
    
    print("TCP server listening at 127.0.0.1 port 1337")
    uv.run() -- Explicit run call is necessary outside of luvit
  8. Overview of Lua integration in Neovim

    Neovim includes a built-in Lua 5.1 script engine. The programming interface consists of the Lua standard library, the editor standard library (builtin functions and Ex-commands), and the Neovim API (vim.api). Neovim ensures permanent compatibility with Lua 5.1; if a newer version of Lua is shipped in the future, a compatibility shim will be provided for existing plugins.
  9. Introduction to Folding in Neovim

    Folding allows you to display a range of lines in a buffer as a single line, providing a high-level overview of structured text without changing the actual content of the buffer. This is particularly useful for managing large files or complex code structures.
  10. Overview of Neovim's new architectural features

    Neovim introduces several major components not found in standard Vim to improve extensibility and performance, including a built-in LSP framework, Lua scripting, a Tree-sitter parsing engine, and a robust API for job control and remote plugins.
  11. Introduction to Vim script basics

    Vim script is used for configuration (vimrc), syntax files, and plugins. In a Vim script file, the leading colon (:) for Ex commands is optional, though often included in examples for clarity. Basic assignment is performed using the :let command.
    let i = 1
    while i < 5
      echo "count is" i
      let i += 1
    endwhile
  12. Understand Neovim's design goals and constraints

    Neovim follows several core design principles to guide development:

    • Improved Vim: Enhances Vim without becoming a completely different editor, preferring Vim/Unix traditions.
    • Well Documented: Features must be documented to be useful; patches for new features must include documentation.
    • Fast and Small: Prioritizes short startup times, efficient command execution, and minimal communication overhead for slow connections.
    • Maintainable: Emphasizes reliable code, useful comments (explaining 'why' rather than just repeating function names), and an object-oriented approach to data and code.
    • Component-based: Neovim is designed as a component to be composed with other tools, rather than a monolithic operating system.