Giter VIP home page Giter VIP logo

Comments (13)

demon386 avatar demon386 commented on July 17, 2024

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

from smartmarkdown.

alehandrof avatar alehandrof commented on July 17, 2024

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.

from smartmarkdown.

alehandrof avatar alehandrof commented on July 17, 2024

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

Testers?

from smartmarkdown.

vovkkk avatar vovkkk commented on July 17, 2024

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.

See?

from smartmarkdown.

jeffnuss avatar jeffnuss commented on July 17, 2024

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.

from smartmarkdown.

vovkkk avatar vovkkk commented on July 17, 2024

@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.

    Continued.

*   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+[/]?

from smartmarkdown.

alehandrof avatar alehandrof commented on July 17, 2024

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 :)

from smartmarkdown.

jeffnuss avatar jeffnuss commented on July 17, 2024

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

from smartmarkdown.

alehandrof avatar alehandrof commented on July 17, 2024

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

from smartmarkdown.

alehandrof avatar alehandrof commented on July 17, 2024

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

from smartmarkdown.

jeffnuss avatar jeffnuss commented on July 17, 2024

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.

from smartmarkdown.

alehandrof avatar alehandrof commented on July 17, 2024

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.

from smartmarkdown.

demon386 avatar demon386 commented on July 17, 2024

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

from smartmarkdown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.