*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 January 18 ============================================================================== Table of Contents *LazyVim-table-of-contents* 1. LazyVim |LazyVim-lazyvim| - Features |LazyVim-features| - Requirements |LazyVim-requirements| - Getting Started |LazyVim-getting-started| - File Structure |LazyVim-file-structure| - Configuration |LazyVim-configuration| - Configuring **Plugins** |LazyVim-configuring-**plugins**| - Keymaps |LazyVim-keymaps| - Plugins |LazyVim-plugins| ============================================================================== 1. LazyVim *LazyVim-lazyvim* LazyVim is a Neovim setup powered by lazy.nvim to make it easy to customize and extend your config. Rather than having to choose between starting from scratch or using a pre-made distro, LazyVim offers the best of both worlds - the flexibility to tweak your config as needed, along with the convenience of a pre-configured setup.

image

FEATURES *LazyVim-features* - Transform your Neovim into a full-fledged IDE - Easily customize and extend your config with lazy.nvim - Blazingly fast - Sane default settings for options, autocmds, and keymaps - Comes with a wealth of plugins pre-configured and ready to use REQUIREMENTS *LazyVim-requirements* - Neovim >= **0.8.0** (needs to be built with **LuaJIT**) - Git >= **2.19.0** (for partial clones support) - a Nerd Font **_(optional)_** GETTING STARTED *LazyVim-getting-started* You can find a starter template for **LazyVim** here Try it with Docker >sh docker run -w /root -it --rm alpine:edge sh -uelic ' apk add git lazygit neovim ripgrep alpine-sdk --update git clone https://github.com/LazyVim/starter ~/.config/nvim cd ~/.config/nvim nvim ' < Install the LazyVim Starter - Make a backup of your current Neovim files: >sh mv ~/.config/nvim ~/.config/nvim.bak mv ~/.local/share/nvim ~/.local/share/nvim.bak < - Clone the starter >sh git clone https://github.com/LazyVim/starter ~/.config/nvim < - Start Neovim! >sh nvim < Refer to the comments in the files on how to customize **LazyVim**. FILE STRUCTURE *LazyVim-file-structure* The files under config will be automatically loaded at the appropriate time, so you don’t need to require those files manually. **LazyVim** comes with a set of default config files that will be loaded **_before_** your own. See here You can add your custom plugin specs under `lua/plugins/`. All files there will be automatically loaded by lazy.nvim
~/.config/nvim
 lua
    config
       autocmds.lua
       keymaps.lua
       lazy.lua
       options.lua
    plugins
        spec1.lua
        
        spec2.lua
 init.toml
