{"id":22780032,"url":"https://github.com/babab/vim-magickey","last_synced_at":"2026-03-19T23:39:59.368Z","repository":{"id":12961056,"uuid":"15639408","full_name":"babab/vim-MagicKey","owner":"babab","description":"A plugin for Vim for performing various common (at least to me) editing actions with a single key. The appropiate type of action to perform after pressing the MagicKey depends on line context and filetype.","archived":false,"fork":false,"pushed_at":"2023-02-04T22:12:01.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-05T15:52:41.053Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/babab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-04T20:50:17.000Z","updated_at":"2023-02-04T21:02:39.000Z","dependencies_parsed_at":"2023-02-18T19:45:31.602Z","dependency_job_id":null,"html_url":"https://github.com/babab/vim-MagicKey","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babab%2Fvim-MagicKey","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babab%2Fvim-MagicKey/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babab%2Fvim-MagicKey/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/babab%2Fvim-MagicKey/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/babab","download_url":"https://codeload.github.com/babab/vim-MagicKey/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246326783,"owners_count":20759439,"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-12-11T20:12:06.042Z","updated_at":"2026-01-07T18:33:43.880Z","avatar_url":"https://github.com/babab.png","language":"Vim Script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vim-MagicKey\n\nA plugin for Vim for performing various common (at least to me) editing\nactions **with a single key**. The appropiate type of action to perform\nafter pressing the MagicKey depends on line context and filetype.\n\nMagic actions:\n\n- Bump copyright headers\n- Create beautiful fold sections\n- Create horizontal rulers\n- Expand Markdown headers to reStructuredText (ft=rst *only*)\n- Run a command from buffer text\n- Quickly substitute text in all buffers\n\n## Installing\n\nUse your plugin manager of choice.\n\n- [Pathogen](https://github.com/tpope/vim-pathogen)\n  - `git clone https://github.com/babab/vim-MagicKey ~/.vim/bundle/vim-MagicKey`\n- [Vundle](https://github.com/gmarik/vundle)\n  - Add `Bundle 'https://github.com/babab/vim-MagicKey'` to .vimrc\n  - Run `:BundleInstall`\n- [NeoBundle](https://github.com/Shougo/neobundle.vim)\n  - Add `NeoBundle 'https://github.com/babab/vim-MagicKey'` to .vimrc\n  - Run `:NeoBundleInstall`\n- [vim-plug](https://github.com/junegunn/vim-plug)\n  - Add `Plug 'https://github.com/babab/vim-MagicKey'` to .vimrc\n  - Run `:PlugInstall`\n\n## What it does\n\nWhenever the `MagicKey()` function is called by pressing `\u003cReturn\u003e`\nin normal mode (by default) it will scan the context around your\ncursor and decide which action to perform, taking the type of file in\nconsideration.\n\nWhen multiple actions are applicable, MagicKey presents an options menu\nso you can choose the appropiate action.\n\n## Global actions\n\nThese are actions that are always available. No matter what the current\nfiletype is.\n\n### Bumping Copyright headers\n\nWhen the word `Copyright` is found it will bump the copyright by looking\nfor the value of `strftime(\"%Y\") - 1` in the context.\n\n    Before: # Copyright (c) 2022  Author Name \u003cuser@example.com\u003e\n    After : # Copyright (c) 2022-2023  Author Name \u003cuser@example.com\u003e\n\n    Before: # Copyright (c) 2009-2022  Author Name \u003cuser@example.com\u003e\n    After : # Copyright (c) 2009-2023  Author Name \u003cuser@example.com\u003e\n\nIt will not bump the copyright when the time overlaps more then a year.\n\n    Before: # Copyright (c) 2016  Author Name \u003cuser@example.com\u003e\n    After : # Copyright (c) 2016  Author Name \u003cuser@example.com\u003e\n\n    Before: # Copyright (c) 2012  Author Name \u003cuser@example.com\u003e\n    After : # Copyright (c) 2012  Author Name \u003cuser@example.com\u003e\n\nThis feature is also available through this command and function:\n\n- Command: `BumpCopyright`\n- Function: `MkBumpCopyright()`\n\n### Horizontal Ruler\n\nYou can expand a stream of chars to a horizontal ruler by using MagicKey\non any line that contains a stream of \u003e= 5 *rulerchars*.\n\n    Before: -------\n    After : ------------------------------------------------------------------------------\n\nThe type of chars can be altered and are defined as:\n\n    let g:magickey_rulerchars = ['*', '=', '-', '.', '\"', \"'\", '#', ':', '\\^', '~']\n\nThe ruler char will be copied to each column in the line up to a max\nwidth of `g:magickey_maxlinelength` columns. The default value is `78`.\n\nThis feature is also available through this command and function:\n\n- Command: `HorizontalRuler`\n- Function: `MkHorizontalRuler(...)`\n\nThe HorizontalRuler command and calling `MkHorizontalRuler` without\narguments work the same as using it via the MagicKey. It will use the\nchar found in the first column to expand the line.\n\nThe `MkHorizontalRuler` also accepts an optional argument which should\nbe a single char, which is then used to expand.\n\n### Execute current line text as command\n\nWhen the current line starts with `# mkrun: `, the remaining text will\nbe executed as an Ex command. Because Ex commands always start with `:`,\nthis is added implicitly and any leading `:` characters added by the\nuser will be stripped.\n\nExample:\n\n    # mkrun: !python %\n\n### Replace in all buffers (alias for \":bufdo %s/{content}/gce | update\"\n\nWhen the current line starts with `# mkreplace: `, the remaining text will be\npasted into a command that substitutes over all open buffers.\n\nExample:\n\n    # mkreplace: croccet/correct\n\nThe above line will result in the command:\n\n    :bufdo %s/croccet/correct/gce | update\n\n## License\n\nCopyright (c) 2014-2023  Benjamin Althues \u003cbenjamin@babab.nl\u003e\n\nPermission to use, copy, modify, and distribute this software for any\npurpose with or without fee is hereby granted, provided that the above\ncopyright notice and this permission notice appear in all copies.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\nWITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\nANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\nWHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\nACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\nOR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabab%2Fvim-magickey","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbabab%2Fvim-magickey","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbabab%2Fvim-magickey/lists"}