Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Feature: Quick nested list indenting #9

jeffnuss opened this Issue Sep 6, 2012 · 13 comments


None yet
4 participants

jeffnuss commented Sep 6, 2012

It would be nice if I could just hit tab when I have a list item and increase the indentation level. Also, I know shift-tab folds the headings up, but maybe shift-alt-tab or something else to decrease the indent level. I use your plugin for note taking and it's great. Thanks.


demon386 commented Sep 7, 2012

Thanks for your suggestion. I'll work on it when I have time.

@alehandrof alehandrof added a commit to alehandrof/SmartMarkdown that referenced this issue Apr 19, 2013

@alehandrof alehandrof Quick nested list indenting
A quick-and-dirty way to resolve issue #9

alehandrof commented Apr 19, 2013

A simple of version of feature can be accomplished by add the following to the bottom* of SmartMarkdown/Default.sublime-keymap:

    { "keys": ["tab"], "command": "indent", "context":
            { "key": "selector", "operator": "equal", "operand": "markup.list" }
    { "keys": ["shift+tab"], "command": "unindent", "context":
            { "key": "selector", "operator": "equal", "operand": "markup.list" },
            // Should we enable the following setting check?
            // { "key": "setting.shift_tab_unindent", "operator": "equal", "operand": true }

* The position is important: as it should override the Shift+Tab global fold. I actually don't like that binding very much, but I'm not sure if something else would be an improvement.

Edit: Ah, I see the commit I made in my branch triggers a comment here. Well, the commit just includes the code above.


alehandrof commented Apr 19, 2013

Scratch that. The default Markdown syntax does not play very nice when the caret is at the end of the document like so:

* List
* |

I cobbled together an improved version using regex, which includes support for (almost) all of the various Pandoc lists: 1b5c095



vovkkk commented Apr 19, 2013

Wait, you know there are ctrl+[ and crtl+] - works everywhere and exactly as you expect?

I mean, sure maybe other keystrokes would be more convinient, but implicitness is bad:
if I press shift+tab in list it will unindented... but I meant to fold all;
if I press shift+tab in paragraph it will fold... but I meant to unindent.


ctrl/command + [ and ] certainly work, but my use case comes from experience with word processors such as microsoft word where hitting tab at the beginning of a bulleted list item indents that item. Tab indentation is nice because it's a learned behavior from other programs. ctrl/cmd + [ and ] are fine when I'm coding, but when I'm taking notes or quickly inputting items in a list that will be turned into HTML, it's nice to just hit enter then tab to quickly nest a list. Also, you could use shift+alt+tab instead of shift+tab or leave it up to the user to decide. I'd personally use shift+tab to unindent more than I would to fold all, but certainly that's just me and what I use markdown for.


vovkkk commented Apr 19, 2013

@jeffnuss I understand, e.g. I had used Tomboy for a long time.
But you know how they say: the further into the woods, the more firewood.

  1. shift+alt+tab switches windows in Windows (at least 7)

  2. plain text doesn't make good alignment (as e.g. MS Word or Tomboy) so if one want to make it they should use whitespaces or tabs
    example of alignment:

*   First paragraph.


*   Second paragraph.

Now it may be acomplished just by hitting tab.

So I just saying that such small issue will demand too much time for making, testing, and configuring - does it really worth it, taking in account of ctrl+[/]?


alehandrof commented Apr 19, 2013

Let me throw in a couple of thoughts:

I get what @vovkkk is saying in terms of testing, but I think that, with a little fine-tuning, what I have posted above is okay for most use. (Unless I've missed something blindingly obvious.)

Now, if the objection is that it breaks expected behaviour, it's very simple to hide it behind a setting such as "quick_indent_lists" for those of us who prefer it. I think this situation is more of an issue with the Emacs-heritage of the fold/unfold all binding, since these bindings are quite Sublimish.

Also, they may look the same but what Ctrl+[ & Ctrl+] do is to push and pull the beginning of the line. Whereas Tab subordinates the idea on the current line to the idea on the previous one, while Shift+Tab makes the current line's idea parallel to an earlier one.

I'm not kidding. It would be great if it was possible to move logical units around using Ctrl+Shift+Up/Down. Any takers?

@jeffnuss If you use the bindings, let me know how it goes :)

Got a chance to play with the bindings and they work great. This is exactly what I was looking for. Thanks.


alehandrof commented May 5, 2013

Cool. Let me know if you notice any weirdness. I just squashed a bug @vovkkk pointed out to me (hopefully, for good) that was interfering with folding headings. Just grab the last two keybindings from here: https://github.com/alehandrof/SmartMarkdown/blob/develop/Default.sublime-keymap


alehandrof commented Sep 7, 2013

@demon386 I've been using this for awhile and it's both useful and robust (I think). Shall I open a PR?

jeffnuss commented Oct 2, 2013

I haven't been actively pounding on it and trying to break it, but I haven't had an issues with it, so you have my vote.


alehandrof commented Oct 2, 2013

I'm putting together a package of Markdown stuff I've made for my own use. If @demon386 isn't interested (which I can understand, as SmartMarkdown does some higher-level stuff) I will publish these in that form for easy update & maintenance.


demon386 commented Oct 3, 2013

@alehandrof This functionality is good (in fact Org mode has that too)! Please submit a PR is possible. Thanks!

@alehandrof alehandrof added a commit to alehandrof/SmartMarkdown that referenced this issue Oct 3, 2013

@alehandrof alehandrof Quick nested list indenting
A quick-and-dirty way to resolve issue #9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment