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
21
votes
3 answers

Autocomplete of custom JavaScript functions in Sublime Text

I am using Sublime Text to code my website where I have a JavaScript file with a lot of functions. I use those functions quite frequently and every time I do, I have to type the whole function out. I noticed that for each function, I could create a…
Neophile
  • 5,660
  • 14
  • 61
  • 107
14
votes
1 answer

Sublime text - snippet with capitalization of param first letter

I want to make snippet for Sublime Text 2 or 3 which will produce the following code: initial - somename with upper case - Somename and somename is text which will be always different. My draft for this:
nktssh
  • 2,171
  • 21
  • 23
6
votes
3 answers

Single regex that changes camel-case to dash-separated lowercase

I'm trying to write a SublimeText snippet for javascript import statements. I want the format the format to be like: import MyFooBar from 'my-foo-bar'; The input to my regex is MyFooBar, and the output needs to be my-foo-bar. I found an answer…
dx_over_dt
  • 13,240
  • 17
  • 54
  • 102
5
votes
2 answers

Sublime Text Editor snippet to remove parentheses

Sublime is able to add parentheses, brackets (curly and square), apostrophes, and quotes to highlighted text by default. I've tried but can't seem to find a way to have it remove those as well. What I'd like to be able to do is highlight some text…
TheDoc
  • 688
  • 2
  • 14
  • 33
3
votes
1 answer

Sublime text snippets substitutions with 3 regex replacements

I am trying to make a snippet that will do 3 things depending on the input of one variable (router interface name). I have made the regex working correctly but its working separately. remove xx- >>>>> …
A.D usa
  • 69
  • 5
3
votes
1 answer

Inserting date command into snippet sublime text 3

I am trying to create a snippet for starting a LaTex document where the packages and everything is filled in, but I also want it to automatically fill in the date. I have the insertdate package, but I did not understand how to use it. I have the…
Karl
  • 1,074
  • 8
  • 25
3
votes
4 answers

Sublime Text 3 - How can i add my PHP tags

I want to add some custom tags for my development - but I don't know how to do it. I have tried snippets but it doesn't work because my tags have some special symbols. How can I add my tags so that the snippets work? Eg: when I fill z_z in sublime…
Phuc Vo
  • 235
  • 5
  • 17
2
votes
2 answers

source.vue doesn't work in my vue snippet in sublime text3?

I have a very annoying problem with my sublime snippet about .vue type flie. Say I want to add a vue snippet in sublime on my own, and I want the vue tabtrigger below works in vue type file only. I add these codes into my…
Lying_cat
  • 1,288
  • 2
  • 12
  • 16
2
votes
1 answer

How can I omit (or delete) auto matching parenthesis when triggering a SublimeText custom snippet?

I'm trying to create a JavaScript arrow function snippet in SublimeText. It should be available when I type an open paren: (. I want to be able to tab to create this: () => {} With auto match enabled (a feature I like, normally), I can't figure out…
2
votes
1 answer

Sublime Text 3 Get and Set Snippet Java

I'm trying to create a snippets to automatically generate getters and setters in java The problem is that i don't know how to split the string taken from $TM_SELECTED_TEXT The code needs to be inserted below the constructor After I select the text…
nautilor
  • 106
  • 12
2
votes
1 answer

Sublime Text 3 - snippet with camel case - and removal or word converting of special characters

I am updating some Sublime Text snippets to help automate some page developing, but I am running into a bit of a hurdle. For this snippet I am currently trying to get the metrics string (based on the alt text), to do the following:
2
votes
1 answer

What scope for html.erb in Sublime Text?

I'm writing a snippet for html.erb files, but I can't understead what should I write in scope tag. When I press ctrl+shift+alt+p it shows to me "text.html.ruby text.html.basic" html.erb

test

<%= 'test' %> The snippet
Parki
  • 159
  • 9
2
votes
1 answer

Access Project Root Path in Sublime Text 3 Snippet

I'm trying to work out a way to access just the file path from the root of my project in a snippet. I can access the full file path with ${TM_FILEPATH} but I'm trying to set up a file documentation snippet that will automatically get the path to add…
secondman
  • 3,233
  • 6
  • 43
  • 66
2
votes
1 answer

Sublime Snippet: use a * character in tabTrigger

I need a tabTrigger that starts with a * character but it won't work. Already tried to escape it * but it doesn't work either. Ideas?
SenhorLucas
  • 1,337
  • 12
  • 12
1
vote
1 answer

Applying 2 regex operation in sublime text 3 snippet

I'm trying to make a snippet for sublime text 3, I want to transform the filename variable (TM_FILENAME) to uppercase and replace ".c" by "_H". I have the expressions to do it, but not at the same time. I have tried to put them next to each other,…
1
2 3 4