Skip to content

Commit

Permalink
Refactor snippets
Browse files Browse the repository at this point in the history
Fixes #1524

This commit...

1. replaces `biblatex_snippet_completions` module by default ST3+ snippets
   as there's no obvious reason for providing default snippets by a plugin.

2. organizes all existing *.sublime-snippets in snippets/ sub directory

3. converts various *.sublime-completions files to *.sublime-snippet format
   to recover ST3 behavior in ST4. That's required because ST4 drops completions
   of which trigger perfectly matches user input in order to ensure real
   snippets always take precedence.

   Snippets to cycle through various tags via tab key have been removed as they
   may cause confusion when triggered directly (fixes #1555).

   Snippets are generally named by their trigger. Those, which differ only by
   case are suffixed with `_upr` to support case-insensitive filesystems.

Notes:
1. line breaks in scope tag require ST3176+.
2. if no prefix is typed, completion panel shows entries only as of ST4.
  • Loading branch information
deathaxe committed Dec 30, 2024
1 parent 55bb8bc commit 38346cc
Show file tree
Hide file tree
Showing 174 changed files with 783 additions and 387 deletions.
2 changes: 1 addition & 1 deletion Beamer.sublime-completions
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
{ "trigger": "visible", "contents": "\\visible<${1:+-}>{$2}"},
{ "trigger": "only", "contents": "\\only<${1:+-}>{$2}"}
]
}
}
41 changes: 24 additions & 17 deletions Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -297,21 +297,21 @@ LaTeX Package keymap for Linux
// Wrap selected text in command or environment
{
"keys": ["ctrl+l","ctrl+c"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Wrap in command.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/Wrap in command.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
]
},
{
"keys": ["ctrl+l","ctrl+n"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Wrap in environment.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/Wrap in environment.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
]
},
{
"keys": ["ctrl+l","ctrl+n"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Insert environment.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/Insert environment.sublime-snippet" },
"context": [
{ "key": "selection_empty", "match_all": true },
{ "key": "selector", "operand": "text.tex.latex" }
Expand All @@ -336,43 +336,50 @@ LaTeX Package keymap for Linux

// Wrap selected text in emph, bold or underline
{
"keys": ["ctrl+l","ctrl+e"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text emphasize.sublime-snippet" },
"keys": ["ctrl+l","ctrl+b"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/bf.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex - text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+b"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text boldface.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/math/bf.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+b"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Math boldface.sublime-snippet" },
"keys": ["ctrl+l","ctrl+e"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/em.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex meta.environment.math" }
{ "key": "selector", "operand": "text.tex.latex" }
]
},
{
"keys": ["ctrl+l","ctrl+s"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text slanted.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/sl.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex - text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+u"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text underline.sublime-snippet" },
"keys": ["ctrl+l","ctrl+t"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/tt.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex - text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+t"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text monospace.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/math/tt.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+u"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/un.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
]
Expand Down
41 changes: 24 additions & 17 deletions Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -297,21 +297,21 @@ LaTeX Package keymap for OS X
// Wrap selected text in command or environment
{
"keys": ["super+l","super+c"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Wrap in command.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/Wrap in command.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
]
},
{
"keys": ["super+l","super+n"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Wrap in environment.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/Wrap in environment.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
]
},
{
"keys": ["super+l","super+n"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Insert environment.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/Insert environment.sublime-snippet" },
"context": [
{ "key": "selection_empty", "match_all": true },
{ "key": "selector", "operand": "text.tex.latex" }
Expand All @@ -336,43 +336,50 @@ LaTeX Package keymap for OS X

// Wrap selected text in emph, bold or underline
{
"keys": ["super+l","super+e"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text emphasize.sublime-snippet" },
"keys": ["super+l","super+b"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/bf.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex - text.tex.latex meta.environment.math" }
]
},
{
"keys": ["super+l","super+b"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text boldface.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/math/bf.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex meta.environment.math" }
]
},
{
"keys": ["super+l","super+b"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Math boldface.sublime-snippet" },
"keys": ["super+l","super+e"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/em.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex meta.environment.math" }
{ "key": "selector", "operand": "text.tex.latex" }
]
},
{
"keys": ["super+l","super+s"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text slanted.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/sl.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex - text.tex.latex meta.environment.math" }
]
},
{
"keys": ["super+l","super+u"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text underline.sublime-snippet" },
"keys": ["super+l","super+t"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/tt.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex - text.tex.latex meta.environment.math" }
]
},
{
"keys": ["super+l","super+t"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text monospace.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/math/tt.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex meta.environment.math" }
]
},
{
"keys": ["super+l","super+u"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/un.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
]
Expand Down
41 changes: 24 additions & 17 deletions Default (Windows).sublime-keymap
Original file line number Diff line number Diff line change
Expand Up @@ -297,21 +297,21 @@ LaTeX Package keymap for Linux
// Wrap selected text in command or environment
{
"keys": ["ctrl+l","ctrl+c"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Wrap in command.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/Wrap in command.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
]
},
{
"keys": ["ctrl+l","ctrl+n"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Wrap in environment.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/Wrap in environment.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
]
},
{
"keys": ["ctrl+l","ctrl+n"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Insert environment.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/Insert environment.sublime-snippet" },
"context": [
{ "key": "selection_empty", "match_all": true },
{ "key": "selector", "operand": "text.tex.latex" }
Expand All @@ -336,43 +336,50 @@ LaTeX Package keymap for Linux

// Wrap selected text in emph, bold or underline
{
"keys": ["ctrl+l","ctrl+e"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text emphasize.sublime-snippet" },
"keys": ["ctrl+l","ctrl+b"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/bf.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex - text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+b"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text boldface.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/math/bf.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+b"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Math boldface.sublime-snippet" },
"keys": ["ctrl+l","ctrl+e"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/em.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex meta.environment.math" }
{ "key": "selector", "operand": "text.tex.latex" }
]
},
{
"keys": ["ctrl+l","ctrl+s"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text slanted.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/sl.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex - text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+u"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text underline.sublime-snippet" },
"keys": ["ctrl+l","ctrl+t"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/tt.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
{ "key": "selector", "operand": "text.tex.latex - text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+t"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/Text monospace.sublime-snippet" },
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/math/tt.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex meta.environment.math" }
]
},
{
"keys": ["ctrl+l","ctrl+u"],
"command": "insert_snippet", "args": { "name":"Packages/LaTeXTools/snippets/latex/un.sublime-snippet" },
"context": [
{ "key": "selector", "operand": "text.tex.latex" }
]
Expand Down
Loading

0 comments on commit 38346cc

Please sign in to comment.