SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2k stars 364 forks source link

Expand key binding Shift-Enter to add \item in paralist-environments #1471

Closed pjanck closed 4 years ago

pjanck commented 4 years ago

The current key binding "Shift-Enter" adds \item only inside vanilla list-like environments (itemize, enumerate etc.).

My wish would be to expand the supported environments with those from paralist package (Paralist documentation).

I assume the correct place to code would be here, but I am not fluent in ST or Python syntax to correct it myself.

1369 may be related, however introducing the following into "Key bindings - User" of LaTeXTools package did not add the functionality as expected.

{  "keys": ["shift+enter"], 
   "command": "insert_snippet", 
   "args": { "contents": "\n\\item $0" }, 
   "context": [
     { "key": "selector", "operand": "text.tex.latex" },
     { "key": "latextools.env_selector", "operand": "asparaitem"},
   ]  },
r-stein commented 4 years ago

This feature is still in the prereleases (We will hopefully release the new version soon.): https://github.com/SublimeText/LaTeXTools#prereleases

Note that the syntax of the env selector is based on the usual selector syntax and works with several environments, e.g.:

    {
        "keys": ["shift+enter"], 
        "command": "insert_snippet", 
        "args": { "contents": "\n\\item $0" }, 
        "context": [
            { "key": "selector", "operand": "text.tex.latex" },
            { "key": "latextools.env_selector", "operand": "asparaitem , inparaitem"},
        ]
    },
pjanck commented 4 years ago

@r-stein Nice! Allowing for prerelease version and updating the LaTeXTools package did the trick. Thank you for your fast response!