wiki/_next/data/Ie9t5zutrXP6Of75Cb5xF/editor.neovim.lua.json
2022-07-29 15:41:17 +00:00

1 line
13 KiB
JSON

{"pageProps":{"metadata":{"date":"\"2021-07-15 07:45:50 +08:00\"","date_modified":"\"2022-04-20 21:19:43 +08:00\"","language":"en","source":""},"title":"Neovim Lua integration","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"setting-configuration-with-lua"},"children":[{"type":"text","value":"Setting configuration with Lua"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/editor.neovim.lua#setting-configuration-with-lua"},"children":[{"type":"text","value":"Setting configuration with Lua"}]}]},{"type":"element","tagName":"li","data":{"hookArgs":[{"type":"element","tagName":"h1","properties":{"id":"real-life-examples-making-use-of-neovim-lua-api"},"children":[{"type":"text","value":"Real-life examples making use of Neovim Lua API"}]}]},"properties":{"className":"toc-item toc-item-h1"},"children":[{"type":"element","tagName":"a","properties":{"className":"toc-link toc-link-h1","href":"/editor.neovim.lua#real-life-examples-making-use-of-neovim-lua-api"},"children":[{"type":"text","value":"Real-life examples making use of Neovim Lua API"}]}]}]}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"with Lua integration, you can create "},{"type":"element","tagName":"a","properties":{"href":"/editor.neovim.lua-modules"},"children":[{"type":"text","value":"Neovim Lua modules"}]}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"you can start with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"lua-intro"}]},{"type":"text","value":" section from "},{"type":"element","tagName":"a","properties":{"href":"/editor.neovim.help-system"},"children":[{"type":"text","value":"Neovim help system"}]},{"type":"text","value":";\n it gives all of the information on the things you need to get started with configuring Neovim with Lua as well as pointers for more things to do with Lua;\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Neovim also extends the Lua standard library found in "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"vim"}]},{"type":"text","value":" object;\n see the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"lua-stdlib"}]},{"type":"text","value":" in "},{"type":"element","tagName":"a","properties":{"href":"/editor.neovim.help-system"},"children":[{"type":"text","value":"Neovim help system"}]}]}]}]},{"type":"element","tagName":"h1","properties":{"id":"setting-configuration-with-lua"},"children":[{"type":"text","value":"Setting configuration with Lua"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"There are some equivalent setting values in Lua versus Vimscript.\nFor more information, see the "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"lua-vimscript"}]},{"type":"text","value":" help section.\n"}]},{"type":"element","tagName":"table","properties":{},"children":[{"type":"element","tagName":"thead","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Description"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Vimscript statement"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Lua equivalent"}]}]}]},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Setting options"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"set number relativenumber"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"vim.opt.number, vim.opt.relativenumber = true, true"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Setting local options"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"setlocal spell"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"vim.opt_local.spell = true"}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Running Vimscript commands"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"colorscheme nord"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"vim.cmd \"colorscheme nord\""}]}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Setting buffer-specific options"}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"b:ale-enabled=1"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"vim.b[\"ale-enabled\"] = 1"}]}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Some more general things you generally want to know:\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can still execute Vimscript with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"vim.cmd"}]},{"type":"text","value":".\n For more information, see "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":":h lua-vimscript"}]},{"type":"text","value":" from the help system.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can access environment variables through "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"vim.env"}]},{"type":"text","value":" — e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"vim.env.HOME"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"vim.env.MYVIMRC"}]},{"type":"text","value":".\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Highlight options are mostly in "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"vim.highlight"}]},{"type":"text","value":" — e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"highlight clear SpellCap"}]},{"type":"text","value":" versus "},{"type":"element","tagName":"code","properties":{"className":["inline-code"]},"children":[{"type":"text","value":"vim.highlight"}]},{"type":"text","value":".\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can manipulate variables of various scopes from "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"vim.{g,b,..,t}"}]},{"type":"text","value":".\n To see more details, see "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"lua-vim-variables"}]},{"type":"text","value":" help section.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"vim.opt"}]},{"type":"text","value":" will return an Option object, it has a common API.\n to learn more about it, see "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"vim.opt"}]},{"type":"text","value":" and its subsections.\n"}]}]}]},{"type":"element","tagName":"h1","properties":{"id":"real-life-examples-making-use-of-neovim-lua-api"},"children":[{"type":"text","value":"Real-life examples making use of Neovim Lua API"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"This is a list of "},{"type":"element","tagName":"a","properties":{"href":"/editor.neovim.lua-modules"},"children":[{"type":"text","value":"Neovim Lua modules"}]},{"type":"text","value":" that can serve as a basis for learning to interact Neovim with Lua.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://github.com/savq/paq-nvim"},"children":[{"type":"text","value":"paq-nvim"}]},{"type":"text","value":" is a simple Neovim package manager\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://github.com/wbthomason/packer.nvim"},"children":[{"type":"text","value":"packer.nvim"}]},{"type":"text","value":" is a more comprehensive package manager\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://github.com/L3MON4D3/LuaSnip"},"children":[{"type":"text","value":"LuaSnip"}]},{"type":"text","value":" is a snippet engine\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://github.com/nvim-telescope/telescope.nvim"},"children":[{"type":"text","value":"telescope.nvim"}]},{"type":"text","value":" is a fuzzy finder integrated inside Neovim\n"}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Several people have already replaced their already existing Vim configurations with Neovim.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"TJ DeVries' "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/tjdevries/config_manager/"},"children":[{"type":"text","value":"Neovim config"}]},{"type":"text","value":" is fully written in Lua complete with his own plugins.\n"}]}]},{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"ThePrimeagen's "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/ThePrimeagen/.dotfiles/"},"children":[{"type":"text","value":"public dotfiles"}]},{"type":"text","value":" contains Neovim config written in Lua.\n"}]}]}]}]},"backlinks":[]},"__N_SSG":true}