{"id":22551881,"url":"https://github.com/dbmrq/vim-chalk","last_synced_at":"2025-04-10T03:33:25.240Z","repository":{"id":164625208,"uuid":"69535417","full_name":"dbmrq/vim-chalk","owner":"dbmrq","description":":pencil2: Better fold markers","archived":false,"fork":false,"pushed_at":"2020-04-25T05:27:11.000Z","size":17,"stargazers_count":28,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T04:50:51.748Z","etag":null,"topics":["fold","fold-markers","nesting","vim"],"latest_commit_sha":null,"homepage":"","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/dbmrq.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":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-29T05:55:07.000Z","updated_at":"2024-11-28T23:03:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"25d28300-1a83-45e2-9994-ada8ea4f1a47","html_url":"https://github.com/dbmrq/vim-chalk","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/dbmrq%2Fvim-chalk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbmrq%2Fvim-chalk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbmrq%2Fvim-chalk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbmrq%2Fvim-chalk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbmrq","download_url":"https://codeload.github.com/dbmrq/vim-chalk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248151441,"owners_count":21056097,"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":["fold","fold-markers","nesting","vim"],"created_at":"2024-12-07T17:15:04.015Z","updated_at":"2025-04-10T03:33:25.230Z","avatar_url":"https://github.com/dbmrq.png","language":"Vim script","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chalk.vim\n\nVim can get confused when handling multiple nested fold markers.\n\nThe answer is to include a level (like this: `\"{{{1`), but I'm too lazy for that. Enter Chalk. It automatically adds the level to folds you create with `zf` and increments all nested folds for you. There are also specific mappings and commands to increment and decrement markers while keeping them balanced and more. :tada:\n\n![chalk](http://i.imgur.com/8X3Oljm.gif)\n\n\n**Update:** Inspired by [kshenoy/vim-origami](https://github.com/kshenoy/vim-origami), I updated Chalk with the option to keep the markers aligned. My version aligns both the opening and closing markers and it also allows you to choose a \"filler\" character for the padding. On the other hand, it doesn't support \"staggered\" alignment and the markers are always aligned to the `textwidth` setting.\n\n![chalk2](https://user-images.githubusercontent.com/15813674/42131541-73d044d6-7cda-11e8-872c-ccdf19c0dc7e.png)\n\n\n### Quick start\n\n1. Install Chalk using your favorite plugin manager or copy each file to its corresponding directory under `~/.vim/`.\n\n2. Add this to your `.vimrc`:\n\n    ```vim\n    set foldmethod=marker\n\n    let g:chalk_char = \".\"       \" The character used as padding\n                                 \" when aligning markers\n\n    \" Files for which to add a space between the marker and the current text\n    au BufRead,BufNewFile *.vim let b:chalk_space_before = 1\n\n\n    \" Create fold at visual selection\n    vmap zf \u003cPlug\u003eChalk\n    \" Create fold at operator movement\n    nmap zf \u003cPlug\u003eChalk\n    \" Create fold for specified number of lines\n    nmap zF \u003cPlug\u003eChalkRange\n\n    \" Create single (opening) fold marker at current level or specified count\n    nmap Zf \u003cPlug\u003eSingleChalk\n    \" Create single (opening) fold marker at next levelor specified count\n    nmap ZF \u003cPlug\u003eSingleChalkUp\n\n\n    \" Increment current fold level\n    nmap =z \u003cPlug\u003eChalkUp\n    \" Decrement current fold level\n    nmap -z \u003cPlug\u003eChalkDown\n    \" Increment levels in selection\n    vmap =z \u003cPlug\u003eChalkUp\n    \" Decrement levels in selection\n    vmap -z \u003cPlug\u003eChalkDown\n    ```\n\n    (Choose the mappings you prefer. These are only suggestions.)\n\n\n## Commands\n\n#### `:ChalkUp` and `:ChalkDown`\n\nIncrement or decrement the fold marker levels for the specified range (or the whole file, if no range is given).\n\n#### `:ChalkAlign`\n\nAlign all markers in the current document.\n\n\n## Mappings\n\n#### `\u003cPlug\u003eChalk`\n\nThis works just like Vim's `zf`, creating a new fold at the current selection (in visual mode) or motion (in normal mode). The difference is that it also adds the fold level automatically according to where you're at.\n\n#### `\u003cPlug\u003eChalkRange`\n\nThis works just like Vim's `zF`, creating a fold for the specified number of lines, but with the same perks as above.\n\n#### `\u003cPlug\u003eSingleChalk`\n\nThe previous mappings add both the opening and closing fold markers. This one, on the other hand, adds a single opening marker at current line. If a count is specified before the mapping, that count is used as the level number. If no count is specified, this mapping will use the current level.\n\n#### `\u003cPlug\u003eSingleChalkUp`\n\nThis mapping works like the previous one, but if no count is specified, it will use a level deeper than the current fold's.\n\n#### `\u003cPlug\u003eChalkUp` and `\u003cPlug\u003eChalkDown`\n\nWhen used in Normal mode, these mappings will increment or decrement the pair of markers (or the single marker, if you're into that sort of thing) at the current level.\n\nWhen used in Visual mode, they'll increment or decrement every marker in the visual selection. Not that unlike their Normal mode counterparts the Visual mode mappings won't keep the opening and closing markers balanced unless they're both inside the selection.\n\n## Options\n\n#### g:chalk_align\n\nBy default, Chalk will align your fold markers to the right according to your `textwidth` setting. If you want to disable that behavior, set `g:chalk_align` to `0`.\n\n#### g:chalk_char\n\nThe character used to align markers to the right. The default is a space (`\" \"`).\n\n#### g:chalk_edit\n\nBy default, Chalk will leave you in insert/replace mode after creating a new fold. You can disable this behavior by setting `g:chalk_edit` to `0`.\n\n#### b:chalk_space_before\n\nBy default, Chalk won't add a space between an existing line's text and the fold marker. This is good for a language like TeX, in which spaces make a difference, but may be undesirable for other languages, so you can change this behavior by setting `b:chalk_space_before` to `1` for specific file types. E.g.: `au BufRead,BufNewFile *.vim let b:chalk_space_before = 1`.\n\n\n## See also\n\nYou may also be interested in my other plugins:\n\n- [Ditto: highlight overused words](https://github.com/dbmrq/vim-ditto) :speak_no_evil:\n- [Redacted: the best way to ████ the ████](https://github.com/dbmrq/vim-redacted) :no_mouth:\n- [Dialect: project specific spellfiles](https://github.com/dbmrq/vim-dialect) :speech_balloon:\n- [Howdy: a tiny MRU start screen for Vim](https://github.com/dbmrq/vim-howdy) :wave:\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbmrq%2Fvim-chalk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbmrq%2Fvim-chalk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbmrq%2Fvim-chalk/lists"}