{"id":13898295,"url":"https://github.com/LucHermitte/alternate-lite","last_synced_at":"2025-07-17T15:32:53.493Z","repository":{"id":147343328,"uuid":"73817234","full_name":"LucHermitte/alternate-lite","owner":"LucHermitte","description":"a.vim rewriting","archived":false,"fork":false,"pushed_at":"2024-11-13T00:19:45.000Z","size":21,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-13T01:20:42.313Z","etag":null,"topics":["cpp","vim","vim-plugins","viml-functions","viml-library"],"latest_commit_sha":null,"homepage":null,"language":"Vim Script","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/LucHermitte.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,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null}},"created_at":"2016-11-15T13:41:14.000Z","updated_at":"2024-11-13T00:19:42.000Z","dependencies_parsed_at":"2023-07-02T16:15:28.985Z","dependency_job_id":null,"html_url":"https://github.com/LucHermitte/alternate-lite","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucHermitte%2Falternate-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucHermitte%2Falternate-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucHermitte%2Falternate-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LucHermitte%2Falternate-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LucHermitte","download_url":"https://codeload.github.com/LucHermitte/alternate-lite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226274743,"owners_count":17598860,"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":["cpp","vim","vim-plugins","viml-functions","viml-library"],"created_at":"2024-08-06T18:04:12.999Z","updated_at":"2024-11-25T04:31:06.587Z","avatar_url":"https://github.com/LucHermitte.png","language":"Vim Script","readme":"# alternate-lite  [![Last release](https://img.shields.io/github/tag/LucHermitte/alternate-lite.svg)](https://github.com/LucHermitte/alternate-lite/releases) [![Project Stats](https://www.openhub.net/p/21020/widgets/project_thin_badge.gif)](https://www.openhub.net/p/21020)\n\n## Features\nThis plugin is meant to be a simplification of Michael Sharpe's alternate.vim plugin.\n\nThe design decisions that distinguishes _alternate-lite_ from _alternate_ are the\nfollowing:\n\n * Support for project/buffer specific settings\n * Use dictionaries to set variables\n * Lazy definition of functions through autoload plugin\n * `:IH` commands and related mappings are already defined in my\n   [SearchInRuntime plugin](http://github.com/LucHermitte/SearchInRuntime).\n\nMy main use case for this plugin is to build things like\n[lh-cpp's `:GOTOIMPL` command](http://github.com/LucHermitte/lh-cpp).\n\n## Commands\n\nalternate-lite implements slightly differently all `:A` commands provided by\noriginal `a.vim` plugin.\n\nAll these commands first deduce an alternate file for the current one. The\npriority is given to files that exist. Then, they try to jump to the window\nwhere this alternate file is displayed, if the file wasn't displayed, it'll be\nopened:\n\n * In the current window with `:A`,\n * In a horizontally split opened window with `:AS`,\n * In a vertically split opened window with `:AV`,\n * In a new tab with `:AT`.\n\nIn case several alternate files are found, we'll be asked to choose which one\nwe wish to open or to jump-to.\n\nThe previous commands also take an optional parameter: the extension we wish\nprecisally to use to deduce the alternate file.\n\nThere is also the `:AN` command that permits to cycle through the buffers\nassociated to the current buffer. If possible, this command will search for a\nwindow where the next buffer is already displayed.\n\n## Options\n\nSome usual extensions are already registered. This can be extended globally,\nlocally, on project basis, etc.\nSee [`lh#ft#option#get()`](https://github.com/LucHermitte/lh-dev#filetype-polymorphism).\n\nYou can obtain the latest status with a `:echo g:alternates.extensions`.\n\n### Extension map\n\n#### Globally change the extension mappings\nLet's say you want to register `.tpp` as a new extension for files where C++\ntemplate functions would be defined, you'll need to execute (in your `.vimrc`\nfor instance):\n\n```vim\n\" The actual {extension -\u003e extensions} map\ncall lh#alternate#register_extra_extension('g', 'h'  , ['tpp'])\ncall lh#alternate#register_extra_extension('g', 'hpp', ['tpp'])\ncall lh#alternate#register_extension('g', 'tpp', ['h', 'hpp'])\n\n\" The {filetype -\u003e extensions} map\nlet g:alternates.fts.cpp += ['tpp']\n\" Note: this last command can only be done after a call to any lh#alternate#* function\n```\n\nThis says that this new extension may be used in all your projects.\n\nThe last line is important and required with filetypes that share some\nextensions like C, C++, ObjectiveC, and so on. Other filetypes like lex, yacc,\nOCaml, ASP... aren't concerned.\n\nIf you see that  `g:alternates.fts` exists for the filetype to which you wish\nto register a new extension, then:\n\n- override the associated list with the new extensions thank to\n  `lh#alternate#register_extension`\n- extend the associated list with the new extensions thank to\n  `lh#alternate#register_extra_extension`\n\n#### Change the extension mappings for a given project only\nIf you prefer to register it only in one project, with\n[lh-vim-lib](http://github.com/LucHermitte/lh-vim-lib)\n[project feature](https://github.com/LucHermitte/lh-vim-lib/blob/master/doc/Project.md),\nyou could define instead:\n\n```vim\n\" The actual {extension -\u003e extensions} map\ncall lh#alternate#register_extension('p', 'h'  , g:alternates.extensions.h + ['tpp'])\ncall lh#alternate#register_extension('p', 'hpp', g:alternates.extensions.hpp + ['tpp'])\ncall lh#alternate#register_extension('p', 'tpp', ['h', 'hpp'])\n\n\" The {filetype -\u003e extensions} map\nLetTo p:alternates.fts.cpp = g:alternates.fts.cpp + ['tpp']\n\" Note: this last command can only be done after a call to any lh#alternate#* function\n```\n\nIn order to override the default values, just don't reuse them.\n\n### Directory selection\nThe option `(bpg):[{ft}_]alternates.searchpath` can contain a comma separated\nlist of directory alternance policy:\n\n * A path with a prefix of `\"wdr:\"` will be treated as relative to the working\n   directory.\n * A path prefix of `\"abs:\"` will be treated as absolute.\n * No prefix or `\"sfr:\"` will result in the path being treated as relative to the\n   source file (see sfPath argument).\n\n * A prefix of `\"reg:\"` will treat the pathSpec as a regular expression\n   substitution that is applied to the source file path. The format is:\n\n   ```\n   reg:\u003csep\u003e\u003cpattern\u003e\u003csep\u003e\u003csubst\u003e\u003csep\u003e\u003cflag\u003e\u003csep\u003e\n   ```\n\n   * `\u003csep\u003e` seperator character, we often use one of `[/|%#]`\n   * `\u003cpattern\u003e` is what you are looking for\n   * `\u003csubst\u003e` is the output pattern\n   * `\u003cflag\u003e` can be g for global replace or empty\n\nExamples:\n\n * `'reg:/inc/src/g/'` will replace every instance of `'inc'` with `'src'` in\n   the source file path. It is possible to use match variables so you could do\n   something like: `'reg:|src/\\([^/]*\\)|inc/\\1||'` (see `'help :substitute'`,\n   `'help pattern'` and `'help sub-replace-special'` for more details\n\nNote: ',' (comma) are used internally so DON'T use it in your regular expressions\nor other pathSpecs.\n\n\n## TODO\nMany features from the original a.vim plugin are still missing, starting with\n`:A*` commands. I should eventually define them. For now I just need a simpler\ntool to define correctly\n[lh-cpp's `:GOTOIMPL` command](http://github.com/LucHermitte/lh-cpp).\n\n## Installation\n  * Requirements: Vim 7.+, [lh-vim-lib](http://github.com/LucHermitte/lh-vim-lib) v4.6.3\n\n  * With [vim-addon-manager](https://github.com/MarcWeber/vim-addon-manager), install alternate-lite. This is the preferred method because of the various dependencies.\n```vim\nActivateAddons alternate-lite\n```\n  * or with [vim-flavor](http://github.com/kana/vim-flavor) which also supports\n    dependencies:\n```\nflavor 'LucHermitte/alternate-lite'\n```\n  * or you can clone the git repositories (expecting I haven't forgotten anything):\n```\ngit clone git@github.com:LucHermitte/lh-vim-lib.git\ngit clone git@github.com:LucHermitte/alternate-lite.git\n```\n  * or with Vundle/NeoBundle (expecting I haven't forgotten anything):\n```vim\nBundle 'LucHermitte/lh-vim-lib'\nBundle 'LucHermitte/alternate-lite'\n```\n\n## Credits\n * Michael Sharpe for his original plugin\n * Directory \u0026 regex enhancements added by Bindu Wavell who is well known on\n   vim.sf.net\n\n## License\nWe grant permission to use, copy modify, distribute, and sell this software for\nany purpose without fee, provided that the above copyright notice and this text\nare not removed. We make no guarantee about the suitability of this software\nfor any purpose and we are not liable for any damages resulting from its use.\nFurther, we are under no obligation to maintain or extend this software. It is\nprovided on an \"as is\" basis without any expressed or implied warranty.\n\n","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLucHermitte%2Falternate-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLucHermitte%2Falternate-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLucHermitte%2Falternate-lite/lists"}