# LazyVim LazyVim is a Neovim setup powered by [๐Ÿ’ค lazy.nvim](https://github.com/folke/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](https://user-images.githubusercontent.com/292349/211285846-0b7bb3bf-0462-4029-b64c-4ee1d037fc1c.png) ## โœจ Features - ๐Ÿ”ฅ Transform your Neovim into a full-fledged IDE - ๐Ÿ’ค Easily customize and extend your config with [lazy.nvim](https://github.com/folke/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 - Neovim >= **0.8.0** (needs to be built with **LuaJIT**) - Git >= **2.19.0** (for partial clones support) - a [Nerd Font](https://www.nerdfonts.com/) **_(optional)_** ## ๐Ÿš€ Getting Started You can find a starter template for **LazyVim** [here](https://github.com/LazyVim/starter) **TLDR:** ```lua require("lazy").setup({ spec = { -- import LazyVim plugins { "LazyVim/LazyVim", import = "lazyvim.plugins" }, -- import/override with your plugins { import = "plugins" }, -- import any extras modules here -- { import = "lazyvim.plugins.extras.lang.typescript" }, -- { import = "lazyvim.plugins.extras.lang.json" }, }, defaults = { lazy = true, -- every plugin is lazy-loaded by default version = "*", -- try installing the latest stable version for plugins that support semver }, }) ``` ## ๐Ÿ“‚ 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](https://github.com/LazyVim/LazyVim/tree/main/lua/lazyvim/config) You can add your custom plugin specs under `lua/plugins/`. All files there will be automatically loaded by [lazy.nvim](https://github.com/folke/lazy.nvim)
~/.config/nvim
โ”œโ”€โ”€ lua
โ”‚ย ย  โ”œโ”€โ”€ config
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ autocmds.lua
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ keymaps.lua
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ lazy.lua
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ options.lua
โ”‚ย ย  โ””โ”€โ”€ plugins
โ”‚ย ย      โ”œโ”€โ”€ spec1.lua
โ”‚ย ย      โ”œโ”€โ”€ **
โ”‚ย ย      โ””โ”€โ”€ spec2.lua
โ””โ”€โ”€ init.toml
## ๐Ÿš€ Configuring **LazyVim** 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](https://github.com/folke/lazy.nvim).
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 { -- 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 add telescope-fzf-native { "nvim-telescope/telescope.nvim", dependencies = { { "nvim-telescope/telescope-fzf-native.nvim", build = "make" } }, 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, }, }, -- 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 and setup tsserver with typescript.nvim { "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 = { -- pyright will be automatically installed with mason and loaded with lspconfig pyright = {}, 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 ne 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", }, }, }, } ```
## โŒจ๏ธ Keymaps **LazyVim** uses [which-key.nvim](https://github.com/folke/which-key) to help you remember your keymaps. Just press any key like `` and you'll see a popup with all possible keymaps starting with ``. ![image](https://user-images.githubusercontent.com/292349/211259984-a7522199-81a2-44f7-be6c-af21ba153f0a.png)
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** | | `` | Prev buffer | **n** | | `` | Next buffer | **n** | | `[p` | Paste below | **n** | | `]p` | Paste above | **n** | | `` | Escape and clear hlsearch | **i**, **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** | | `tf` | Toggle format on Save | **n** | | `ts` | Toggle Spelling | **n** | | `tw` | Toggle Word Wrap | **n** | | `tn` | Toggle Line Numbers | **n** | | `td` | Toggle Diagnostics | **n** | | `tc` | Toggle Conceal | **n** | | `gg` | Lazygit (cwd) | **n** | | `gG` | Lazygit (root dir) | **n** | | `qq` | Quit all | **n** | | `hl` | Highlight Groups at cursor | **n** | | `ot` | Terminal (root dir) | **n** | | `oT` | 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** | | `l` | Last | **n** | | `f` | First | **n** | | `` | New Tab | **n** | | `]` | Next | **n** | | `d` | Close | **n** | | `[` | Previous | **n** | | `b]` | Next Buffer | **n** | | `bb` | Switch to Other Buffer | **n** | | `b[` | Previous Buffer | **n** | | `` ` `` | Switch to Other Buffer | **n** |
LSP | Key | Description | Mode | | ------------ | --------------------- | ------------ | | `cd` | Line Diagnostics | **n** | | `cl` | Lsp Info | **n** | | `xd` | Telescope Diagnostics | **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** | | `[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](https://github.com/williamboman/mason.nvim.git) Mason | **n** | | `bd` | [mini.bufremove](https://github.com/echasnovski/mini.bufremove.git) Delete Buffer | **n** | | `bD` | [mini.bufremove](https://github.com/echasnovski/mini.bufremove.git) Delete Buffer (Force) | **n** | | `ft` | [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim.git) NeoTree (root dir) | **n** | | `fT` | [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim.git) NeoTree (cwd) | **n** | | `` | [noice.nvim](https://github.com/folke/noice.nvim.git) Redirect Cmdline | **c** | | `nl` | [noice.nvim](https://github.com/folke/noice.nvim.git) Noice Last Message | **n** | | `nh` | [noice.nvim](https://github.com/folke/noice.nvim.git) Noice History | **n** | | `na` | [noice.nvim](https://github.com/folke/noice.nvim.git) Noice All | **n** | | `` | [noice.nvim](https://github.com/folke/noice.nvim.git) Scroll forward | **n** | | `` | [noice.nvim](https://github.com/folke/noice.nvim.git) Scroll backward | **n** | | `nd` | [nvim-notify](https://github.com/rcarriga/nvim-notify.git) Delete all Notifications | **n** | | `sr` | [nvim-spectre](https://github.com/windwp/nvim-spectre.git) Replace in files (Spectre) | **n** | | `qs` | [persistence.nvim](https://github.com/folke/persistence.nvim.git) Restore Session | **n** | | `ql` | [persistence.nvim](https://github.com/folke/persistence.nvim.git) Restore Last Session | **n** | | `qd` | [persistence.nvim](https://github.com/folke/persistence.nvim.git) Don't Save Current Session | **n** | | `/` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Find in Files (Grep) | **n** | | `` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Find Files (root dir) | **n** | | `fb` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Buffers | **n** | | `ff` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Find Files (root dir) | **n** | | `fF` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Find Files (cwd) | **n** | | `fr` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Recent | **n** | | `gc` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) commits | **n** | | `gs` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) status | **n** | | `ha` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Auto Commands | **n** | | `hc` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Commands | **n** | | `hf` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) File Types | **n** | | `hh` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Help Pages | **n** | | `hk` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Key Maps | **n** | | `hm` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Man Pages | **n** | | `ho` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Options | **n** | | `hs` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Search Highlight Groups | **n** | | `ht` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Telescope | **n** | | `sb` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Buffer | **n** | | `sc` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Command History | **n** | | `sg` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Grep (root dir) | **n** | | `sG` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Grep (cwd) | **n** | | `sm` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Jump to Mark | **n** | | `,` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Switch Buffer | **n** | | `:` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Command History | **n** | | `ss` | [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim.git) Goto Symbol | **n** | | `]t` | [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) Next todo comment | **n** | | `[t` | [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) Previous todo comment | **n** | | `xt` | [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) Todo Trouble | **n** | | `xtt` | [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) Todo Trouble | **n** | | `xT` | [todo-comments.nvim](https://github.com/folke/todo-comments.nvim.git) Todo Telescope | **n** | | `xx` | [trouble.nvim](https://github.com/folke/trouble.nvim.git) Document Diagnostics (Trouble) | **n** | | `xX` | [trouble.nvim](https://github.com/folke/trouble.nvim.git) Workspace Diagnostics (Trouble) | **n** | | `]]` | [vim-illuminate](https://github.com/RRethy/vim-illuminate.git) Next Reference | **n** | | `[[` | [vim-illuminate](https://github.com/RRethy/vim-illuminate.git) Prev Reference | **n** |
## ๐Ÿ“ฆ Plugins
Core - [alpha-nvim](https://github.com/goolord/alpha-nvim) - [catppuccin](https://github.com/catppuccin/nvim) - [cmp-buffer](https://github.com/hrsh7th/cmp-buffer) - [cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp) - [cmp-path](https://github.com/hrsh7th/cmp-path) - [cmp_luasnip](https://github.com/saadparwaiz1/cmp_luasnip) - [dressing.nvim](https://github.com/stevearc/dressing.nvim) - [flit.nvim](https://github.com/ggandor/flit.nvim) - [friendly-snippets](https://github.com/rafamadriz/friendly-snippets) - [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim) - [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) - [lazy.nvim](https://github.com/folke/lazy.nvim) - [leap.nvim](https://github.com/ggandor/leap.nvim) - [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) - [LuaSnip](https://github.com/L3MON4D3/LuaSnip) - [mason-lspconfig.nvim](https://github.com/williamboman/mason-lspconfig.nvim) - [mason.nvim](https://github.com/williamboman/mason.nvim) - [mini.ai](https://github.com/echasnovski/mini.ai) - [mini.bufremove](https://github.com/echasnovski/mini.bufremove) - [mini.comment](https://github.com/echasnovski/mini.comment) - [mini.indentscope](https://github.com/echasnovski/mini.indentscope) - [mini.pairs](https://github.com/echasnovski/mini.pairs) - [mini.surround](https://github.com/echasnovski/mini.surround) - [neo-tree.nvim](https://github.com/nvim-neo-tree/neo-tree.nvim) - [neoconf.nvim](https://github.com/folke/neoconf.nvim) - [neodev.nvim](https://github.com/folke/neodev.nvim) - [noice.nvim](https://github.com/folke/noice.nvim) - [nui.nvim](https://github.com/MunifTanjim/nui.nvim) - [null-ls.nvim](https://github.com/jose-elias-alvarez/null-ls.nvim) - [nvim-bufferline.lua](https://github.com/akinsho/nvim-bufferline.lua) - [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) - [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) - [nvim-navic](https://github.com/SmiteshP/nvim-navic) - [nvim-notify](https://github.com/rcarriga/nvim-notify) - [nvim-spectre](https://github.com/windwp/nvim-spectre) - [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) - [nvim-treesitter-textobjects](https://github.com/nvim-treesitter/nvim-treesitter-textobjects) - [nvim-ts-context-commentstring](https://github.com/JoosepAlviste/nvim-ts-context-commentstring) - [nvim-web-devicons](https://github.com/nvim-tree/nvim-web-devicons) - [persistence.nvim](https://github.com/folke/persistence.nvim) - [plenary.nvim](https://github.com/nvim-lua/plenary.nvim) - [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) - [todo-comments.nvim](https://github.com/folke/todo-comments.nvim) - [tokyonight.nvim](https://github.com/folke/tokyonight.nvim) - [trouble.nvim](https://github.com/folke/trouble.nvim) - [vim-illuminate](https://github.com/RRethy/vim-illuminate) - [vim-startuptime](https://github.com/dstein64/vim-startuptime) - [which-key.nvim](https://github.com/folke/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](https://github.com/neovim/nvim-lspconfig) - [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) - [schemastore.nvim](https://github.com/b0o/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](https://github.com/neovim/nvim-lspconfig) - [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) - [typescript.nvim](https://github.com/jose-elias-alvarez/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](https://github.com/echasnovski/mini.starter)