2

In Vimwiki, a header level can be decreased, by pressing -.

Is there a native Vimwiki command to remove a level from all headers within a visual selection?

Keep in mind that Vimwiki supports a number of formats (e.g., === Header level 3 ===, ### Header level 3). A search/replace, or a custom command, or a plugin might be a solution. But I am curious if Vimwiki already supports this out-of-the-box?

3
  • 1
    Reading the doc doesn't seem to yield such a command but you could create your own one combining - and (]])[github.com/vimwiki/vimwiki/blob/master/doc/vimwiki.txt#L413) maybe a macro like qqq (clean the q register) then qq]]-@q: create a macro which goes to the next heading, decrease it then call the macro recursively if ]] doesn't wrap around the file (I didn't test it)
    – statox
    Jun 25 '21 at 9:28
  • Otherwise you'll need to create a function which does -]] and checks if you didn't wrap around the file.
    – statox
    Jun 25 '21 at 9:28
  • With the right pattern (^===\|###?) you could use :global/pat/normal -
    – D. Ben Knoble
    Jun 25 '21 at 18:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.