CONFIGURATION *LazyVim-configuration* **LazyVim** can be configured in the same way as any other plugin. For example in `lua/plugins/core.lua` >lua return { { "LazyVim/LazyVim", opts = { colorscheme = "catppuccin", } } } < Default Settings >lua { -- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme ---@type string|fun() colorscheme = function() require("tokyonight").load() end, -- icons used by other plugins icons = { diagnostics = { Error = " ", Warn = " ", Hint = " ", Info = " ", }, git = { added = " ", modified = " ", removed = " ", }, kinds = { Array = " ", Boolean = " ", Class = " ", Color = " ", Constant = " ", Constructor = " ", Enum = " ", EnumMember = " ", Event = " ", Field = " ", File = " ", Folder = " ", Function = " ", Interface = " ", Key = " ", Keyword = " ", Method = " ", Module = " ", Namespace = " ", Null = " ", Number = " ", Object = " ", Operator = " ", Package = " ", Property = " ", Reference = " ", Snippet = " ", String = " ", Struct = " ", Text = " ", TypeParameter = " ", Unit = " ", Value = " ", Variable = " ", }, }, } < CONFIGURING **PLUGINS** *LazyVim-configuring-**plugins*** Configuring **LazyVim** is exactly the same as using **lazy.nvim** to build a config from scratch. For the full plugin spec documentation please check the **lazy.nvim** readme . Example spec: lua/plugins/example.lua >lua -- every spec file under config.plugins will be loaded automatically by lazy.nvim -- -- In your plugin files, you can: -- add extra plugins -- disable/enabled LazyVim plugins -- override the configuration of LazyVim plugins return { -- add gruvbox { "ellisonleao/gruvbox.nvim" }, -- Configure LazyVim to load gruvbox { "LazyVim/LazyVim", opts = { colorscheme = "gruvbox", }, }, -- change trouble config { "folke/trouble.nvim", -- opts will be merged with the parent spec opts = { use_diagnostic_signs = true }, }, -- disable trouble { "folke/trouble.nvim", enabled = false }, -- add symbols-outline { "simrat39/symbols-outline.nvim", cmd = "SymbolsOutline", keys = { { "cs", "SymbolsOutline", desc = "Symbols Outline" } }, config = true, }, -- override nvim-cmp and add cmp-emoji { "hrsh7th/nvim-cmp", dependencies = { "hrsh7th/cmp-emoji" }, ---@param opts cmp.ConfigSchema opts = function(_, opts) local cmp = require("cmp") opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "emoji" } })) end, }, -- change some telescope options and a keymap to browse plugin files { "nvim-telescope/telescope.nvim", keys = { -- add a keymap to browse plugin files -- stylua: ignore { "fp", function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end, desc = "Find Plugin File", }, }, -- change some options opts = { defaults = { layout_strategy = "horizontal", layout_config = { prompt_position = "top" }, sorting_strategy = "ascending", winblend = 0, }, }, }, -- add telescope-fzf-native { "nvim-telescope/telescope.nvim", dependencies = { { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } }, -- apply the config and additionally load fzf-native config = function(_, opts) local telescope = require("telescope") telescope.setup(opts) telescope.load_extension("fzf") end, }, -- add pyright to lspconfig { "neovim/nvim-lspconfig", ---@class PluginLspOpts opts = { ---@type lspconfig.options servers = { -- pyright will be automatically installed with mason and loaded with lspconfig pyright = {}, }, }, }, -- add tsserver and setup with typescript.nvim instead of lspconfig { "neovim/nvim-lspconfig", dependencies = { "jose-elias-alvarez/typescript.nvim", init = function() require("lazyvim.util").on_attach(function(_, buffer) -- stylua: ignore vim.keymap.set( "n", "co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" }) vim.keymap.set("n", "cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer }) end) end, }, ---@class PluginLspOpts opts = { ---@type lspconfig.options servers = { -- tsserver will be automatically installed with mason and loaded with lspconfig tsserver = {}, }, -- you can do any additional lsp server setup here -- return true if you don't want this server to be setup with lspconfig ---@type table setup = { -- example to setup with typescript.nvim tsserver = function(_, opts) require("typescript").setup({ server = opts }) return true end, -- Specify to use this function as a fallback for any server -- [""] = function(server, opts) end, }, }, }, -- for typescript, LazyVim also includes extra specs to properly setup lspconfig, -- treesitter, mason and typescript.nvim. So instead of the above, you can use: { import = "lazyvim.plugins.extras.lang.typescript" }, -- add more treesitter parsers { "nvim-treesitter/nvim-treesitter", opts = { ensure_installed = { "bash", "help", "html", "javascript", "json", "lua", "markdown", "markdown_inline", "python", "query", "regex", "tsx", "typescript", "vim", "yaml", }, }, }, -- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above -- would overwrite `ensure_installed` with the new value. -- If you'd rather extend the default config, use the code below instead: { "nvim-treesitter/nvim-treesitter", opts = function(_, opts) vim.list_extend(opts.ensure_installed, { -- add tsx and treesitter ensure_installed = { "tsx", "typescript", }, }) end, }, -- the opts function can also be used to change the default opts: { "nvim-lualine/lualine.nvim", event = "VeryLazy", opts = function(_, opts) table.insert(opts.sections.lualine_x, "") end, }, -- or you can return new options to override all the defaults { "nvim-lualine/lualine.nvim", event = "VeryLazy", opts = function() return { --[[add your custom lualine config here]] } end, }, -- use mini.starter instead of alpha { import = "lazyvim.plugins.extras.ui.mini-starter" }, -- add jsonls and schemastore ans setup treesitter for json, json5 and jsonc { import = "lazyvim.plugins.extras.lang.json" }, -- add any tools you want to have installed below { "williamboman/mason.nvim", opts = { ensure_installed = { "stylua", "shellcheck", "shfmt", "flake8", }, }, }, -- Use for completion and snippets (supertab) -- first: disable default and behavior in LuaSnip { "L3MON4D3/LuaSnip", keys = function() return {} end, }, -- then: setup supertab in cmp { "hrsh7th/nvim-cmp", dependencies = { "hrsh7th/cmp-emoji", }, ---@param opts cmp.ConfigSchema opts = function(_, opts) local has_words_before = function() unpack = unpack or table.unpack local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end local luasnip = require("luasnip") local cmp = require("cmp") opts.mapping = vim.tbl_extend("force", opts.mapping, { [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() -- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable() -- they way you will only jump inside the snippet region elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() elseif has_words_before() then cmp.complete() else fallback() end end, { "i", "s" }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, { "i", "s" }), }) end, }, } < KEYMAPS *LazyVim-keymaps* **LazyVim** uses which-key.nvim to help you remember your keymaps. Just press any key like `` and you’ll see a popup with all possible keymaps starting with ``.

image

General │ Key │ Description │ Mode │ │ │Go to left window │**n** │ │ │Go to lower window │**n** │ │ │Go to upper window │**n** │ │ │Go to right window │**n** │ │ │Increase window height │**n** │ │ │Decrease window height │**n** │ │ │Decrease window width │**n** │ │ │Increase window width │**n** │ │ │Move down │**n**, **v**, **i** │ │ │Move up │**n**, **v**, **i** │ │bb │Switch to Other Buffer │**n** │ │ │Switch to Other Buffer │**n** │ │ │Escape and clear hlsearch │**i**, **n** │ │ur │Redraw / clear hlsearch / diff update│**n** │ │n │Next search result │**n**, **x**, **o** │ │N │Prev search result │**n**, **x**, **o** │ │ │Save file │**i**, **v**, **n**, **s**│ │l │Lazy │**n** │ │fn │New File │**n** │ │xl │Open Location List │**n** │ │xq │Open Quickfix List │**n** │ │uf │Toggle format on Save │**n** │ │us │Toggle Spelling │**n** │ │uw │Toggle Word Wrap │**n** │ │ul │Toggle Line Numbers │**n** │ │ud │Toggle Diagnostics │**n** │ │uc │Toggle Conceal │**n** │ │gg │Lazygit (cwd) │**n** │ │gG │Lazygit (root dir) │**n** │ │qq │Quit all │**n** │ │ui │Inspect Pos │**n** │ │ft │Terminal (root dir) │**n** │ │fT │Terminal (cwd) │**n** │ │ │Enter Normal Mode │**t** │ │ww │Other window │**n** │ │wd │Delete window │**n** │ │w- │Split window below │**n** │ │w\| │Split window right │**n** │ │- │Split window below │**n** │ │\| │Split window right │**n** │ │l │Last │**n** │ │f │First │**n** │ │ │New Tab │**n** │ │] │Next │**n** │ │d │Close │**n** │ │[ │Previous │**n** │ LSP │ Key │ Description │ Mode │ │cd │Line Diagnostics │**n** │ │cl │Lsp Info │**n** │ │gd │Goto Definition │**n** │ │gr │References │**n** │ │gD │Goto Declaration │**n** │ │gI │Goto Implementation │**n** │ │gt │Goto Type Definition│**n** │ │K │Hover │**n** │ │gK │Signature Help │**n** │ │ │Signature Help │**i** │ │]d │Next Diagnostic │**n** │ │[d │Prev Diagnostic │**n** │ │]e │Next Error │**n** │ │[e │Prev Error │**n** │ │]w │Next Warning │**n** │ │[w │Prev Warning │**n** │ │ca │Code Action │**n**, **v**│ │cf │Format Document │**n** │ │cf │Format Range │**v** │ │cr │Rename │**n** │ Plugins │ Key │ Description │ Mode │ │cm │mason.nvim Mason │**n** │ │bd │mini.bufremove Delete Buffer │**n** │ │bD │mini.bufremove Delete Buffer (Force) │**n** │ │gza │mini.surround Add surrounding │**n**, **v**│ │gzd │mini.surround Delete surrounding │**n** │ │gzf │mini.surround Find right surrounding │**n** │ │gzF │mini.surround Find left surrounding │**n** │ │gzh │mini.surround Highlight surrounding │**n** │ │gzr │mini.surround Replace surrounding │**n** │ │gzn │mini.surround Update MiniSurround.config.n_lines │**n** │ │fe │neo-tree.nvim Explorer NeoTree (root dir) │**n** │ │fE │neo-tree.nvim Explorer NeoTree (cwd) │**n** │ │e │neo-tree.nvim Explorer NeoTree (root dir) │**n** │ │E │neo-tree.nvim Explorer NeoTree (cwd) │**n** │ │ │noice.nvim Redirect Cmdline │**c** │ │snl │noice.nvim Noice Last Message │**n** │ │snh │noice.nvim Noice History │**n** │ │sna │noice.nvim Noice All │**n** │ │ │noice.nvim Scroll forward │**n** │ │ │noice.nvim Scroll backward │**n** │ │un │nvim-notify Delete all Notifications │**n** │ │sr │nvim-spectre Replace in files (Spectre) │**n** │ │ │nvim-treesitter Increment selection │**n** │ │ │nvim-treesitter Schrink selection │**x** │ │qs │persistence.nvim Restore Session │**n** │ │ql │persistence.nvim Restore Last Session │**n** │ │qd │persistence.nvim Don’t Save Current Session │**n** │ │, │telescope.nvim Switch Buffer │**n** │ │/ │telescope.nvim Find in Files (Grep) │**n** │ │: │telescope.nvim Command History │**n** │ │ │telescope.nvim Find Files (root dir) │**n** │ │fb │telescope.nvim Buffers │**n** │ │ff │telescope.nvim Find Files (root dir) │**n** │ │fF │telescope.nvim Find Files (cwd) │**n** │ │fr │telescope.nvim Recent │**n** │ │gc │telescope.nvim commits │**n** │ │gs │telescope.nvim status │**n** │ │sa │telescope.nvim Auto Commands │**n** │ │sb │telescope.nvim Buffer │**n** │ │sc │telescope.nvim Command History │**n** │ │sC │telescope.nvim Commands │**n** │ │sd │telescope.nvim Diagnostics │**n** │ │sg │telescope.nvim Grep (root dir) │**n** │ │sG │telescope.nvim Grep (cwd) │**n** │ │sh │telescope.nvim Help Pages │**n** │ │sH │telescope.nvim Search Highlight Groups │**n** │ │sk │telescope.nvim Key Maps │**n** │ │sM │telescope.nvim Man Pages │**n** │ │sm │telescope.nvim Jump to Mark │**n** │ │so │telescope.nvim Options │**n** │ │sw │telescope.nvim Word (root dir) │**n** │ │sW │telescope.nvim Word (cwd) │**n** │ │uC │telescope.nvim Colorscheme with preview │**n** │ │ss │telescope.nvim Goto Symbol │**n** │ │]t │todo-comments.nvim Next todo comment │**n** │ │[t │todo-comments.nvim Previous todo comment │**n** │ │xt │todo-comments.nvim Todo (Trouble) │**n** │ │xT │todo-comments.nvim Todo/Fix/Fixme (Trouble) │**n** │ │st │todo-comments.nvim Todo │**n** │ │xx │trouble.nvim Document Diagnostics (Trouble) │**n** │ │xX │trouble.nvim Workspace Diagnostics (Trouble) │**n** │ │]] │vim-illuminate Next Reference │**n** │ │[[ │vim-illuminate Prev Reference │**n** │ PLUGINS *LazyVim-plugins* Core - alpha-nvim - catppuccin - cmp-buffer - cmp-nvim-lsp - cmp-path - cmp_luasnip - dressing.nvim - flit.nvim - friendly-snippets - gitsigns.nvim - indent-blankline.nvim - lazy.nvim - LazyVim - leap.nvim - lualine.nvim - LuaSnip - mason-lspconfig.nvim - mason.nvim - mini.ai - mini.bufremove - mini.comment - mini.indentscope - mini.pairs - mini.surround - neo-tree.nvim - neoconf.nvim - neodev.nvim - noice.nvim - nui.nvim - null-ls.nvim - nvim-bufferline.lua - nvim-cmp - nvim-lspconfig - nvim-navic - nvim-notify - nvim-spectre - nvim-treesitter - nvim-treesitter-textobjects - nvim-ts-context-commentstring - nvim-web-devicons - persistence.nvim - plenary.nvim - telescope.nvim - todo-comments.nvim - tokyonight.nvim - trouble.nvim - vim-illuminate - vim-repeat - vim-startuptime - which-key.nvim Extras: lang.json To use this, add it to your **lazy.nvim** imports: >lua require("lazy").setup({ spec = { { "folke/LazyVim", import = "lazyvim.plugins" }, { import = "lazyvim.plugins.extras.lang.json" }, { import = "plugins" }, }, }) < - nvim-lspconfig - nvim-treesitter - SchemaStore.nvim Extras: lang.typescript To use this, add it to your **lazy.nvim** imports: >lua require("lazy").setup({ spec = { { "folke/LazyVim", import = "lazyvim.plugins" }, { import = "lazyvim.plugins.extras.lang.typescript" }, { import = "plugins" }, }, }) < - nvim-lspconfig - nvim-treesitter - typescript.nvim Extras: ui.mini-starter To use this, add it to your **lazy.nvim** imports: >lua require("lazy").setup({ spec = { { "folke/LazyVim", import = "lazyvim.plugins" }, { import = "lazyvim.plugins.extras.ui.mini-starter" }, { import = "plugins" }, }, }) < - mini.starter Generated by panvimdoc vim:tw=78:ts=8:noet:ft=help:norl: