▩ Text Objects Operator + Object
Text objects let you operate on semantic units: words, sentences, blocks, and delimiters. Used as the motion part of an operator.
Inner (i) vs Around (a)
i = content only | a = content + surrounding delimiters/whitespace
| iw / aw | Word |
| is / as | Sentence |
| ip / ap | Paragraph |
| i" / a" | Double-quoted string |
| i' / a' | Single-quoted string |
| i` / a` | Backtick string |
| i( / a( | Parentheses |
| i[ / a[ | Brackets |
| i{ / a{ | Braces |
| it / at | HTML/XML tag |
Examples:
ci" — change content inside quotes
da{ — delete block including braces
yip — yank current paragraph
vat — visually select around HTML tag
2i( — operate on 2nd level parens
Neovim Treesitter Text Objects plugin
With nvim-treesitter-textobjects, you get syntax-aware objects:
| if | Inner function body |
| af | Around function (with signature) |
| ic | Inner class |
| ia | Inner argument/parameter |
🌐 Lua Configuration neovim native
Neovim uses Lua as its primary configuration language (as of 0.5+). Your config lives at:
~/.config/nvim/init.lua
Or as a structured module:
~/.config/nvim/lua/
Setting Options
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.updatetime = 50
Keymaps
local map = vim.keymap.set
vim.g.mapleader = " "
map("n", "<leader>pf", vim.cmd.Ex)
map("v", "J", ":m '>+1<CR>gv=gv")
map("v", "K", ":m '<-2<CR>gv=gv")
map("n", "<C-d>", "<C-d>zz")
map("n", "<C-u>", "<C-u>zz")
Useful vim.api and vim.fn calls
vim.api.nvim_create_autocmd | Create autocommand |
vim.api.nvim_create_user_command | Create user command |
vim.api.nvim_buf_get_lines | Get buffer lines |
vim.fn.expand('%') | Current file name |
vim.fn.getcwd() | Working directory |
vim.notify("msg") | Show notification |
🔌 Plugin System ecosystem
The most popular plugin manager is lazy.nvim. Plugins are declared as Lua tables with lazy loading support.
lazy.nvim bootstrap + example
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({ "git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{ "nvim-telescope/telescope.nvim", tag = "0.1.x",
dependencies = { "nvim-lua/plenary.nvim" } },
{ "nvim-treesitter/nvim-treesitter",
build = ":TSUpdate" },
{ "neovim/nvim-lspconfig" },
{ "hrsh7th/nvim-cmp" },
})
Essential plugins: telescope.nvim · nvim-treesitter · nvim-lspconfig · mason.nvim · nvim-cmp · null-ls / none-ls · gitsigns.nvim · which-key.nvim · lualine.nvim · oil.nvim / nvim-tree
🌳 Treesitter neovim native (0.9+)
Treesitter provides accurate, incremental syntax parsing, enabling better highlighting, indentation, and navigation than regex-based syntax files.
Commands
| :TSInstall {lang} | Install parser for language |
| :TSInstallInfo | Show install status |
| :TSUpdate | Update all parsers |
| :TSBufToggle highlight | Toggle TS highlight |
| :InspectTree | Show syntax tree (Nvim 0.9+) |
Config
require('nvim-treesitter.configs').setup({
ensure_installed = {
"lua", "python", "typescript",
"rust", "go", "html", "css"
},
highlight = { enable = true },
indent = { enable = true },
})
🔭 Telescope plugin
Fuzzy-finder framework for finding anything — files, grep, LSP symbols, git commits, and more.
Common Pickers
| :Telescope find_files | Fuzzy file finder |
| :Telescope live_grep | Search file contents |
| :Telescope buffers | Open buffers |
| :Telescope oldfiles | Recent files |
| :Telescope git_commits | Git commit log |
| :Telescope lsp_references | LSP references |
| :Telescope keymaps | Browse all keymaps |
| :Telescope help_tags | Search help docs |
Telescope Keymaps (in picker)
| Ctrl+n / p | Next/prev result |
| Ctrl+x | Open in horizontal split |
| Ctrl+v | Open in vertical split |
| Ctrl+t | Open in new tab |
| Ctrl+q | Send all to quickfix |
| ? | Show all mappings |
◯ Autocommands Lua API
Autocommands run Lua (or Vimscript) in response to editor events.
Examples
local augroup = vim.api.nvim_create_augroup("MyGroup", {})
vim.api.nvim_create_autocmd("TextYankPost", {
group = augroup,
callback = function()
vim.highlight.on_yank()
end,
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
pattern = "*",
command = [[%s/\s\+$//e]],
})
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
callback = function() vim.lsp.buf.format() end,
})