mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
673d2b52fa
Problem: The function name `vim.pretty_print`: 1. is verbose, which partially defeats its purpose as sugar 2. does not draw from existing precedent or any sort of convention (except external projects like penlight or python?), which reduces discoverability, and degrades signaling about best practices. Solution: - Rename to `vim.print`. - Change the behavior so that 1. strings are printed without quotes 2. each arg is printed on its own line 3. tables are indented with 2 instead of 4 spaces - Example: :lua ='a', 'b', 42, {a=3} a b 42 { a = 3 } Comparison of alternatives: - `vim.print`: - pro: consistent with Lua's `print()` - pro: aligns with potential `nvim_print` API function which will replace nvim_echo, nvim_notify, etc. - con: behaves differently than Lua's `print()`, slightly misleading? - `vim.echo`: - pro: `:echo` has similar "pretty print" behavior. - con: inconsistent with Lua idioms. - `vim.p`: - pro: very short, fits with `vim.o`, etc. - con: not as discoverable as "echo" - con: less opportunity for `local p = vim.p` because of potential shadowing. |
||
---|---|---|
.. | ||
editorconfig.lua | ||
gzip.vim | ||
health.vim | ||
man.lua | ||
matchit.vim | ||
matchparen.vim | ||
netrwPlugin.vim | ||
nvim.lua | ||
rplugin.vim | ||
shada.vim | ||
spellfile.vim | ||
tarPlugin.vim | ||
tohtml.vim | ||
tutor.vim | ||
zipPlugin.vim |