-1

I've tried the Emacs land and when using evil-org >> and << are remapped to in/decrease the level of headings, how could I do the same with vim and vim-dotoo?

  • 1
    After reading quickly the readme of vim-dotoo it is not clear how they handle their headings. It would be easier to help you if you provided some examples of what the headings look like and how they are supposed to change. Also note that > and < are already used as verbs to increment/decrement the indentation of an object so remapping them might not be the best idea. – statox Jul 30 at 14:21
  • 1
  • @statox ``` * heading content ** sub-heading ``` Only when doing >> or << on some heading then its level should be increased or decreased. Otherwise indenting should be done. Note that this should also apply to the subtree items too. So the levels are kept consitent file wise. Though that might be debatable. – Paulo Phagula Jul 30 at 16:28
1

A comment mentions that headings look like

* heading
** subheading

So I think an <expr> mapping could do it:

nnoremap <expr> >> getline('.') =~# '^\s*\*' ? "I*\<Esc>" : '>>'

Adjust regex/command as necessary. The unindent is left as an exercise.

  • 1
    As suggested I went with nnoremap <buffer> <expr> >> getline('.') =~# '^\s*\*' ? "I*\<Esc>" : '>>' and nnoremap <buffer> <expr> << getline('.') =~# '^\s*\*' ? "^x\<Esc>" : '<<' for indent and deindent respectively. My only concern now, as stated above is that the tree hierarchy is no longer consistent, however I think I can live with that for now. – Paulo Phagula Jul 31 at 7:15

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.