See development branch for latest development
- a plugin for Sketch
Tested with Sketch v. 45.1
⌘-⎇-R
enter
, and profit!⌘-⎇-F
enter
, and profit!Protip: if you skip deselecting, if will look through the ones selected
Also: ⌘-enter
is faster then clicking the second button
Regular Expressions are very powerful. To learn more and try some more, visit regexr.com. Some worthy mentions:
.+
item (\d+) (\w+)
will match item 57 flower
with $1
as 57
and $2
as flower
$1-icon $2
would give flower-icon 57
Ordered numbers? Dimensions? Find 'n Rename got you covered!
%N
in the replacement box, you will get an ordered number, starting with first selected layer as nr 1!%-N
%n
makes the counting start as zero :)%NN
%I
and %i
%k
, or %K
for something like Shape/Group/Artboard/Page/Slice/Bitmap/Text/Symbol/SymbolMaster/Pathlocked
,hidden
, as well as shape
etc are available%x
, %y
, %w
, %h
will do?%p.t
for title/name, or whatever other flag you want!Write :
in the end of a search expression, followed by any of the following, stacked how many times you desire, to navigate the layer tree:
>
all children<
parent2
third layer in parent (counting starts at 0)2n
every other layer+1
layer after-4
layer four layers before
This means you could write something like this: input (\w+):<+1>3n+1
and in the replacement box write $1 label decoration %I
to rename every third (skipping the first) layer, in the group right after the group containing the selected field. Better yet, it does so even if you would have tens (or thousands...) of those "named input fields with labels having lots of strange decoration"... Ok, but seriously, pretty handy.You can transform string cases using flags when replacing. Try writing the following in the replace box: \T $1 this becomes \U uppErcase \E or What?
, it should give you ThisBecomes UPPERCASE or What?
;
\L
lowercase, ie. "make the following characters lowercase"\U
UPPERCASE\C
camelCase\K
kebab-case\E
end, ie. stop changing the case\S
snake_case\T
TitleCase\W
word caseUse case: You've got a bunch of similar structured groups with layers inside of them. All the groups are just called "Group", however the first layer inside has the right name! You would like to rename the parent group to the layers name, and then maybe rename all the layers. No problem with LayerRenamer!
cmd-alt-F
, and write Grou
... + hit enter
to select all layers whose name contains "Grou" (ie. Group 1
)cmd-alt-R
, keep the first box empty (to choose the whole name), and in the second, write icon %>0.t
, hit enter
%
, flag/start navigate, >
children, 0
first, .t
title/name)cmd-alt-F
, write :>0
(:
start navigate, >
children, 0
first), and hit cmd-enter
to start the filter from the currently selected groupscmd-alt-R
, leave first empty, put image
or something in second, hit enter
More advanced:
Use case: The folder/layer structure you've got in the sidebar could be made to closely resemble the actual markup or css, etc. Together with the plugin, you'll also get an action called "Copy page outline". Just select a parent layer or deselect everything (to export the whole page), then run the action. This is very much just a hint of what to come, nevertheless handy as it is.
.sketchplugin
fileLeave the search/find field empty to match everything
Leaving the expression field empty defaults to !path && !artboard
⚠️ Seems like you can't select both layers and their containing group simultaneously. Because of this, if the group is matched (or combined shape container for that matter), it won't match anything inside of it. Add expression !group (or !shape) to search its content instead.
Feel like adding / fixing something? Create an issue and/or send a pull request! :D
If you enjoy this plugin, please consider buying me some oatgurt. You can also drop me a line or follow me on Twitter. Got an idea for a new plugin? Send me a tweet!
Created by Leonard Pauli, in january 2017, after getting inspired by the RenameIt plugin. Feel free to fork or send pull requests :)