I know how to align and distribute layers in various ways, but one thing I can't seem to find anywhere is if it's possible to center a layer inside the viewport while I'm zoomed in. I hate having to zoom all the way out to find where the layer is and move it to where I need it and zoom back in.
There is no way to do it. Although a workaround to get the layer to the currently zoomed area would be to show the ruler in your workspace (be sure to set the units to pixels to make it easier to position your element, this can be done by right clicking any of the axis of the ruler and setting it to "pixels"), then you could see where you exactly are zoomed in, then in the layers panels select the layer you wish to position in your viewport, hit ctrl + t (cmd + t on mac) to bring up the transformation controls and in the first two fields of the top tool bar you would see the x and y ones where you would put the first numbers that you see on the respective ruler's axis, after you set the two fields, hit ctrl+enter to finish the transformation and you would have the layer in your viewport, if you wish to center it you could do it manually by calculating pixels taking references by the amount of pixels showed in the axis of the ruler and the width or height of your layer, this could be annoying but it's the only way of doing it perfectly.
It's possible to do with a script (works in CC2015.5+). This script pan the view to the actively selected layer:
var ref = new ActionReference(); ref.putProperty(stringIDToTypeID("property"), stringIDToTypeID("zoom")); ref.putEnumerated(charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt")); var zoom = executeActionGet(ref).getDouble(stringIDToTypeID('zoom')); var bounds = activeDocument.activeLayer.bounds; var x = (bounds + (bounds - bounds) / 2) * zoom; var y = (bounds + (bounds - bounds) / 2) * zoom; var panZoomDescriptor = new ActionDescriptor(); panZoomDescriptor.putDouble(stringIDToTypeID("x"), x); panZoomDescriptor.putDouble(stringIDToTypeID("y"), y); panZoomDescriptor.putDouble(stringIDToTypeID("z"), zoom); panZoomDescriptor.putBoolean(stringIDToTypeID("resize"), false); panZoomDescriptor.putBoolean(stringIDToTypeID("animate"), false); executeAction(stringIDToTypeID("setPanZoom"), panZoomDescriptor);