Home - Neovim
Home - Neovim
@neovim.io.web.brid.gy
vim out of the box

[bridged from https://neovim.io/ on the web: https://fed.brid.gy/web/neovim.io ]
Vim Boss
Bram is one of my heroes. That’s literal and recursive: when I say it, internally I check before making a frivolous claim, which is a feature of this particular role-model; “What would Bram do?” is a fixture in me which informs my choices. Those who studied `vim_dev` and the Vim source and docs, accumulated treasure from a stream of copious messages and spare impressions. But also from what he omitted: he never appealed to sensationalism or personal judgements. Even when treated rudely, Bram usually responded only to advance his understanding of a problem to solve. Bram was one of those humans quietly providing deep value to the universe, but there was no parade and little celebrity. Bram was anchored to reality, directly interested in results and adjusting what produced them. The “Problem/Solution” mantra in his commit messages is simple yet profoundly effective. He used that approach to help people in Uganda, managing resources directly instead of abstractly. Bram’s principles (as I observed them) extended beyond mere technical craftsmanship. The ability to adopt a position of _modesty_ is a mind-trick that channels an endeavor through a “narrow waist”, a voluntary constraint. That lens can create a more composable and powerful result. Plugins like unimpaired riff on the theme. And this touches on a central point: the main utility—not ideology, but _utility_ —of “lifestyle software” like Emacs and Vim, is that the ecosystem is alive, and has escape velocity, so its momentum is self-perpetuated. Neovim has always been intentionally positioned as a derivative of Vim, which means simultaneously it both continues and diverges from Vim. I’m convinced that forks create energy rather than destroy it. So although we can’t deliver Vim without Bram, we can continue some essential parts: * Maintenance: Experimentation is good, and the world needs creative destruction and playful failures. But Neovim does not represent lust for the new (“neomania”). * Documentation: the habits of Vim documentation are obvious, this is one of the biggest gains that Nvim acquired by building on vim. * Extensibility: Bram’s own Agide project aspired to a similar sort of extensibility as Neovim: > Agide is not a monolitic application. Separate tools can be plugged in. Thus you are not forced to use one editor. … Each tool implements part of the plugin interface. * Embedding: Vim’s :help design-not for most of its life proclaimed this tenet of Neovim: > Vim is not a shell or an Operating System. … This should work the other way around: Use Vim as a component from a shell or in an IDE. And another thing: Bram didn’t take himself too seriously. He had his own sense of humor. Neovim is a monument to Vim and Bram. We should be pragmatic, not dogmatic; we should remember what the goal is, and compare our actions to the results. * * * _— Justin M. Keyes_ P.S. Jan van den Berg wrote a nice post on Bram’s legacy.
neovim.io
December 11, 2024 at 1:19 AM
What Neovim shipped in 2022
Neovim is the world’s most-loved editor. That’s just science: Here are some highlights from Neovim 2022 (Nvim 0.8) development. ## UI Eye candy first! * ‘winhighlight’ was throughly reimplemented as window-local highlight namespaces. This is backwards-compatible while enabling many new usecases, like window-local syntax highlighting. * global ‘statusline’ designates one statusline for all windows. Try it: :set laststatus=3 * `'winbar'` is like an extra statusline at the top of each window. It complements `laststatus=3`: set winbar=%f set laststatus=3 * `'winbar'` and `'statusline'` gained support for mouse-click regions (as ‘tabline’ has had since 2016): * * _Experimental_ zero-height command-line: :set cmdheight=0 * The ‘mousescroll’ option controls vertical/horizontal mouse scroll behavior. :set mousescroll=ver:5,hor:2 * The new ‘statuscolumn’ option gives full control of the “gutter”, with the same familiar format of ‘statusline’. It even supports click events, just like ‘statusline’, ‘tabline’, and ‘winbar’. * Feature author @luukvbaal also provides a plugin with various pre-packaged ‘statuscolumn’ configs. * Try it! :set rnu nu :let &stc='%#NonText#%{&nu?v:lnum:""}%=%{&rnu&&(v:lnum%2)?"\ ".v:relnum:""}%#LineNr#%{&rnu&&!(v:lnum%2)?"\ ".v:relnum:""}' * * Marks can save and restore viewport info. :set jumpoptions=view * When you jump around, or switch buffers with `ctrl-^`, the viewport is restored instead of resetting/recentering vertically. * vim.ui_attach (experimental) enables in-process Lua plugins to hook into the same events exposed to all Nvim UIs. pic.twitter.com/w9U87jGfIL * noice.nvim was an early adopter (a matter of days!). * ## LSP * Summary of the history and status of Nvim builtin LSP support. * Nvim LSP client now supports connecting to language servers by TCP. vim.lsp.start({ name = 'godot', cmd = vim.lsp.rpc.connect('127.0.0.1', 6008) }) * New core events for LSP: `LspAttach`, `LspDetach`. Example: vim.api.nvim_create_autocmd('LspAttach', { group = yourGroupID, callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) your_callbac_func(client, args.buf) end } * `vim.lsp.get_active_clients()` learned to filter (this will be a standard pattern in the Lua stdlib): get_active_clients({id=42}) get_active_clients({bufnr=99}) get_active_clients({name='tsserver'}) ## Editor * Nvim now includes treesitter parsers for C, Lua, and Vimscript. This is a step towards “treesitter by default” for common languages, instead of regex-based vim syntax definitions. * tree-sitter spellcheck constrained to extmark region. * The diff-mode “linematch” feature improves rendering of same-line diff changes: :set diffopt+=linematch:60 * * Nvim supports editorconfig, and enables it by default. Nvim detects “.editorconfig” files in your project and applies the settings. * To opt-out of this feature, add this to your config: vim.g.editorconfig_enable = false * Plugins can provide a live preview of user-defined commands. * This extends the builtin `'inccommand'` feature (since 2017), which show the effects of `:substitute` (`:s/foo/bar`) as you type. * Example: The live-command.nvim plugin adds preview for `:normal` and macros: * * You can now implement ‘inccommand’ preview for any user-defined command. This builds a foundation for live preview of `:normal`, :global, etc. vim.api.nvim_create_user_command( 'MyCmd', my_cmd, { …, preview = my_cmd_preview }) * The `:write` command gained the `++p` flag, so this creates parent/dir/ if it doesn’t exist: :edit parent/dir/file.txt :write ++p * Nvim now stores “session data” (shada, persistent undo, …) in `$XDG_STATE_HOME` (~/.local/state) instead of `$XDG_CACHE_HOME` (~/.cache). This change only affects macOS/unix, the Windows locations are unchanged. * Plugins can also use `stdpath('log')` to get the recommended location for log files. * `gO` in the manpage viewer (`:help :Man`) shows an outline (table of contents) in the location list. Now the outline also lists the flags. * ## Performance * Filetype detection uses Lua (instead of Vimscript) + “on-demand” strategy => 7x speedup vs the old filetype.vim, saves 5+ ms on startup: before: 9.0ms: sourcing …/runtime/filetype.vim after: 1.3ms: sourcing …/runtime/filetype.lua * `nvim --startuptime` now reports Lua `require()` times. 000.010 000.010: --- NVIM STARTING --- 000.198 000.188: event init ... 026.333 001.109 001.101: require('vim.lsp.protocol') 028.144 000.423 000.423: require('vim.lsp._snippet') ... * A brief summary of Nvim ‘packpath’ improvements: * * Fast, slick folds provided by a plugin. ## Defaults * ‘mouse’ option is set by default (again). Was disabled since 2017 “until a better approach”. Now we have it: mouse=nvi Type ":" (cmdline-mode) to temporarily disable mouse. Right-click shows a popup menu. Try it! ## API * nvim_parse_cmd() provides the foundation for `nvim_cmd([list])` and “user cmd-preview”! And super useful for defining custom cmdline (`:`) behavior. :echo nvim_parse_cmd('.,$g/foo/bar', {}) { 'cmd': 'global', 'args': ['/foo/bar'], 'mods': {…}, 'magic': {'file': v:false, 'bar': v:false} } * Use `nvim_cmd()` to call any Vim legacy command in a structured way, like `system([...])`. * Don’t need `fnameescape()`: special chars are controlled by the `magic` param. nvim_cmd({cmd='vimgrep', args={'/%s/j', '**'}}, {}) * nvim-oxi: “first-class Rust bindings (FFI to Nvim C) to the rich API exposed by Neovim.” ## Lua * Check out the vim.fs module for filesystem operations. * `vim.fs.find()` is now the canonical way to find “root files”, common for LSP configuration. * `vim.cmd` is the Lua `nvim_cmd` wrapper. It supports calling Ex commands as functions instead of strings: vim.cmd.colorscheme('nightfox') * Lua plugins continue to mature: > “Lua plugins are basically the same as a vim plugin, except the file extension is `.lua` instead of `.vim` and the file contains Lua code instead of Vimscript.” * This elegant interface required lots of careful work, largely thanks to @bfredl! ## Maintenance * Work by @dundargoc closed two refactor epics started in 2014 and 2017: #567 #7401 * Progress on vim9script => Nvim-Lua transpiler from core maintainer @teej_dv will enable us to continue pulling test coverage from Vim, plus syntax, ftplugins, and even plugins like cfilter. * Nightly + stable releases now provide a universal binary (ARM/M1, Intel) for macOS 11+. ## Documentation Automated generation of the online Nvim documentation was rewritten by replacing an old AWK script with Lua + tree-sitter. We can have nice things. * Improved styling * Nested lists * Soft-wrapped “flow” layout on selected pages (example) * Improved parsing of vim :help tokens Compare the old layout (left) to the new one (right): ## Job control Nvim now sets the `$NVIM` environment variable in `jobstart()` and `:terminal` jobs, so child processes have an unambiguous hint that they are children of Nvim. The old `$NVIM_LISTEN_ADDRESS`, which had conflicting “dual purposes”, is no longer passed to children. ## RPC Nvim UIs are just (inverted) plugins. And now `nvim` itself is a self-hosting UI: when you run `nvim` in a terminal, it starts the TUI as a `nvim --embed` child process. Just like Nvim GUIs, you can connect the `nvim` TUI to any Nvim server to see its UI! You can try it right now: 1. Start a server at address `./foo` (creates a `foo` file in the current directory): nvim --listen ./foo 2. From a different terminal (in the same directory as `./foo`), connect `nvim` to the server: nvim --remote-ui --server ./foo ## Deprecations * Removed the `'insertmode'` option, which was used in Vim to implement “easy vim”. * We’re driving towards making the same behavior possible as a plugin. See `:help 'insertmode'`. * cscope support was removed, because it is mostly redundant with the LSP client (`:help lsp`). * Note: ctags support will _never_ be removed, it is far more common and generally useful.
neovim.io
December 11, 2024 at 1:19 AM
Neovim News #12 - What’s New In Neovim 0.7
> Original article: https://gpanders.com/blog/whats-new-in-neovim-0-7 Neovim 0.7 was just released, bringing with it lots of new features (and of course plenty of bug fixes). You can find the full release notes here, but in this post I’ll cover just a few of the new additions. ## Table of Contents * Lua everywhere! * Distinguishing modifier keys * Global statusline * filetype.lua * Client-server communication * Looking ahead to 0.8 ## Lua everywhere! Neovim 0.5 saw the introduction of Lua as a first-class citizen in the Neovim ecosystem: Lua could now be used in the user’s init file, plugins, colorschemes, ftplugins, etc. Basically, anywhere that you could use a `.vim` file, you could now use `.lua` instead. However, there were still some shortcomings in the Lua API at that time. Notably absent was the ability to create autocommands in Lua, as well as bind key mappings directly to Lua functions. In order to do either of these things, users needed to resort to workarounds involving a round trip through Vimscript conversion, which is a bit clunky: -- Using a Lua function in a key mapping prior to 0.7 local function say_hello() print("Hello world!") end _G.my_say_hello = say_hello vim.api.nvim_set_keymap("n", "<leader>H", "<Cmd>call v:lua.my_say_hello()<CR>", {noremap = true}) The situation was similar for autocommands and custom user commands. In Neovim 0.7, it is now possible to use all of the usual configuration primitives (key mappings, autocommands, user commands, etc.) directly in Lua, with no Vimscript conversion necessary. This also makes it possible to bind key mappings and autocommands directly to _local_ Lua functions: -- Using a Lua function in a key mapping in 0.7 vim.api.nvim_set_keymap("n", "<leader>H", "", { noremap = true, callback = function() print("Hello world!") end, }) -- Creating an autocommand in 0.7 vim.api.nvim_create_autocmd("BufEnter", { pattern = "*", callback = function(args) print("Entered buffer " .. args.buf .. "!") end, desc = "Tell me when I enter a buffer", }) -- Creating a custom user command in 0.7 vim.api.nvim_create_user_command("SayHello", function(args) print("Hello " .. args.args) end, { nargs = "*", desc = "Say hi to someone", }) You may notice that `nvim_set_keymap` must set the Lua callback as a key in the final table argument, while `nvim_create_user_command` can pass the callback function directly as a positional parameter. This is a consequence of Neovim’s strict API contract, which mandates that after an API function makes it into a stable release, it’s signature _must not_ change in any way. However, because `nvim_create_user_command` is a new API function, we are able to add a bit of convenience by making its second argument accept either a string or a function. Neovim 0.7 also includes a Lua-only convenience function `vim.keymap.set` for easily creating new key mappings: vim.keymap.set("n", "<leader>H", function() print("Hello world!") end) `vim.keymap.set` differs from `nvim_set_keymap` in the following ways: * It can accept either a string or a Lua function as its 3rd argument. * It sets `noremap` by default, as this is what users want 99% of the time. The help docs contain much more information: run `:h vim.keymap.set` in Neovim to learn more. Finally, users can now use the API function `nvim_set_hl` to modify global highlight groups (the equivalent of using `:hi`), opening the door to pure-Lua colorschemes. ## Distinguishing modifier keys Being a terminal based application, Neovim has long been subject to the constraints of terminal emulators, one of which being that many keys are encoded the same and thus indistinguishable to applications running in the terminal. For example, `<Tab>` and `<C-I>` use the same representation, as do `<CR>` and `<C-M>`. This has long meant that it is not possible to separately map `<C-I>` and `<Tab>`: mapping one necessarily maps both. This has long been a point of annoyance and there are multiple solutions in the wild to address it. Neovim uses Paul Evans’ libtermkey, which in turn makes use of Evans’ own fixterms proposal for encoding modifier keys in an unambiguous way. As long as the terminal emulator controlling Neovim sends keys encoded in this way, Neovim can correctly interpret them. Neovim 0.7 now correctly distinguishes these modifier key combos in its own input processing, so users can now map e.g. `<Tab>` and `<C-I>` separately. In addition, Neovim sends an escape sequence on startup that signals to the controlling terminal emulator that it supports this style of key encoding. Some terminal emulators (such as iTerm2, foot, and tmux) use this sequence to programatically enable the different encoding. A note of warning: this cuts both ways! You may find that existing mappings to `<Tab>` or `<C-I>` (or `<CR>`/`<C-M>`) no longer work. The fix is easy, however; simply modify your mapping to use the actual key you want to use. In addition to disambiguating these modifier pairs, this also enables new key mappings that were not possible before, such as `<C-;>` and `<C-1>`. Support for this depends largely on the terminal you are using, so this will not affect all users. ## Global statusline Neovim 0.7 introduces a new “global” statusline, which can be enabled by setting `laststatus=3`. Instead of having one statusline per window, the global statusline always runs the full available width of Neovim’s containing window. This makes it useful to display information that does not change per-window, such as VCS information or the current working directory. Many statusline plugins are already making use of this new feature. ## filetype.lua In Neovim 0.7 there is a new (experimental) way to do filetype detection. A quick primer on filetype detection: when you first start Neovim it sources a file called `filetype.vim` in the `$VIMRUNTIME` directory. This file creates several hundred `BufRead,BufNewFile` autocommands whose sole purpose is to infer the filetype of the file based on information about the file, most commonly the file’s name or extension, but sometimes also using the file’s contents. If you profile your startup time with `nvim --startuptime` you will notice that `filetype.vim` is one of the slowest files to load. This is because it is expensive to create so many autocommands. An alternative way to do filetype detection is to instead create one single autocommand that fires for _every_ new buffer and then tries to match the filetype through a sequential series of steps. This is what the new `filetype.lua` does. In addition to using a single autocommand, `filetype.lua` uses a table-based lookup structure, meaning that in many cases filetype detection happens in constant time. And if your Neovim is compiled with LuaJIT (which it most likely is), you also get the benefit of just-in-time compilation for this filetype matching. This feature is currently _opt-in_ as it does not yet completely match all of the filetypes covered by `filetype.vim`, although it is very close (I have been using it exclusively for many months without any issues). There are two ways to opt-in to this feature: 1. Use `filetype.lua`, but fallback to `filetype.vim` Add `let g:do_filetype_lua = 1` to your `init.vim` file. This prevents any regressions in filetype matching and ensures that filetypes are always detected _at least_ as well as they are with `filetype.vim`. However, you will pay the startup time cost of both `filetype.lua` and `filetype.vim`. 2. Use only `filetype.lua` and do not load `filetype.vim` at all Add both `let g:do_filetype_lua = 1` and `let g:did_load_filetypes = 0` to your `init.vim`. This will exclusively use `filetype.lua` for filetype matching and provides all of the performance benefits outlined above, with the (small) risk of missed filetype detection. In addition to performance benefits, `filetype.lua` also makes it easy to add custom filetypes. Simply create a new file `~/.config/nvim/filetype.lua` and call `vim.filetype.add` to create new matching rules. For example: vim.filetype.add({ extension = { foo = "fooscript", }, filename = { ["Foofile"] = "fooscript", }, pattern = { ["~/%.config/foo/.*"] = "fooscript", } }) `vim.filetype.add` takes a table with 3 (optional) keys corresponding to “extension”, “filename”, and “pattern” matching. The value of each table entry can either be a string (in which case it is interpreted as the filetype) or a function. For example, you may want to override Neovim’s default behavior of always classifying `.h` files as C++ headers by using a heuristic that only sets the filetype to C++ if the header file includes another C++-style header (i.e. one without a trailing `.h`): vim.filetype.add({ extension = { h = function(path, bufnr) if vim.fn.search("\\C^#include <[^>.]\\+>$", "nw") ~= 0 then return "cpp" end return "c" end, }, }) We are bringing `filetype.lua` closer to full parity with `filetype.vim` every day. The goal is to make it the default in Neovim 0.8 (with the ability to opt-out to the traditional `filetype.vim`). ## Client-server communication Neovim 0.7 brings some of the features of neovim-remote into the core editor. You can now use `nvim --remote` to open a file in an already running instance of Neovim. An example: # In one shell session nvim --listen /tmp/nvim.sock # In another shell session, opens foo.txt in the first Nvim instance nvim --server /tmp/nvim.sock --remote foo.txt One use case for the new remote functionality is the ability to open files from the embedded terminal emulator in the primary Neovim instance, rather than creating an embedded Neovim instance running inside Neovim itself. ## Looking ahead to 0.8 Neovim is a loosely structured project of motivated individuals who do the work for fun; thus, any roadmap is always a bit of a guessing game. However, there are some things already brewing that you _might_ see in Neovim 0.8: * Improvements to Treesitter support * “Projects” support for LSP * Anti-conceal * Fully remote TUI * And more…
neovim.io
December 11, 2024 at 1:19 AM
Neovim News #11 - The Christmas Issue
> The _real_ 0.5 was the friends we made along the way The long-awaited release of Neovim v0.5.0 finally happened on July 2, 2021. It took longer than everybody had hoped for, but it was worth the wait: With over 4000 commits, it is so big that it broke some of the release tooling. So these notes will not be able to touch on each of the many changes that were made over the course of development and only focus on the most user-visible improvements, of which the biggest are 1. Lua as a first-class scripting and configuration language, 2. Language server protocol (LSP), 3. Treesitter (early access). ## Lua everywhere! Neovim 0.5 went far in making Lua a first-class scripting language for Neovim, both for plugin development and for user configuration. As a reminder, Lua is a small scripting language designed for embedding and is often used in, e.g., game development. Furthermore, there is a just-in-time compiler (LuaJIT, which Neovim is built with on platforms where it is available) that can provide impressive performance on relevant tasks. In essence, Lua was chosen over other languages because it is 1. tiny – perfect for embedding (as opposed to a remote plugin host), 2. fast – LuaJIT can be orders of magnitude faster than Vimscript (and non-JITed Lua), 3. simple – small but expressive syntax (Lua 5.1) made for scripting, with Neovim itself providing a “standard library” by exposing internal functions via an API. For more details on this choice, see Justin M Keyes’ presentation at Vim Conf 2019 and TJ DeVries’ presentation at Vimconf.live. Let’s look at what this means for plugin authors and users. ### Lua plugins Neovim exposes its API natively to Lua via, e.g., `vim.api.nvim_open_win()`. It also provides methods for accessing vimscript (ex) commands and variables via, e.g., `vim.cmd("echo 'foo'")` and `vim.g.syntax_on`, respectively. This allows writing plugins with the same capabilities as those written in Vimscript while exploiting the performance of Lua(JIT) at core programming language tasks like loops. It is also possible to make use of Lua’s own `luarocks` plugin ecosystem. Correspondingly, over the course of the 0.5 development cycle, there has been an explosion in the number of Lua plugins, ranging from rewrites of popular Vimscript plugins to completely new ones that would not have been possible in Vimscript – often from contributors who were completely new to (neo)vim plugin development and were averse to learning Vimscript for that task. As a positive side effect of the long development cycle, many of these are already fully-featured and stable at the time of the 0.5 release! Here is a small and non-representative list of Lua plugins: * Plenary – A library of useful utilities for developing Neovim plugins (some of which will later be integrated into core). * Packer – A package manager with support for plugin dependencies, lazy-loading, and installing luarocks. * Telescope – A highly extendable fuzzy finder over lists. * Gitsigns – A plugin for showing and interacting with changes on files in a git repository (asynchronously). * Nvim-compe – An auto completion framework for various sources, including Neovim’s builtin LSP client. * Nvim-dap – A debug adapter protocol implementation for step-through debugging of your code. * Colorizer – A high-performance color highlighter for Neovim without any external dependencies. * Formatter – A plugin for asynchronously executing external formatting tools on the current buffer or range. * Hop.nvim - An EasyMotion-like movement plugin that does not need to mess with your buffer. * Neogit - A Magit-like Git interface. A much more comprehensive list of Neovim plugins can be found at the user-contributed Awesome Neovim collection. Not all of these plugins are actually written in Lua: there are many other languages (some of which are typed) that compile to Lua, e.g., * Fennel(Lisp) via Aniseed or Fennel-nvim, * Teal, * Amulet ML, * MoonScript via nvim-moonmaker, * Vim9script (as a proof of concept). ### Lua config It is also possible to write user configuration in Lua: If there is an `init.lua`, it is read _instead of_ `init.vim` (these cannot coexist, and having both in your config directory will give an error), and `.lua` files in runtime directories (`plugin/`, `colorscheme/`, `after/` etc.) are sourced in addition to (after) Vimscript files. Note that this is entirely optional and not needed to enjoy the new functions introduced in Neovim 0.5; furthermore, not every Vimscript configuration option has a fully native Lua equivalent yet. Extending the native API to cover these as well is part of the goal for Neovim 0.6. For a comprehensive and up-to-date guide on using Lua for Neovim scripting and configuration, see Getting started using Lua in Neovim. A good model for a Lua configuration using `init.lua` is Defaults.nvim. ## Language Server Protocol (LSP) The Language Server Protocol (LSP) is an open, JSON-RPC-based protocol for communication between code editors and language servers, which provide programming language-specific features such as * completion, * hover/tooltips, * go to definition, * show/go to references, * show method signatures, * rename, * code actions (automatic formatting, organize imports, …), and more. The idea is to separate these features into an editor-independent but language-specific server and a language-independent but editor-specific client, which communicate via the Language Server Protocol over RPC. (It should be pointed out that not every server implements every feature, and the quality of the responses can vary wildly. The “reference implementation” in VS Code also often adds non-standard features that are not covered by the LSP itself.) Neovim 0.5 provides an LSP client written (mostly) in Lua that provides a highly configurable and extensible way of accessing these features. It does not aim at competing with more feature-rich and “out-of-the-box” plugins like CoC.nvim but is meant to be tailored to your preferences (while still being useable with reasonable defaults). For an overview, see TJ DeVries’ Vimconf.live presentation and his shorter video. For many language servers, Nvim-lspconfig already provides the necessary configuration to set everything up easily. Alternatively, some languages also have specific LSP plugins that provide a more integrated setup, e.g., for Java and Scala. To learn more about LSP and how to use it in Neovim, visit Nvim-lspconfig (including its Wiki) and read `:h lsp`. Expect more work on LSP during the 0.5.x development cycle to provide improved configuration options and better coverage of the latest LSP specification (version 3.16 at the point of writing), including semantic highlighting. ## Tree-sitter Neovim 0.5 adds **experimental** support for tree-sitter, a library that parses a piece of code into a syntax tree in an incremental and error-resilient way; this means that reparsing that code after an edit is very fast, and parsing error due to, e.g., typos remain localized and do not break parsing further down. This tree can then be efficiently queried to obtain syntax information about the code. This allows for improved and/or faster * syntax highlighting, * code navigation, * refactoring, * text objects and motions, * searching and replacing, and more. Tree-sitter also makes it easy to highlight parts of a file differently if they contain code in a different language. To learn more about tree-sitter, watch Tree-sitter - A new parsing system for programming tools - Max Brunsfield. The goal is to replace the current vim regular expression-based syntax with tree-sitter, not only for better and faster syntax highlighting but also for new and improved ways of structured text editing. However, tree-sitter support in 0.5 should still be considered as “early access”: It works well enough to test out and see what is possible, but it should not be relied on for productive use due to a number of serious bugs and performance regressions that need to be addressed before tree-sitter in Neovim can be declared stable. Note also that enabling tree-sitter based highlighting for a language currently disables the internal regex-based syntax engine _completely_ for this file type, which may break other features that rely on it. Fixing these issues and improving the API will be a major focus of the development cycle leading up to the 0.6 release. Also, Neovim itself only provides a (Lua) API for generating and querying the syntax tree using the bundled tree-sitter library; see `:h treesitter`. User-facing features like the ones mentioned above are implemented in plugins like * Nvim-treesitter – Highlighting, folds, incremental selection. * Playground – Utility functions to easily show the parsed tree and run queries against it. * Nvim-treesitter-textobjects – Better text objects for vim-style motions and operators. * Nvim-refactor – Highlight definitions, navigation, smart rename. * Architext – structural text editing (i.e., syntax-aware search and replace). More information on using these features can be found in the Nvim-treesitter README or by watching Thomas Vigouroux’s Vimconf.live presentation. ### What’s the difference between LSP and tree-sitter? This is a common question, especially since LSP as of version 3.16 provides “semantic highlighting”. In short, tree-sitter operates on a single file, parsing the file into a syntax tree which is used to support the variety of enhanced code navigation and manipulation functions. On the other hand, language servers operate across multiple files and project libraries, using various different, server-dependent, methods for parsing each file’s syntax tree. (Of course, tree-sitter is one possible choice for this purpose, and is in fact used by, e.g., bash-language-server and wasm-language-server.) In particular, this means that language servers can use _semantic_ information from a different file to annotate the tree for the current file: For example, a variable declared as `const` in one file can be highlighted in red if it is used in a _different_ file – something that tree-sitter cannot do since it only has access to the latter file when highlighting. For more details, watch TJ DeVries’ presentation on this topic. ## Other changes Of course, these were not the only major changes in 0.5. Here is a short summary of representative new features. ### Decorations There is an improved decoration provider API that allows setting and interacting with extmarks (invisible anchored text markers that move when surrounding text is edited), virtual text (text overlays that can now be drawn at any position on screen), and highlights (which is heavily leveraged by nvim-treesitter). This mockup from a post by @sunjon shows what can be achieved with this API: ### Floats The API for floating windows now includes a “z-index” (allowing for control over how floating windows stack) and support for borders. ### Highlight on yank Neovim now has a built-in function to briefly highlight the yanked region (similarly to https://github.com/machakann/vim-highlightedyank), configurable from Lua. To use it, you can add the following to your `init.vim`: au TextYankPost * lua vim.highlight.on_yank {higroup="IncSearch", timeout=150, on_visual=true} See `:h vim.highlight.on_yank()` for more configuration options. ### Vim patches Of the over 4000 commits in this release, about 1000 were patches and runtime updates ported from Vim – nearly all of them by or with the help of the amazing @janlazo. In particular, the runtime files (syntax files, documentation, etc.) are fully synced with Vim up to May 2021, with many later changes already included as well. ## Community In keeping with the motto of this newsletter, one of the most noticeable positive changes was the growth of the community and of new ways of interacting with it. ### Discourse Previously, support requests and discussions were spread across Reddit, Gitter, and GitHub Discussions and were either ephemeral or hard to search for. We have now consolidated around a new Neovim Discourse, which is a free and open source forum platform with mailing list and RSS features, in addition to a nice web interface. The Neovim Discourse is an official core project and moderated by core team members. ### Matrix The official chatroom for Neovim is on Gitter. After the acquisition of Gitter by Matrix (a federated chat protocol), this room can now also be accessed from Matrix; it is also bridged to the IRC network Libera.chat. Due to the increasing number of users, there are now additional, more specific rooms for development of and around neovim, GUIs, and off-topic chat. (The links above are to the rooms accessed through Element, a web-based Matrix client; you can also access it through any of the many other Matrix clients.) ### Vimconf.live Due to the global COVID-19 pandemic, VimConf 2020 unfortunately had to be canceled. In its place, a virtual Vimconf.live conference was held, with 16 speakers and over 1000 registered participants from 12 countries. If you have missed it, you can watch the lectures on the Youtube playlist. ### Twitch Another effect of the pandemic was the rise of interest in the live streaming of open source development on Twitch. Many of the speakers at Vimconf.live are active streamers; in particularly, TJ DeVries regularly streams his work on Neovim as “open open source”, and the release of Neovim 0.5 was streamed live on his channel. (**Update:** An edited playlist of the release stream is now on YouTube.) ### Neovim development The number of people active in Neovim development also grew. Between 0.4.4 and 0.5.0, there were 301 unique commit authors, compared to 112 between 0.3.8 and 0.4.4 (a comparable time frame). ## Sponsorship You can now sponsor Neovim via Github Sponsors or OpenCollective. (BountySource began introducing worrying changes to their Terms of Service agreement and is therefore no longer recommended.) ## What’s next? As already mentioned, further improvements to the headlight features introduced in 0.5 will happen over the 0.5.x release cycle: * Lua API – Support for more native Lua objects (autocommands, mappings, commands). * LSP – Improved configuration API, full 3.16 compliance (including semantic highlighting). Making tree-sitter a stable and faster replacement for syntax highlighting (and beyond) is the major goal for the 0.6.0 release. This includes fundamental work on the decorations API to allow for things like in-line folding or inserting virtual lines and columns (“anti-conceal”). Beyond that, notable goals are better file change detection as well as further decoupling the TUI (terminal UI) from the Neovim core with the goal of allowing remote TUI instances. Finally, we are aiming for more regular and frequent releases (at least for patch versions), which will hopefully remove the need for a “neovim 0.6 when?” meme for a change. ## Thanks A big thank you to everyone involved in the project that helped make Neovim 0.5 a reality – be they contributors, sponsors, bug-reporters, or supporters. In lieu of full credits, here are some of the people you can thank for the features listed in this letter: * @tjdevries, @h-michael, @norcalli, and @mjlbach for the LSP client; * @vigoux, @bfredl, @theHamsta and the nvim-treesitter team for the tree-sitter integration; * @janlazo for the tireless (and often thankless) work of porting patches and runtime updates from vim; * and last but not least @bfredl for the decorations API, floating windows, a variety of similar feats of C-code wizardry, and for taking `:smile` seriously. Finally, thank you to @justinmk and @brammool for your foundational work and your vision – the *vim community is stronger together!
neovim.io
December 4, 2024 at 1:31 AM
Newsletter #10 - Neovim v0.4.4
## What is Neovim? Neovim is a fork of the venerable text-editor vim, focused on extensibility and usability. It is not a rewrite but a continuation and extension of Vim. Many clones and derivatives exist, some very clever—but none are Vim. Neovim is built for users who want the good parts of Vim, and more. See a list of differences via :help vim-differences. ### Participating If you are interested in contributing to Neovim, visit the github page for details. We have a great test suite and automated CI, so you can just jump in and have a go. Don’t be afraid to open a PR to get comments or just take advantage of the infrastructure! To get in touch with the team, join the gitter channel (also accessible via IRC), or visit the Neovim subreddit, which many of the developers read. Taking part in conversations is a contribution, too! ## What’s new The last newsletter covered the release of Neovim v0.3.0, it is now time to do the same thing with the most exciting Neovim release that happened since then: v0.4.4! #### 0.4.4 for Users * Neovim started detecting the background color of the terminal for xterm-compatible terminals (**@joshtriplett** , #9509) * The `'maxcombine'` option has been removed, it now always default to 6 (**@bfredl** , #7992) * The `'fillchars'` setting now has an `eob` option, letting users configure the character used to represent lines after the end of a buffer (previously hardcoded to `~`) (**@FriedSock** , #8546) * `F` has been added to the default `'shortmess'` option and `S` has been removed (**@justinmk** , #8619, #10136) * The `CursorLine` type will now be smarter: if its foreground color is not set, the text of the `CursorLine` will use the `CursorLine`’s background color and default syntax highlighting colors as foreground (**@zhou13** , #8578). * The terminal UI can now support undercurl and colored underline, provided that your terminal has support for that (**@blueyed** , #9052). * Neovim’s `'background'` setting now defaults to `dark` to get a consistent setting across platforms (**@justinmk** , #9205). * `'fillchars'` and `'listchars'` now are window-local options (**@mhinz** , #9539). * The popupmenu can now be made (pseudo) transparent (**@bfredl** , #9571). * Floating windows! This enables all kinds of useful features, such as big clocks (**@bfredl** , **@dzhou121** , #6619) * Autocommands now have a `++once` modifier to let them execute only once (**@justinmk** , #9706) * A new autocommand event named `CompleteChanged` has been implemented (**@chemzqm** , #9616) * Vim’s TermDebug plugin has been ported to neovim (**@kwon-young** , #8364). * The wildmenu can now be turned into a popup menu with `wildoptions=pum` (**@bfredl** , #9607). In fact, that’s the default! * There now are two events triggered when a UI connects to and disconnects from Neovim: UIEnter and UILeave (**@equalsraf** , #6917). * There also are `TermEnter` and `TermLeave` autocommands triggered when entering/leaving a terminal (**usama54321** , #8550). #### 0.4.4 for Developers * New UI extensions: * The `ext_hlstate` extension allows semantic identification of builtin and syntax highlights (**@bfredl** , #8221). * The `ext_linegrid` extension sends more gradual screen updates for improved performance (**@bfredl** , #9064). * The `ext_multigrid` extension introduces the concept of a “grid” which is just a rendering surface (**@bfredl** , **@UtkarshMe** #8455). * The `ext_messages` extension enables UIs to provide an external command line (**@bfredl** , **@dzhou121** #7466) * `ext_popupmenu` makes neovim send information about its popup menu (**@bfredl** #9607). * New API function: * `nvim_buf_get_offset`: returns the byte offset of a line (**@bfredl** , #9180) * `nvim_buf_is_loaded`: checks if a buffer is loaded (**@phodge** , #7688). * `nvim_create_buf`: create a new buffer (**@bredl** , #9272) * `nvim_get_context`/`nvim_load_context`: explore and restore the editor’s state (**@justinmk** , #10619. * `nvim_input_mouse`: perform mouse actions (**@bfredl** , #9429). * `nvim_open_win`: creating floating external windows * `nvim_set_keymap`: sets a global mapping for a mode (**@yilin-yang** , #9224). * `nvim_win_close`: close a window (**@bfredl** , #9667). * `nvim_win_set_buf`: sets the current buffer of a window (**@justinmk** , #9100) * `nvim_win_set_config`: configure the layout of a window (**@mhinz** , #9626). * Changed API functions: * `nvim_buf_lines_event` will now send events for terminal buffers (**@justinmk** , #8616). * Neovim now always waits for a UI when launched with –embed, unless –headless is also supplied (**@bfredl** , #9024). * Neovim’s libuv loop has been exposed to lua as `vim.loop` (**@zhaozg** , **@andreypopp** , #10123). ### What’s next? Neovim contributors have been hard at work and added a lot of new features to v0.5.0 like an LSP client written in Lua and TreeSitter integration. The next Neovim release promises to be fascinating! ## Around Neovim ## Related projects The wiki page of related projects is an evergrowing list of projects that somehow make use of Neovim’s extended capabilities. Here’s a gist of additions since the last newsletter: ### Plugins The following plugins have found their way into our wiki: * coc.nvim: Language Server Protocol client that aims to replicate VSCode’s functionnalities * markdown-preview.nvim: Provides preview of your markdown files in your browser, with synchronized scrolling. * nvim-gdb: thin wrapper for GDB, LLDB and PDB * nero.nvim: A REPL for Neovim * neogdb.vim: Vim GDB front-end for neovim * nvim-luadev: REPL for developing lua plugins * Conjure: Clojure and ClojureScript tooling for Neovim over a socket * Aniseed: Write plugins for Neovim in Fennel, a Lisp that compiles to Lua. * nvim-luapad: Interactive real time neovim scratchpad for the embedded lua engine. ### API Clients Plenty of new API clients: * Java: neovim-java * D: viniarck/nvimhost-d * Scala: viniarck/nvimhost-scala * NodeJS: neoclide/neovim * Dart: smolck/dart-nvim-api * Ocaml: janestreet/vcaml The python client also has been renamed to “pynvim”. ### GUIs Maybe 2018/2019 weren’t the years of the Linux desktop, but they sure were the years of the Neovim GUI: * veonim: a really cool electron-based GUI that aims to replicate the VSCode experience. * DinVim Vim for Mac: A “safe and secure” Neovim GUI - available on the OSX app store. * akiyosi/gonvim: A maintained fork of gonvim. * etorth/libnvc: An easy to embed GUI based on SDL. * mvilim/neovim-pytc-example: The first terminal UI for Neovim that isn’t the default terminal UI! * GNvim: “GUI for neovim, without any web bloat” written in Rust. * Firenvim: A big ball of web bloat that embeds Neovim in Chrome, Firefox and other browsers. * glrnvim: A terminal wrapper that launches neovim inside of alacritty. * yatli/fvim: A beautiful UI written in F# - who knew functionnal languages could actually be used for writing software? * Neo Vim: A new attempt at integration neovim into VSCode. * kethku/neovide: A “No nonsense Neovim client writen in rust” with a tiny bit of cursor madness. * dontpanic92/dotnvim: A C# neovim client with transparent backgrounds! ### Blog posts Some posts that talk specifically about Neovim things: * Writing Neovim plugins in lua: https://www.2n.pl/blog/how-to-write-neovim-plugins-in-lua * Writing your init.vim in lua: https://teukka.tech/luanvim.html * Using Neovim’s event loop from lua: https://teukka.tech/vimloop.html ## Stats Changed lines since the last newsletter: git log v0.3.0..v0.4.4 --numstat --pretty=tformat: --numstat | nawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' added lines: 168844 removed lines: 75466 total lines: 93378 Merged commits: git log v0.3.0..v0.4.4 --pretty=oneline | wc -l 3477 Different commit authors: git shortlog -e -s -n v0.3.0..v0.4.4 | wc -l 164 Documentation changes: git log v0.3.0..v0.4.4 --numstat --pretty=tformat: --numstat runtime/doc | nawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' added lines: 9226 removed lines: 7002 total lines: 2224 ## Thanks Thank you contributors, sponsors, bug-reporters, supporters. Note that you can now sponsor neovim via github Sponsors or on OpenCollective. Thank you **@justinmk** for the awesome project and thank you **@brammool** for your foundational work.
neovim.io
December 11, 2024 at 1:19 AM
Newsletter #9 - Three’s company
## What is Neovim? Neovim is a fork of the venerable text-editor vim, focused on extensibility and usability. It is not a rewrite but a continuation and extension of Vim. Many clones and derivatives exist, some very clever—but none are Vim. Neovim is built for users who want the good parts of Vim, and more. See a list of differences via :help vim-differences. ### Participating If you are interested in contributing to Neovim, visit the github page for details. We have a great test suite and automated CI, so you can just jump in and have a go. Don’t be afraid to open a PR to get comments or just take advantage of the infrastructure! To get in touch with the team, join the gitter channel (also accessible via IRC), or visit the Neovim subreddit, which many of the developers read. Taking part in conversations is a contribution, too! New contributor shoutout: @janlazo has been on a rampage for both windows support and porting neovim patches since about September 2017. Thank you! Old contributor shoutout: @jamessan has been around since March 2014, and, while being generally smart and helpful, has been doing tremendous work on the debian package of neovim. Thank you! ## What’s new The last newsletter covered everything up to release 0.2.2 of Neovim. Two years have passed, and the project has been as busy as ever improving both user and developer experience. Along the way we released in June 2018 the version 0.3. Though this newsletter arrives late (after version 0.4 was released), we still deemed it worth to introduce 0.3 in case you missed anything (0.4 will be covered in a future newsletter): As always, check Following HEAD for any breaking changes. #### 0.3 for Users * A lot of work has been put into making Neovim work better with different terminal emulators, and is still ongoing (**@justinmk** , #7664, #7653, #7720, #7640, #7624, **@florolf** , #7676 and **@erw7** #8408) * Linux Users: * Snap packaging available (**@kalikiana** , #7918) * BSD Users: * Support for NetBSD (**@utkarsh009** , #8197) * Windows Users: * Neovim ships with common tools (**@equalsraf, @justinmk** , #6105) * Building with VS2017 is now supported, see the wiki (**@b-r-o-c-k** , 8084) * Neovim is available on cygwin * `man.vim` improvements, uses lua for speedup (**@keidax** , #7623) * Output from `system()` and `:!` supports multibyte chars, and also handles control chars (CR, TAB) somewhat better (**@bfredl** , #7844) * Command mappings are supported (**@bfredl** , #4419) * An unmapped META key will be interpreted as Escape (**@justinmk** , #8226) * New flag `msgsep` for `display` to avoid fullscreen scrolling for messages (**@bfredl** , #8088) * See it in action: * Numbered marks are now saved in shada files (**@ZyX-I** , #5908) * The `--listen` command line option replaces the usage of `$NVIM_LISTEN_ADDRESS` (**@justinmk** , #8247) * Neovim treats stdin as text, rather than commands. If you want to run stdin as normal mode commands, use `nvim -s -` (**@justinmk** , #7679, **@ZyX-I** , #6299 and **@b-r-o-c-k** , #8276) * Neovim recognizes mouse events in (u)rxvt (**@symphorien** , #8309) * Macros apply `:lmap` when executing (**@hardenedapple** , #5658) * defaults: * do `:filetype` stuff unless explicitly “off” (**@justinmk** , #7809) * new defaults for `fillchars` (**@teto** , **@justinmk** , #8035) * `maxmem` and `maxmemtot` have been removed (**@philix** , #4486) #### 0.3 for Developers * The list implementation has been hidden behind an API to foster further improvements (**@ZyX-l** , #7708). Developers, in particular people that port patches from vim, should have a look at the wiki page. * Changed API functions: * `nvim_command_output` (**@justinmk** , #7821) * `vim_fgets` (**@mhinz** , #8228) * New API functions: * `nvim_list_uis` **@geekodour** , #8004) * `nvim_get_commands` (**@nimitbhardwaj** , **@justinmk** , #8375) * `stdpath` (**@docwhat** , #6272) * `nvim_set_client_info`, `nvim_get_chan_info` and `nvim_list_chans`(**@bfredl** , #6743) * `nvim_buf_attach`/`-detach` implement buffer change notifications. Using these functions, you can subscribe to events that are sent when a buffer has been updated, no matter the source or method (**@phodge** , **@KillTheMule** , #7917) * Channels: support buffered output and bytes sockets/stdio (**@bfredl** , #6844) * A proper viml expression parser is now available (**@ZyX-l** , #7234) * It comes with various highlight groups, have a look at the following screen recording: ### The near future: Upcoming * Floating Windows for external UI’s (**@bfredl** , #6619) * Extended Marks (**@timeyyy** , #5031) * Built in LSP support (**@tjdevries** , #6856) (see http://langserver.org/ why that could be of interest to you) ## Around Neovim ### GSOC Neovim had been accepted into the Google Summer of Code(GSOC). We’ve had two students working on interesting developments: * @UtkarshMe worked on extending the UI protocol and externalizing window layout and control. Be sure to check out his blog for a summary! * @b-r-o-c-k previously active on the windows front before, implemented a .NET API client for Neovim. Thanks for your awesome contributions, and thanks to the mentors @bfredl and @justinmk! ## Related projects The wiki page of related projects is an evergrowing list of projects that somehow make use of Neovim’s extended capabilities. Here’s a gist of additions since the last newsletter: ### Plugins The following plugins have found their way into our wiki: * neomake-multiprocess: A vim plugin for running multiple process asynchronously based on neomake * neopipe: send lines of text to an external command and display output in a scratch buffer * nuake: A Quake-style terminal panel for Neovim * semshi: Semantic Highlighting for Python * vim-ghost: Neovim client for GhostText browser extension (firefox and chrome) ### API Clients If you thought 3 C++ clients wasn’t enough, you will be happy to hear that a 4th contender has entered the arena: * magnum-neovim-api If you happen to prefer a language with no API client listed, a good starting point are the docs, and be sure to come talk about it on the gitter channel. ### GUIs Three new GUIs were added since the last newsletter: * javafx * sassanh/qnvim * vv ### Blog posts Some blog posts that talk about some specifically Neovim things: * `Testing plugins from Neovim` walks you through using the Neovim test infrastructure for your plugin * `Rpc benchmarks` shows and benchmarks different approaches in using the RPC API to create folds from a plugin. * `Neovim for Haskell Development ` shows how Neovim can help you with your haskell development needs ### Featured project For quite some time @mhinz has been maintaining neovim-remote. While only available on unices (though windows support is on the table), it solves some use cases people ask about frequently, such as: * How can I open a file in an already existing Neovim instance? * How can I open a file from a Neovim terminal without nesting editor instances? * How can I remotely send a command to a running Neovim instance? To whet your appetite, here’s a little gif ### Something missing? Know more than the wiki? Just edit the page to let the world know! ## Stats Changes lines since the last newsletter: git log --since="2017-12-16" --numstat --pretty=tformat: --numstat|gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' added lines: 109127 removed lines: 40267 total lines: 68860 Merged commits: git log --since="2017-12-16"|wc -l 24167 Different commit authors: git shortlog -e -s -n --since="2017-12-16"|wc -l 129 Documentation changes: git log --since="2017-12-16" --numstat --pretty=tformat: --numstat runtime/doc|gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' added lines: 4369 removed lines: 3645 total lines: 724 ## Thanks Thank you contributors, sponsors, bug-reporters, supporters. Thank you **@justinmk** for the awesome project and thank you **@brammool** for your foundational work.
neovim.io
December 11, 2024 at 1:19 AM
Google Summer of Code 2019
Neovim was again accepted into the Google Summer of Code program. View our page on the GSoC website for details. Our ideas list runneth over! You’re also welcome to propose other ideas in chat or on the ticket tracker. ## Results from last year In our first GSoC ever, we mentored two students who both completed their projects. Brock Mammen implemented a C# client for Nvim, and even went further with a Nvim extension for Visual Studio! He also made significant improvements to the build system, particularly for Windows/MSVC. The _multigrid_ project by Utkarsh Maheshwari involved low-level changes to the UI subsystem: > breaks up the screen grid in per-window grids, allows UIs to set different sizes for each window grid and receive grid based events. The final product was integrated by mentor Björn Linse into the Nvim `master` branch, providing the foundation for the floating windows feature. This demo shows the feature being used in a popular plugin to reveal documentation with completion results: ## Looking forward Our mentors are looking forward to your GSoC proposals in the next weeks! The best way to get familiar with Neovim development is to send a pull request to help out with a small bug or feature request. Working with students on pull requests is _extremely helpful_ for determining mentor-student workflow.
neovim.io
December 11, 2024 at 1:19 AM
Newsletter #8 - Open up the Windows
## What is Neovim? Neovim is a fork of the venerable text-editor vim, focused on extensibility and usability. It is not a rewrite but a continuation and extension of Vim. Many clones and derivatives exist, some very clever—but none are Vim. Neovim is built for users who want the good parts of Vim, and more. See a list of differences at :help vim-differences. ### Participating If you are interested in contributing to Neovim, read CONTRIBUTING.md to get started. We have a great test suite and automated CI, so you can just jump in and have a go. Don’t be afraid to open a PR to get comments or just take advantage of the infrastructure! To get in touch with the team, join the gitter channel (also accessible via IRC), or visit the Neovim subreddit, which many of the developers read. Taking part in conversations is a contribution, too! New contributor shoutout: **@ckelsel** has been responsible for porting a large number of vim patches, as has **@lonerover**. Thank you! Old contributor shoutout: **@oni-link** isn’t a name you read a lot in the commit logs, but he’s been very helpful in reviewing changes and improving complicated PR’s for quite some time. Thank you! ## What’s new The last newsletter has gathered some dust, so we want to bring you up-to-date in the Neovim world. Neovim has had 3(!) releases since back then, so let us recap those first and foremost: ### Release 0.2 This release brings a host of fixes and improvements. We’ll look at some of them closer below, but be sure to also check out the release page for all the gory details. #### 0.2 for Users * Microsoft Windows is now fully supported * `:terminal` mode is available in 0.2.1, see below! * Starting this release, Neovim offers pre-built packages for macOS and Windows (32-bit and 64-bit). The Windows package contains a GUI and some additional tools like `curl.exe`. * `:terminal` has seen various improvements (**@justinmk** , #6185) * `findfile()`, `:find` and `gf` now work in `:terminal` buffers (**@tweekmonster** , #6009) * Shell output is now throttled to maintain terminal responsiveness (**@justinmk** , #5396) * Arguments for shell commands now work properly with `:term` (**@friedsock** , #4504) * Numerous improvements to man.vim have been made (**@m-wynn** , **@raichoo** , **@renstrom** , **@justinmk** , #6693, #6766, #6815, #3104, #7405) * Man and help pages now contain a TOC (**@tweekmonster** , #5169) * The message `Reading from stdin` was removed (**@msva** , #6298) * `guicursor` now works in the TUI (**@teto** , #6423) * There’s a new highlight group `Whitespace` for whitespace-related `listchars` (**@zhou13** , #6367) * Commandline completion has been implemented (**@justinmk** , #6376) * The event `DirChanged` is now available for autocommands (**@mhinz** , #5928) * `cpoptions`: Use the `_` flag to toggle `cw` behaviour (**@raichoo** , **@chrisbra** , #6235) * `CTRL-R` now omits trailing `^M` when pasting to the commandline (**@justinmk** , #6137) * You can now `:edit` filenames without escaping whitespaces (**@Kurt-Bonatz** , #6119) * Changes to defaults: * `mouse=a` is no longer the default (**@justinmk** , #6022) * `NVIM_TUI_ENABLE_CURSOR_SHAPE` was removed, you can use `guicursor` instead (see https://github.com/neovim/neovim/releases/tag/v0.2.0) * `showcmd`, `belloff=all`, `ruler` are now default (**@justinmk** , #6087) #### 0.2 for Developers * Full API documentation at :help api * API changes: * `{get,set}_option` now update local options as appropriate (**@yagebu** , #6405) * `nvim_get_mode` is available (**@justinmk** , #6247) * External UIs can now draw the tabline (**@dzhou121** , #6583) * `writefile` now obeys the `fsync` option (**@ZyX-I** , #6427) * In addition to the effort from the vim guys (7.4.{2055,2057,2058}), `eval.c` has been refactored and error messages were improved (**@ZyX-I** , #5119) * The `id` function is now available, and `printf(%p)` is finally useful (**@ZyX-I** , #6095) * All providers will be disabled if `g:loaded_*` exists (**@justinmk** , commit) * `setpos` can now set lowercase marks in other buffers (**@hardenedapple** , #5753) * You can check `v:exiting` to see if Neovim is exiting (**@mhinz** , #5651) ### Release 0.2.1 Next let’s see what happened in 0.2.1. As before, check out the release notes for details. #### 0.2.1 for Users * Nvim now supports window-local highlighting (**@bfredl** , #6700) * Even more terminal improvements: * TUI cursor motion, SGR, and scrolling optimizations, cursor shape and terminal type recognition improvements have been merged (**@jdebp** , #6816) * Terminal buffers are adjusted when using the number column (**@tecywiz121** , #7440) * A newly created `:terminal` will now stay in normal mode (**@nelstrom** , #6808) * The command line can now be colored (**@ZyX-l** , #6364) * Custom clipboard providers can now be configured (**@nhooyr** , #6030) * The clipboard provider can now fall back to tmux support (**@xu-cheng** , #6894) * Further improvements for `:Tutor` have been made (**@fmoralesc** , #7028) * `inccommand` now works with leading modifiers like `keeppattern` (**@jamessan** , #6967) * The ruby host can be configured (**@alexgenco** , #6841) * The unnamed register is kept on restart (**@AdnoC** , #4700) * For Windows users: * Neovim can be used on the console (**@equalsraf** , #6315) * `:terminal` has been implemented (**@erw7** , #7007) * Path handling on windows has been improved (**@aignas** , #7349) * For Linux users: * You can now download AppImage packages (**@AdnoC** , #6638) * Function keys now work in the terminal UI (**@rjmill** , #5014) * Fixed a crash with extremely long lines (more than 100m virtual columns) (**@Grimy** , #3527) * `:cquit` now takes an optional error code as argument (**@joshleeb** , #7336) * True colors in tmux have been fixed (**@DarkDefender** , #7100) * `:checkhealth` is a builtin now, and validates your `$VIMRUNTIME` (**@justinmk** , #7399) * `cursorcolumn` and `colorcolumn` respect syntax highlighting (**@zhou13** , **@justinmk** , #7364) #### 0.2.1 for Developers * Changes: * External UIs now should use the `FocusGained` event instead of sending the `<FocusGained>` pseudokey (**@justinmk** , #7221) * Neovim sources are now analyzed with PVS (**@ZyX-l** , #6493) * External UIs can now draw * … the tabline (**@dzhou121** , #6583) * … the command line (**@dzhou121** , **@bfredl** , #6162) * … the wildmenu (**@dzhou121** , **@bfredl** , #7454) * Lua is gaining momentum: * The interface has been implemented (**@ZyX-I** , #4411) * Lua files can now be required from `lua/` (**@ZyX-l** , #6789) * Call lua directly from the API (**@bfredl** , #6704) * Programmatically get information about mappings via `get_keymap` (**@tjdevries** , #6236) * You can now retrieve highlights `using nvim_get_hl_by_name/by_id` (**@teto** , #7082) * `bufhl` can now be used to create new highlighting groups (**@bfredl** , #7414) * External UIs can get menus from `menu_get` (**@teto** , #6322) * `menu_get` pretty-prints special chars, making it possible to feed its results back into e.g. `nvim_input` (**@teto** , **@KillTheMule** , #7340) * RPC clients can connect to a socket using `sockconnect` (**@bfredl** , #6594) * `serverstart` now uses `uv_getaddrinfo()`, bringing IPv6 support (**@mhinz** , #6680) * You can now define several functions in one `:execute` call (**@ZyX-I** , #6914) * Logging has been enabled per default (**@justinmk** , #6827) ### Release 0.2.2 This is a fast-and-furious containing mostly bug-fixes. See the release-notes for details. Some new features are in, too: * `curdir` has been added as a viewoption (**@EricR86** , #7447) * A node host is available (**@billyvg** , #7458) * `:checkhealth` now also validates the runtimepath (**@justinmk** , #7526) * `scrollback` now defaults to 10000 (**@justinmk** , #7556) * A bugfix of note is the reversal of the netrw update, we’ve been seeing quite some reports about that! (**@justinmk** , #7557) ### 0.2.3-dev Want to know what to expect from the next release? Here’s a list to whet your appetite: * `CmdlineEnter` and `CmdlineLeave` autocommands (**@bfredl** , #7422) * Channels: support buffered output and bytes sockets/stdio (**@bfredl** , #6844) * A proper viml expression parser (**@ZyX-l** , #7234) * A lot of work has been put into making Neovim work better with different terminal emulators, and is still ongoing (**@justinmk** , #7664, #7653, #7720, #7640, #7624 and **@florolf** , #7676) ### The near future: Upcoming For an overview of planned features, goals and ideas for Neovim head to the road map. Some noteworthy upcoming PRs are: * Floating Windows for external UIs (**@bfredl** , #6619) * Extended Marks (**@timeyyy** , #5031) * Buffer change notifications (**@phodge** , #5269) * Built in LSP support (**@tjdevries** , #6856) (see http://langserver.org/ why that could be of interest to you) **_PSA_** : If you build Neovim from the latest master, always check Following HEAD for any changes. ## Around Neovim The wiki page of related projects has seen quite some additions, check out the full changes here. ### API clients API clients are at the heart of Neovim’s architecture, and significantly improve developer experience. Write a plugin in any language you want! Since the last newsletter, we’ve seen the addition of another C++ client, one for Elixir, and a Racket client. The node client got an overhaul and a new maintainer. Thanks **@billyvg** for taking over! While not totally new, a special shoutout goes to the ruby client for being very well-maintained. Thanks, **@alexgenco**! If you happen to prefer a language not yet listed, a good starting point are the docs, and be sure to come talk about it on the gitter channel. ### GUIs Too much activity has happened on the GUI front to list all new clients, so let’s just have a look at some that stand out. VSCode is using Neovim to properly integrate ex-mode commands, and Sublime Text 3 gained full Neovim integration. The latter also makes use of another cool Neovim-specific feature, the externalized popupmenu, and it only took them 50 LOC. Last but not least, eovim is an enlightenment client for Neovim. ### The Architecture of Neovim. Some students have studied the Architecture of Neovim and published an “analytical essay” about their findings. Be sure to have a look if you are interested in the bigger picture. ### Vimcasts and Modern Vim Drew Neil of vimcasts fame has started recording casts about Neovim, and began work on a successor to his praised book Practical Vim called Modern Vim. Most of the book will be suitable for Vim 8 and Neovim users, but about 1/3rd of the book will cover Neovim-specific functionality. ### Libuv One of the founding stones of Neovim has been porting I/O to libuv. So you will be happy to hear that libuv has set out to support more platforms. Neovim, soon coming to a platform near you! ### Test suite Neovim offers easy testing via the wonderfully simple Lua language. Why aren’t others doing it, you ask? Turns out, they do, or at least, the neomutt project is preparing for it. Very nice to see ideas from Neovim taken up. ## Stats Changes lines since the last newsletter: git log --since="2016-11-01" --numstat --pretty=tformat: --numstat|gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' added lines: 255393 removed lines: 221106 total lines: 34287 Merged commits: git log --since="2016-11-01"|wc -l 3110 Different commit authors: git shortlog -e -s -n --since="2016-11-01"|wc -l 146 Documentation changes: git log --since="2016-11-01" --numstat --pretty=tformat: --numstat runtime/doc|gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' added lines: 8579 removed lines: 6577 total lines: 2002 ## Thanks Thank you contributors, sponsors, bug-reporters, supporters. Thank you **@justinmk** for the awesome project and thank you **@brammool** for your foundational work. **@brammool** and **@chrisbra** from the vim team have left a few comments on our issue tracker, it’s nice to be working together!
neovim.io
December 11, 2024 at 1:19 AM
Newsletter #7 - Summer of Road
It’s time for the Neovim newsletter! Skip to the Fun and Features sections if you only care about new features. There are also changes in project management that you should know about. ## What is Neovim? Each minute, a new text editor is born (source: Hacker News). There are endless text editors that address the “common case”. Instead of another _Vim-like_ text editor, Neovim users want a better Vim. Thousands of small decisions live in the Vim core, accumulated over decades; most of those decisions are still relevant, solving subtle problems that new projects have yet to encounter, digest and decide. Neovim is a refactor of Vim to make it viable for another 30 years of hacking. See `:help vim-differences` for a reference of changes and improvements. ## Should I switch? Neovim very intentionally builds on the long history of Vim community knowledge and user habits. That means **“switching” from Vim to Neovim is just an “upgrade”** —like installing a new version of Vim. If you log onto a server or workstation with only Vim, you won’t be lost. If you find an article about Vim, it likely also applies to Neovim, unless it’s about `:smile`. So if you like Vim, try Neovim. If you love Vim, try this ;) ## Hacking… or plain old Engineering From the start, one of Neovim’s explicit goals has been: > Simplify maintenance and encourage contributions We want a _hackable Vim_ : a codebase and community that enables experimentation and low-cost trials of new features. And there’s evidence of real progress towards that ambition. We’ve successfully executed non-trivial “off-the-roadmap” patches: features which are important to their authors, but not the highest priority for the project. * `:tchdir` enables tab-local “working directory” * `'statusline'` supports unlimited alignment sections (PR #4489) * TextYankPost event makes it trivial to implement a reliable yank ring, send yanks to an external service, and applications we didn’t anticipate * QuickFixLine is a new highlight group * `man.vim` offers completion, improved highlighting, and more These patches were included because they: 1. fit into existing conventions/design 2. included robust test coverage (enabled by an advanced test framework and CI) 3. received thoughtful review by other contributors They are casually mentioned in `:help nvim-features` :) ## Fun without `:smile`? New clients and innovative applications are appearing more frequently than ever. * NyaoVim is a thoughtfully-designed, modular **Electron GUI**. * Its `<neovim-editor>` web component can be used in **your own project** , including VS Code, Atom, and other Electron or nw.js projects! * ONI is an Electron-based **Neovim IDE** showing many exciting possiblities. It also has a cool logo like NyaoVim :) * Users love **deoplete**, the first **non-blocking auto-completion** plugin for vim. * @qvacua turned his sights to `nvim`, progressing rapidly on a new `nvim`-based backend for his well-known VimR project, a polished **GUI for macOS**. There are pre-built `.app` bundles for macOS 10.11 at the releases page. * The cross-platform **neovim-qt** GUI continues to get better: it’s as fast as gVim, with less flicker, and it doesn’t depend GTK/KDE. * neovim.app is a macOS Neovim GUI available via homebrew for macOS 10.9+. * nvim-hs is a host to enable **writing Neovim plugins in Haskell**. * Check out cl-neovim for authoring **Neovim lisp plugins**. Includes `:Lispdo`! * nvr now supports the Vim “clientserver” options `--servername`, `--remote`, etc. `nvr` is perfect for **communicating with a parent`nvim` instance** from a `:terminal` buffer. * Intero users are joyful about intero.nvim and intero-neovim There are clients for go, julia, perl, Java, R, Elixir, Clojure, and more. Visit the related projects wiki page to discover new projects as they emerge! ## Project management > Clarity and consistency breed contribution. — @robertmeta ### Benevolent Dictator For a Limited time In July, Thiago (@tarruda) took a less active role in the project, for personal reasons. He hopes to resume active contributions in the future. Some have asked for a “BDFL” to be named. @justinmk has that role, unless you want it: we’ve made steps to document the role of maintainer, so that anyone trusted by most contributors can step up in the future. The ultimate goal is to spread out tasks as horizontally as possible, and to continue to give the “commit bit” to people we’ve grown to trust. There are currently 14 core contributors; we’d like to scale that to 50. We don’t want the project to depend on heroic effort, but a flow of interested parties working within the conventions and etiquette of the Vim community. ### Funding The (ongoing) successful funding campaign yielded libmpack, `:terminal`, and major refactors and improvements (e.g. decoupling the UI logic from the TUI). With Thiago taking a less active role in the project, the funding is available to other developers. @ZyX-I, a prolific committer to Neovim (21 kLOC contributed) and Vim (13 kLOC, including `if_python`), agreed to take the role of “lead developer”, i.e. the developer who receives the funding. His work on Neovim includes: * first-class XDG support, shada, build-time generators, automated change-aware linter, Lua-to-VimL translator * critical internals such as `msgpackparse()` and `os/fileio.c` (buffered I/O) * complete rewrite of Vim JSON support, including granular error messages * comprehensive test coverage for all of the above The funding does not always go to one person. It’s available to any core contributor who wants to take a month or more to focus on Neovim. ### Donations Because funding is monthly, it is (hopefully) a low-friction decision: * To donate $10, you could pledge $1 per month. * If the project makes you rage, just cancel your pledge. * If the project makes you happy (despite the lack of `:smile`, somehow), let the pledge continue! ## API The Neovim API is one of the defining technical and “soft” features of the project. In PR #5535 we formed a strategy for **growing the API without breaking clients**. * We established the _API Level_ concept, to enable trivial comparison and emphasize that the API version is separate from the Neovim version. * We added version and deprecation fields to the API metadata. * We’ll never break API function signatures published in a tagged release. * We won’t remove deprecated API functions until Neovim version `2.0` (if ever). The API should only **grow**, not break. Each API function is marked by the API level where it first became available. This makes it practical for the numerous Neovim API clients to support any released version of Neovim. Since PR #4934 you can call the API of the current `nvim` process **directly from VimL** : :echo nvim_buf_get_lines(42, 1, 3, v:false) Try `:call nvim_<Tab>` at the command line to see the available API functions, or install the nvim-api-viewer plugin to see a nice overview of available API functions. We take API reliability seriously, and we’ve tried to think carefully about the design. Feedback from plugin and client authors is appreciated! ## Release strategy ### Versioning One year ago we announced our first release, `0.1`. We’ve streamlined the release process (versioning, tagging, changelogs, announcements). Some users wonder if `0.1` means Neovim is unstable. * Each release since `0.1` is considered **stable for use** on all systems except Windows. * Windows will be a first-class target starting with `0.2`. * Until `1.0`, some non-API features may break backwards compatibility. This is uncommon, and these cases are always documented. * In `0.1.6` we introduced **API versioning**. Clients can dynamically decide which functions to use. We follow semver; the recommendations there explain the intention of the `0.x` series. ### OS Packages More OS packages are appearing. Neovim is part of **Debian’snext release!** Special thanks to @jamessan (Debian maintainer and Neovim contributor), @fwalch and others who build packages for their favorite systems and work with us to address inevitable compiler/platform quirks. ## Progress What did Neovim contributors accomplish since 2014? By a conservative estimate at least 20,000 new lines of C code have been written. We’ve written 2200 _new_ tests, in addition to passing Vim’s own test suite. 273 different people have contributed to the core project. The core project has more commits in 3 years than Vim in 12 years. Besides major refactoring and feature work, a ton of time was put into the Neovim continuous integration (CI) system. In a stable but fragile C codebase, maintainers tend to ignore “small” features because they may be too risky. CI reduces fragility so we can welcome feature work large _and small_ , instead of fearing change. New features can be tested rigorously with **screen tests**. For example, here’s a test that exercises the `'wildmode'` UI behavior: describe("'wildmenu'", function() it(':sign <tab> shows wildmenu completions', function() execute('set wildmode=full') execute('set wildmenu') feed(':sign <tab>') screen:expect([[ | ~ | ~ | define jump list > | :sign define^ | ]]) end) end) After we forked Vim in 2014, there was an unstable period; that gap has become smaller and smaller, and will vanish in 2017. Each regression fix is covered by integration tests. Each pull request builds against 12 different environments. Special thanks to @jszakmeister, @fwalch and @ZyX-I for their work on the build system, and to @oni-link for fixing some very difficult bugs. ### Little things matter One of the strongest impressions from social media is that people really appreciate _less friction_ when they try Neovim. **Defaults matter.** Tim Pope deserves credit for curating many of the defaults we chose. @fmoralesc and others thought carefully about how to implement these defaults without causing regressions (`encoding=utf8` and syntax/filetype were tricky). The work was tedious, but justified: it’s a _one-time_ cost that helps new users, old users on new systems (which are everywhere these days: VMs, containers, servers…), and _all_ users by propagating Vim “best practices”. ## Features Here are some new developments since the last newsletter. * **Ruby support** landed in 0.1.5. This means you can write Neovim plugins in ruby _and_ the legacy Vim `:ruby*` commands are supported (so existing Vim+ruby plugins work in Neovim, such as Command-t and vim-github-dashboard). * To enable Ruby support, just `gem install neovim`. You don’t need to worry about compiling against a specific version. * **Write plugins in Go** with the Neovim API Go client! (Thanks to @garyburd!) * `:CheckHealth` detects common problems (like Homebrew’s `doctor`). Run it whenever you install or upgrade Neovim. * **buffer-local highlighting** (`:help api-highlights`) is similar to `matchaddpos()`, with some key differences: it is associated with a buffer and **adapts to line insertions and deletions**. Useful for linter or semantic highlighter plugins that monitor a buffer for changes and compute highlights in the background. ### Externalized UI Widgets In PR #4432 @bfredl made the first step to give UIs more control over the display of “widgets”. @romgrk quickly made a proof of concept. It didn’t take long for an ambitious patch to externalize **cmdline, tab, wildmenu, and preview window widgets**. The demo shows exciting potential: This work was possible because @tarruda cleanly separated the terminal-UI (TUI) from the internal screen, so **even the built-in TUI is driven by UI events** like any other externalized UI. ### Incremental (“live”) `:substitute` In May 2016 a group of students mentored by Eric Burel contacted us about contributing to Neovim. From a list of ideas we provided, they decided to implement a “live preview” for `:substitute`. We merged it in PR #5561, released in `0.1.7`. Set the `inccommand` option to try it: :set inccommand=split This feature was made possible by our development model: despite having “no time” for a side-project, we outlined the basic idea, the students made decisions out-of-band, and we provided clarification as needed. * The students posted a PR to allow ongoing feedback. The PR fork was updated regularly, so reviewers could pull, build, and test. * Tests were written using screen tests, helping coverity/ASan/etc to exercise the feature and reviewers to **visualize the behavior**. * The automated build system continuously ran the changes against 12 different systems. Eric wrote about the experience. Thanks to Eric, the students at ENSIMAG, @KillTheMule, and @bfredl for carrying this feature to a conclusion we are proud of. ### Upcoming Look for the following developments in 2017 for Neovim `0.3`. * We will ship Lua as a default scripting alternative in 2017. The next “inflection point” of reduced-risk, rapid enhancement is to make the core extensible with Lua. For that PR #4411 is an important step. * With ZyX’s eval.c refactor the monolithic `eval.c` will be separated into modules, marking a point where Neovim’s VimL implementation diverges from Vim’s. This will be the world’s second **alternative VimL implementation** (ZyX’s VimL-to-Lua PR was the first). * Extended marks will give plugin authors more powerful and flexible marks. * We will take a close look at the Microsoft Language Server Implementation to decide how it and similar middleware can integrate elegantly with Neovim. ## EOF So that was 2016 for Neovim. Could 2017 be the Year of the Neovim Desktop? Neovim’s ideas are finding their way into other projects, such as Xi editor and Vim itself, which has seen more activity this year than any other year in its history. There’s a beehive of activity in the gitter and IRC channels (which are bridged by matrix thanks to @leonerd!). Visit us to talk about the project. And don’t forget there’s a roadmap at neovim.io if you want to check where the project is headed. Thanks for reading. —Justin M. Keyes (@justinmk) * * * ##### note1 $ git log --grep='\([zZ]y[xX]\)\|\([nN]ikolai [pP]av\)\|\([nN]ikolay [pP]av\)' --numstat --pretty=tformat: --numstat|gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' added lines: 22590 removed lines: 8620 total lines: 13970 $ git log --grep='[cC]hristian [bB]rab' --numstat --pretty=tformat: --numstat|gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' added lines: 10000 removed lines: 3033 total lines: 6967 ##### note2 $ ohcount msgpack_rpc/ api/ os/ event/ tui/ shada.c rbuffer.c terminal.c memory.c c 79 14576 2863 16.4% 2154 19593
neovim.io
December 11, 2024 at 1:19 AM