skip to content
Ivan's wiki
Site Tools
Search
Tools
Show pagesource
Backlinks
Recent Changes
Media Manager
Sitemap
>
Recent Changes
Media Manager
Sitemap
neovim-configuration
This page is read only. You can view the source, but not change it.
# Neovim configuration **Neovim configuration** lives in `~/.config/nvim/init.lua` (Lua) or `init.vim` (Vimscript). Modern Neovim defaults to Lua, which is more powerful and readable than Vimscript. ## Setup directory structure ``` ~/.config/nvim/ ├── init.lua # main config file ├── lua/ │ └── user/ │ ├── settings.lua # options │ └── keymaps.lua # keybindings └── after/ └── ftplugin/ └── python.lua # file-type specific ``` Start simple with just `init.lua`. ## Basic options Set options with `vim.opt`: ```lua -- ~/.config/nvim/init.lua vim.opt.number = true -- show line numbers vim.opt.relativenumber = true -- relative numbers vim.opt.expandtab = true -- spaces, not tabs vim.opt.shiftwidth = 4 -- indent size vim.opt.tabstop = 4 -- tab display width vim.opt.ignorecase = true -- case-insensitive search vim.opt.smartcase = true -- case-sensitive if uppercase in search vim.opt.wrap = false -- no line wrap vim.opt.termguicolors = true -- true color support ``` Each option corresponds to a `:set` command (`:set number` is the ex equivalent of `vim.opt.number = true`). ## Colorscheme ```lua -- Set colorscheme (requires plugin or built-in) vim.cmd.colorscheme "slate" ``` Popular colorschemes: `slate`, `desert`, `torte` (built-in). Plugins like `tokyonight`, `gruvbox` add more. Install via plugin manager (see [Neovim plugins](/neovim-plugins)). ## Keybindings Basic keymapping: ```lua vim.keymap.set('n', '<Space>w', ':w<CR>') -- save with Space+w vim.keymap.set('n', '<C-s>', ':w<CR>') -- save with Ctrl+s vim.keymap.set('i', 'jk', '<Esc>') -- exit insert with jk ``` Modes: `'n'` (normal), `'i'` (insert), `'v'` (visual), `'c'` (command), `'o'` (operator pending). Options: ```lua vim.keymap.set('n', '<leader>x', ':e<CR>', { noremap = true, silent = true }) ``` - `noremap`: prevent recursion (map to built-in, not other maps) - `silent`: no message in status bar - `buffer`: local to current buffer only ## Leader key Leader is a custom prefix for personal keybindings (default `\`). Remap to space (common): ```lua vim.g.mapleader = ' ' vim.g.maplocalleader = ',' ``` Then `<leader>e` expands to `<Space>e`. ## Comments Lua comments use `--`: ```lua -- This is a comment ``` VimScript uses `"`: ```vim " This is a comment ``` ## Reload configuration After editing `init.lua`, reload with `:source ~/.config/nvim/init.lua` or restart Neovim. For development, split config into files (`settings.lua`, `keymaps.lua`) and require them: ```lua require('user.settings') require('user.keymaps') ``` This keeps `init.lua` clean and modular.
Page Tools
Show pagesource
Backlinks
Back to top