Sublime Forum

Copy paste code block to specific spot

#1

Hi,

Is there a trick to get a copied code block when you paste it else where on the exact same spot?

I mean when I copy a code block with only some Google tag codes changed in the block and I paste them to the previous block that has to change it moves or to the right or to the left, but almost never on the proper spot!

Thanks,

David

0 Likes

#2

if you have an exact example, that would make people know your expectation more.

0 Likes

#3

When I copy a block like this in Sublime Text and replace the exact same block on a other page with this block (only the tag code is different) you never know where the block gets placed despite the fact that is was precisely copied and pixel precise paste. It moves to the left or right and is very annoying. This is the case for any code block you copy since I ever used Sublime Text. many many years!

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXX', {'page_path': location.href.replace(location.origin, "") });
</script>
0 Likes

#4

I feel you want the paste_and_indent command as the default. https://github.com/jfcherng-sublime/ST-my-settings/blob/8bc3ff4112a27dff7c8627feaacb28f07c9a3b91/Packages/User/Default%20(Windows).sublime-keymap#L176-L178

Not perfect though.

0 Likes