Skip to content
Alberto Lazari edited this page Jul 20, 2023 · 84 revisions

vim-textobj-user is a library plugin for Vim to define your own text objects without handling many edge cases and complex stuffs.

To avoid reinventing wheels, please add links to plugins to the following tables when you write your own text objects or find text objects written by somebody:

General purpose text objects

Plugin name Author Summary
vim-textobj-backticks fvictorio a` /i` for a region between backticks, and ii` for excluding inner whitespace
vim-textobj-between thinca af{char}/if{char} for a region between {char}s
vim-textobj-blanklines deathlyfrantic a<Space>/i<Space> for groups of blank (only whitespace) lines
vim-textobj-brace Julian aj/ij for the closest region between any of () [] or {}.
vim-textobj-chainmember D4KU am/im for elements in chained method calls and member accesses
vim-textobj-chunk Chun-Yang ac/ic for all the lines contain one of {}, [], or () pairs
vim-textobj-comment glts ac/ic for a comment
vim-textobj-continuous-line rhysd av/iv for lines continued by \ in C++, sh, and others
vim-textobj-datetime kana ada/ida and others for date and time such as 2013-03-13, 19:51:45, 2013-03-13T19:51:50, and more
vim-textobj-diff kana adh/idh and others for various elements in diff(1) output
vim-textobj-entire kana ae/ie for the entire region of the current buffer
vim-textobj-erb whatyouhide aE/iE for erb tags
vim-textobj-fold kana az/iz for a block of folded lines
vim-textobj-fold somini az/iz for a block of folded lines; iz does not include fold marker lines
vim-textobj-function kana af/if and aF/iF for a function / extensible for any language
vim-textobj-gitgutter gilligan ih for a changed hunk marked by vim-gitgutter
vim-textobj-heredocs rsrchboy aH/iH for heredocs
vim-textobj-indblock glts ao/io for a block of indentation (i.e. spaces)
vim-textobj-indent kana ai/ii for a block of similarly indented lines / aI/iI for a block of lines with the same indentation
vim-textobj-indented-paragraph pianohacker ar/ir for a paragraph with the same indentation / g)/g( for moving between paragraphs at the same indentation
vim-textobj-jabraces kana aj{X}/ij{X} for a block surrounded by various Japanese braces such as 「foo」 and 【bar】
vim-textobj-keyvalue vimtaku ak/iv for key / value
vim-textobj-lastpat kana a//i/ for a region matched to the last search pattern
vim-textobj-line kana al/il for the current line
vim-textobj-matchit adriaanzon am/im for matchit.vim pairs
vim-textobj-parameter sgur a,/i, for an argument to a function
vim-textobj-pastedtext saaguero gb for last pasted text
vim-textobj-path paulhybryant ap/ip for next file path (w/o basename), aP/iP for the previous file path (w/o basename)
vim-textobj-punctuation beloglazov au/iu for the text between the cursor position and the closest punctuation in front
vim-textobj-quote preservim aq/iq aQ/iQ for “typographic-quoted” strings
vim-textobj-quotes beloglazov aq/iq for the closest pairs of quotes of any type
vim-textobj-sentence-line ctholho as/is for sentences delimited by newlines, like for fountain syntax
vim-textobj-sentence preservim as/is for a sentence of prose (overrides hard-coded native object & motion)
vim-textobj-signify-hunk killphi ih for a changed hunk marked by vim-signify (fork from vim-textobj-gitgutter)
vim-textobj-space saihoooooooo aS/iS for a region filled with various space characters
vim-textobj-syntax kana ay/iy for a syntax-highlighted item
vim-textobj-toplevel adolenc aT/iT for "top level" blocks of code in arbitrary programming language
vim-textobj-underscore lucapette a_/i_ for a region between _s such as bar in foo_bar_baz
vim-textobj-uri jceb au/iu for a URI, also includes URI handlers and is easy to extend
vim-textobj-url mattn au/iu for a URL
vim-textobj-variable-segment Julian av/iv for a region between either _s or camelCaseVariables
vim-textobj-word-column idbrii ac/ic/aC/iC for columns of text defined by word or WORD
vim-textobj-xmlattr whatyouhide ax/ix for XML/HTML attributes
vim-textobj-curly telemachus ic/ac/iC/aC and movements for text inside of “curly quotes” and ‘curly quotes’
vim-textobj-restful-request xbot ir/ar for restful requests written in rest.nvim format and key mappings for navigation to the previous or next request.

For specific languages

Plugin name Author Summary
vim-textobj-blade-directive adriaanzon For Laravel Blade: ad / id for directives
vim-textobj-clang libclang-vim For C and C++ blocks, etc.: i;f / a;c
vim-textobj-css jasonlong For CSS, Sass, Less, etc.: ic / ac
vim-textobj-elixir amiralies For elixir blocks (both do end and fn end)
vim-textobj-elixir andyl ae / ie for Elixir blocks
vim-textobj-haskell gilligan For Haskell: ih for a function
vim-textobj-headedblock D4KU For C-like blocks with lines immediately above (if, while, function, class, ...)
vim-textobj-help kana For Vim :help documents
vim-textobj-latex rbonvall For LaTeX: a$/i$ for an $equation$, and more
vim-textobj-lua spacewander For Lua: a/i for function, al/il for a block, and ac/ic for a condition
vim-textobj-markdown coachshea text objects and movements for markdown and rmarkdown files
vim-textobj-php akiyan For PHP: aP/iP for a range between the PHP delimiters such as <?php and ?>
vim-textobj-python bps For Python: af/if for a function, ac/ic for a class
vim-textobj-ruby tek For Ruby: a/i function, class, and r for a block. an for a Scoped::Name.
vim-textobj-rubyblock nelstrom For Ruby: ar/ir for a block
vim-textobj-sigil vimtaku For Perl: ig for a variable such as $foo / ag for a more complex expression
vim-textobj-typst albertolazari For Typst m/M for inline/block math, list items, * for strong and _ for emph
Clone this wiki locally