mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-02-07 09:18:59 +00:00
1 line
6.0 KiB
JSON
1 line
6.0 KiB
JSON
{"pageProps":{"metadata":{"date":"2022-04-01 16:06:02 +08:00","date_modified":"2022-05-22 22:46:31 +08:00","language":"en","source":""},"title":"Neovim text objects","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"(Neo)Vim has a bunch of text objects that are beyond simple boundaries other than a word ("},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"aw"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"aW"}]},{"type":"text","value":").\nYou can find more of them with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"text-objects"}]},{"type":"text","value":" section from "},{"type":"element","tagName":"a","properties":{"href":"/editor.neovim.help-system"},"children":[{"type":"text","value":"Neovim help system"}]},{"type":"text","value":".\n"}]},{"type":"element","tagName":"table","properties":{},"children":[{"type":"element","tagName":"thead","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Text object"}]},{"type":"element","tagName":"th","properties":{},"children":[{"type":"text","value":"Description"}]}]}]},{"type":"element","tagName":"tbody","properties":{},"children":[{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"ap"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"A paragraph, equivalent to "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"}"}]},{"type":"text","value":"."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"as"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"A sentence, equivalent to "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":"."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"ab"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"A '( )' block."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"aB"}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"A '{ }' block."}]}]},{"type":"element","tagName":"tr","properties":{},"children":[{"type":"element","tagName":"td","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"a\""}]}]},{"type":"element","tagName":"td","properties":{},"children":[{"type":"text","value":"Content inside double-quotes ("},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"\""}]},{"type":"text","value":")."}]}]}]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"There is also a variation for selecting only the inner content of the previous text objects (e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"ip"}]},{"type":"text","value":" for the inner paragraph, "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"is"}]},{"type":"text","value":" for inner sentence) with the whitespace removed.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Note that selecting with text objects is different from selecting with "},{"type":"element","tagName":"a","properties":{"href":"roam:Neovim motions"},"children":[{"type":"text","value":"roam:Neovim motions"}]},{"type":"text","value":" where it refers to the current position up to the end of the next selection.\nMeanwhile, text objects selection will select to the referred object as a whole no matter where the cursor position.\nFor example, selecting with the paragraph (i.e., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"vap"}]},{"type":"text","value":") will select the whole paragraph where the cursor rests.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Aside from the built-in text objects, you can create your own.\nWhich also means others have created some custom text objects.\n"}]},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"element","tagName":"li","properties":{},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://github.com/nvim-treesitter/nvim-treesitter-textobjects"},"children":[{"type":"text","value":"nvim-treesitter-textobjects"}]},{"type":"text","value":" add text objects support for selecting (and swapping, moving, and peeking) tree-sitter nodes.\n (Assuming you have tree-sitter support enabled for Neovim.)\n"}]}]}]}]},"backlinks":[]},"__N_SSG":true} |