{"id":13596237,"url":"https://github.com/paradigm/TextObjectify","last_synced_at":"2025-04-09T16:31:55.822Z","repository":{"id":7889895,"uuid":"9267328","full_name":"paradigm/TextObjectify","owner":"paradigm","description":"TextObjectify is a Vim plugin which improves text-objects","archived":false,"fork":false,"pushed_at":"2013-11-13T19:13:05.000Z","size":155,"stargazers_count":100,"open_issues_count":8,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-06T19:42:21.282Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"VimL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paradigm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-06T22:02:39.000Z","updated_at":"2024-01-21T00:30:36.000Z","dependencies_parsed_at":"2022-09-10T23:50:54.434Z","dependency_job_id":null,"html_url":"https://github.com/paradigm/TextObjectify","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigm%2FTextObjectify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigm%2FTextObjectify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigm%2FTextObjectify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigm%2FTextObjectify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paradigm","download_url":"https://codeload.github.com/paradigm/TextObjectify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248067810,"owners_count":21042361,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T16:02:12.941Z","updated_at":"2025-04-09T16:31:52.297Z","avatar_url":"https://github.com/paradigm.png","language":"VimL","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"readme":"TextObjectify\n=============\n\nDescription\n-----------\n\nVim's text-objects are an extremely powerful tool.  However, there are some\npeculiar lackings in how they operate out-of-the-box.  The TextObjectify plugin\nattempts to rectify these peculiarities as well as add the ability to allow the\nuser to create custom text-objects or even create text-objects on-the-fly\nif a object is provided that does not already exist.\n\nThe peculiarities that TextObjectify attempts to resolve have to do with the\nmutually-exclusive functionality of the parenthesis-like text-objects and the\nquote-like text-objects.  The parenthesis-like text-objects are all able to\noperate on objects that cover multiple lines; however, the cursor must be\non/within the object for it to work.  The quote-like text-objects only work\non a single line.  However, with the quote-like text-objects, the cursor will\nseek ahead and jump to a text object if the cursor is not already within one.\n\nFor example, consider a buffer that contains nothing but the following:\n\n    \"\"\"\n    some example code.\n    section is multiple lines\n    \"\"\"\n\n    if (getinput() == \"yes\") {\n        print \"this is an example\"\n        counter += 1\n    }\n\nIf the cursor is on the `p` in `print` and the user types\n\n    vi{\n\nThe area between the { and } characters will be selected.  However, if the\ncursor is on the `s` in `some` and the user types\n\n    vi\"\n\nnothing will happen, because quote-like text-objects do not work on multiple\nlines.  With TextObjectify, the two lines between the triple quote sets will be\nselected - the parenthesis-style text-object functionality will apply.\n\nIf the cursor is on the `p` in `print` and the user types\n\n    vi\"\n\nthe string `this is an example` will be selected, because quote-style\ntext-objects seek forward on the same line when looking for an object.\nHowever, if the cursor is on the `i` in `if` and the user types\n\n    vi(\n\nnothing will happen, because parenthesis-like text-objects do not seek if\nthey are not in already within a text-object.  With TextObjectify, the region\nbetween the parenthesis will be selected.\n\nIn addition to improving how existing text-objects function, TextObjectify\nallows user to create custom text-objects.  To serve as examples,\nTextObjectify comes with two custom text objects: `\u003ccr\u003e` will operate over the\nentire buffer and `V` will operate over a block of viml.  With default\nTextObjectify, if a user types\n\n    \"+ya\u003ccr\u003e\n\nthe entire buffer will be stored within the quoteplus register.\n\nConsider a buffer that contains the following:\n\n    if nr2char(getchar()) == g:quitmap\n        echo \"Quitting example\"\n        return 0\n    endif\n\nIf the cursor is on any of the lines shown and the user enters `viV`, the\n`echo` and `return` lines will be selected.\n\nMoreover, TextObjectify has the ability to create text-objects on-the-fly if\nan object is requested that is not provided by Vim out of the box and is not\none of TextObjectify's custom text objects.  Whatever character is provided\nbecomes the delimiter for either side.  For example, if the buffer contains the\nfollowing:\n\n\n    LaTeX documents can show colors such as red, blue, green, and yellow.\n    Additionally, they can show pretty mathematics such as $\\int x^2dx$.\n\nIf the user would like to select an area between commas, there is no need to\nplan ahead and create such a custom text-object.  The user can simply enter\n\"vi,\" and TextObjectify will create a text-object with commas as delimiters\non either side.  Similarly, the user could type \"ci$\" to change the area\nbetween the dollar signs without having to create a custom text-object ahead\nof time.\n\nSetup\n-----\n\nTextObjectify can be installed like most other Vim plugins.  On a Unixy system\nwithout a plugin manager, the textobjectify.vim file should be located at:\n\n    ~/.vim/plugin/textobjectify.vim\n\nOn a Unixy system with pathogen, the textobjectify.vim file should be located at:\n\n    ~/.vim/bundle/textobjectify/plugin/textobjectify.vim\n\nOn a Windows system without a plugin manager, the textobjectify.vim file should be located at:\n\n    %USERPROFILE%\\vimfiles\\plugin\\textobjectify.vim\n\nOn a Windows system with pathogen, the textobjectify.vim file should be located at:\n\n    %USERPROFILE%\\vimfiles\\bundle\\textobjectify\\plugin\\textobjectify.vim\n\nIf you are using a plugin manager other than pathogen, see its documentation\nfor how to install TextObjectify - it should be comparable to other plugins.\n\nIf you would like the documentation to also be installed, include textobjectify.txt\ninto the relevant directory described above, replacing `plugin` with `doc`.\n\nTextObjectify should have same defaults and be useful without any additional\nconfiguration.  However, to get the most out of TextObjectify, it is\nrecommended that you configure it to your own tastes.\n\nConfiguration\n-------------\n\nThere are a handful of global variables which can be set to tweak how\nTextObjectify operates.  The main one is g:textobjectify which contains\ninformation on how to treat all custom text-objects or modifications of\nexisting text-objects.  The others tweak how on-the-fly text-objects\nfunction.\n\nAll TextObjectify objects have the following attributes:\n\n- 'left':  Regex for the left delimiter\n- 'right': Regex for the right delimiter\n- 'same':  Set to 1 to have object prioritize same-line objects over multi-line\n  objects.  That is, if the situation is ambiguous, act like quote-like\n  text-objects normally do.  Otherwise, set to 0 to have the object act like\n  parenthesis-like text-objects normally do.\n- 'seek': Sets whether or not to search for a text-object if the cursor is\n  not already within one.  if 'seek' is 0, no seeking is done, i.e., if the\n  cursor is not already within the text-object abort.  if 'seek' is 1, search\n  forward for a text-object if the cursor is not already in one.  If 'seek'\n  is 2, search backward for a text-object if the cursor is not already in\n  one.  The parenthesis-style text-objects come in pairs - TextObjectify\n  defaults to having the left item of the pairs search forward and the right\n  item search backwards.\n- 'line': If set to '1', it will force the object to act as though it is\n  selected linewise.  The `V` text-object which TextObjectify comes with acts\n  this way.\n\ng:textobjectify is a Dictionary.  Each key is the character which is used\nto select the object.  The values are Dictionaries with the above five\nattributes.  For example, the default g:textobjectify is:\n\n    let g:textobjectify = {\n                \\'(': {'left': '(', 'right': ')', 'same': 0, 'seek': 1, 'line': 0},\n                \\')': {'left': '(', 'right': ')', 'same': 0, 'seek': 2, 'line': 0},\n                \\'{': {'left': '{', 'right': '}', 'same': 0, 'seek': 1, 'line': 0},\n                \\'}': {'left': '{', 'right': '}', 'same': 0, 'seek': 2, 'line': 0},\n                \\'[': {'left': '\\[', 'right': '\\]', 'same': 0, 'seek': 1, 'line': 0},\n                \\']': {'left': '\\[', 'right': '\\]', 'same': 0, 'seek': 2, 'line': 0},\n                \\'\u003c': {'left': '\u003c', 'right': '\u003e', 'same': 0, 'seek': 1, 'line': 0},\n                \\'\u003e': {'left': '\u003c', 'right': '\u003e', 'same': 0, 'seek': 2, 'line': 0},\n                \\'\"': {'left': '\"', 'right': '\"', 'same': 1, 'seek': 1, 'line': 0},\n                \\\"'\": {'left': \"'\", 'right': \"'\", 'same': 1, 'seek': 1, 'line': 0},\n                \\'`': {'left': '`', 'right': '`', 'same': 1, 'seek': 1, 'line': 0},\n                \\'V': {'left': '^\\s*\\(if\\|for\\|function\\|try\\|while\\)\\\u003e',\n                    \\'right': '^\\s*end', 'same': 0, 'seek': 1, 'line': 1},\n                \\\"\\\u003ccr\u003e\": {'left': '\\%^', 'right': '\\%$', 'same': 0, 'seek': 0,\n                \\'line': 0},\n                \\}\n\nThis sets how the parenthesis-like text-objects, the quote-like\ntext-objects, and the two new text-objects operate.  This is a good\nreference if you want to make your own.\n\nTo create modify or create a new text-object, copy the above lines into your\nvimrc and adjust accordingly.  Note that if you create a g:textobjectify in\nyour vimrc it overwrites all of TextObjectify's default values.  Thus if you\ncreate an empty g:textobjectify all objects default will act as they would\nwithout TextObjectify installed - quote-like text-objects will not act on\nmultiple lines, etc.\n\nBy default, TextObjectify will create new text-objects on-the-fly if a\nmapping is called that does not correspond to an existing text-object (either\none of Vim's defaults or one provided by TextObjectify).  To disable this, set\ng:textobjectify_onthefly to 0.\n\nThe 'same', 'seek' and 'line' attributes of on-the-fly text-objects can be\ncustomized by setting the g:textobjectify_onthefly_same,\ng:textobjectify_onthefly_seek, and g:textobjectify_onthefly_line variables\nto the desired value.  Otherwise, they default to 0, 1, and 0, respectively.\n\nChangelog\n---------\n\n0.1 (2013-04-06):\n - initial release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparadigm%2FTextObjectify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparadigm%2FTextObjectify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparadigm%2FTextObjectify/lists"}