Questions tagged [sublimetext-snippet]

Related to the creation of code snippets in Sublime Text editor

This quote from the Unofficial Documentation sums it up:

Whether you are coding or writing the next vampire best-seller, you’re likely to need certain short fragments of text again and again. Use snippets to save yourself tedious typing. Snippets are smart templates that will insert text for you and adapt it to their context

47 questions
1
vote
1 answer

Match Parent Folder in Sublime Text 3 Snippet

I'm trying to create a snippet that outputs a file's parent folder name. For example: /Users/user/src/Page/index.js returns Page I've got this regex pattern: ([^\/]+)(?:\/[^\/]+)$ Which, according to Regex101, matches Page/index.js with Page in…
Ben Ratner
  • 13
  • 2
1
vote
0 answers

Why does Sublime Text snippet work only at the last row?

I'm trying to create my own snippet for Sublime Text 3. Here it is:
someserj
  • 47
  • 7
1
vote
1 answer

Sublime Text consecutive snippets

Whenever I type a keyword and press tab to use my snippet, I have to place the cursor somewhere else with a mouse click to use another snippet. Thats not good at all. I want to be able to type tk;tab to get \begin{tikzpicture} …
1
vote
1 answer

how to write a snippet than can toggle text like snippet Get Element

In snippet Get Element, when i type get and push tab, it will show getElementsByTagName('') and the letter T is highlight and editable, then typed letter I, it will change to getElementById('') automatically. I want to create a snippet which can…
daskyrk
  • 132
  • 1
  • 10
1
vote
1 answer

Sublime Text C plugin - code templates and autocomplete

I'm looking for a plugin (or a way to create metadata for a plugin) that will allow me to do the following with Sublime Text 3 for the C programming language. Generate C source file from a template (Auto) generate C style function comments For…
cowboydan
  • 1,062
  • 7
  • 15
1
vote
1 answer

Latex Sublime snippet

I'm using a Sublime snippet to create a Latex state machine template. However, it does nothing (when I type "stmach" and press tab, stmach disappears but the Latex code isn't included). I don't understand why, as all my other snippets are working…
Nakrule
  • 511
  • 8
  • 24
1
vote
1 answer

Sublime text 3: Using the same tab stop twice without cloning the word

I'm currently using the same tab stop twice in order to select two elements that are linked together. If the feature these two control is not needed, then neither one needs to be there. That said, the tab stop does indeed select both areas it is…
Hinukan
  • 35
  • 3
1
vote
1 answer

Snippet to replace accented vowel by vowel without tilde in sublime text

In the following snippet of LaTeX package (sublime text 3) every time I enter a: Space, . (dot), ?, *, #, Is replaced by "_" character in the part \label{sec:*****} and % section ***** (end). Also replaces capital letters to lowercase. Here the…
1
vote
0 answers

In a Sublime Text 2 snippet, how do I transform a user entered parameter ${1:Param/^\w/\u$&/}?

I am trying to make a ST2 snippet to insert a comment "section" in my PHP code. I am attempting to achieve something like the following: // -------------------------------------------------- // ${1:Enter section title here/^(.*)$/\U\1/} //…
niebaum
  • 11
  • 1
1
vote
1 answer

Identify Sublime Text 3 snippet source

Does anyone know how I can identify where a Sublime Text 3 code snippet is coming from? There's one for Rails that I thought was coming from a certain package. I've uninstalled said package but the snippet is still available for use. It's driving me…
Al D
  • 657
  • 2
  • 10
  • 27
1
vote
0 answers

How To Write Snippet For Sublime

i am trying writing some useful snippets for me,i had already written some basics one in my element.sublime-snippet,but i found in emmet-sublime they have some snippet which multiply the elements. eg : ul>li*3 Result:
ak1111
  • 107
  • 11
0
votes
0 answers

Sublime Text 3 : Creating Snippet using simple regex

I tried to create a simple snippet that check if there is a 's' and print me the result ${1:s} ${1/(^s$)/(?1yes:no)/} When there is only an s it should print me "s yes" else it should simply print me for example "notAnS no" What it actually does is…
Metalucas
  • 1
  • 2
0
votes
1 answer

How do I create a snippet for jQuery?

So I want to create a snippet for the following: $("input").click(function(event){ //code goes here }); But when I try to create the snippet in sublime text:
Ajay Kudva
  • 179
  • 6
0
votes
0 answers

Create text manipulation function to execute in Visual Studio Code

Is it possible to create a function to manipulate a text selection? I'd like to select a paragraph and tell Visual Studio Code (or in any other text editor) to execute a function on that selection. I've tried to use code snippets, but it allows only…
0
votes
1 answer

How to use sublime text vars in snippets?

I am trying to create snippet where must be displayed the name of the current file I tried to do this: But it does not work