<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Looking to a way to copy and paste code in a way that matches the indentation at the spot it is pasted]]></title><description><![CDATA[<p dir="auto">So one issue I’ve had with N++ for ages is the hassle it gives when I want to paste in a block of code. If the pasted code doesn’t have the same exact indentation scheme that my document has, it makes a mess and I have to go and fix each line individually.</p>
<p dir="auto">For example, here I pasted in a template of all common HTML meta tags. The source that I copied from has an indentation level of 0. I put my cursor in N++ at an indentation level of 1 (2 spaces), which is inline with the rest of the tags in my head section. I would expect N++ to “add” indentation to the lines I’m pasting so that it would all be in line with the rest of the code, but instead it puts it all at indentation level 0.</p>
<p dir="auto">Is there a known “fix” or shortcut for this? I’ve searched high and low for a while and couldn’t find anything helpful. Thanks!</p>
<h3>Pictures for reference</h3>
<p dir="auto">Before pasting:<br />
<img src="https://camo.nodebb.org/85914bca37f175c0e7f717e60797aba32d8692fe?url=https%3A%2F%2Fi.ibb.co%2FR2dx8bG%2Fimage.png" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto">After pasting:<br />
<img src="https://camo.nodebb.org/6326068846274a96e5d4fafb786870628cd839ea?url=https%3A%2F%2Fi.ibb.co%2FM2KMTZJ%2Fimage.png" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto">What I expect it to do when pasting:<br />
<img src="https://camo.nodebb.org/f9d592bcdf6b3820c2cf649b865ccce727515680?url=https%3A%2F%2Fi.ibb.co%2F7WfwHtx%2Fimage.png" alt="" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/topic/26545/looking-to-a-way-to-copy-and-paste-code-in-a-way-that-matches-the-indentation-at-the-spot-it-is-pasted</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 21:07:47 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/26545.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 14 Jan 2025 18:26:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Looking to a way to copy and paste code in a way that matches the indentation at the spot it is pasted on Wed, 15 Jan 2025 04:55:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://community.notepad-plus-plus.org/uid/33654">@VertyyBird</a> It would be simpler to select the Regular expression mode, put the 2 lines you want to find in the, “Find” field and hit Replace after typing <code>$0\r\n(new line1)\r\n(new line2)\r\n(new line3)\r\n(new line4)\r\n(new line5)\r\n(new line6)\r\n(new line7)\r\n(new lin8)\r\n(new line9)\r\n(new lline10)\r\n(new line11)\r\n(new line12)\r\n(new line13)\r\n(new line14)\r\n(new line15)\r\n(new line16)\r\n(new line17)\r\n(new lin18)\r\n(new line19)\r\n(new lline20)\r\n(new line21)\r\n(new line22)\r\n(new line23)\r\n(new line24)\r\n(new line25)\r\n(new line26)\r\n(new line27)\r\n(new lin28)\r\n(new line29)\r\n(new lline30)</code> in the “Replace” field - the <code>\r\n(new line)</code> puts the new line on the next line. I am presuming that you have to add some 30 new lines</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99151</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99151</guid><dc:creator><![CDATA[dr ramaanand]]></dc:creator><pubDate>Wed, 15 Jan 2025 04:55:53 GMT</pubDate></item><item><title><![CDATA[Reply to Looking to a way to copy and paste code in a way that matches the indentation at the spot it is pasted on Tue, 14 Jan 2025 20:17:38 GMT]]></title><description><![CDATA[<p dir="auto">There are some approached discussed <a href="https://community.notepad-plus-plus.org/topic/25295">HERE</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99139</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99139</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 14 Jan 2025 20:17:38 GMT</pubDate></item><item><title><![CDATA[Reply to Looking to a way to copy and paste code in a way that matches the indentation at the spot it is pasted on Tue, 14 Jan 2025 19:27:51 GMT]]></title><description><![CDATA[<p dir="auto">You could try and find a plugin for pretty-printing HTML. XMLTools can sort of do this, but I’ve tried it and I don’t particularly like its pretty-printing style.</p>
<p dir="auto">A reasonable alternative would be to use PythonScript, <code>import lxml</code> and read the documentation for the <code>lxml</code> standard library module to find a way to reformat HTML in whatever way pleases you most. You could even have the PythonScript script run every time you save a file, before it saves (<code>NPPN_FILEBEFORESAVE</code> callback IIRC).</p>
<p dir="auto">I have long since abandoned hope that Notepad++ will automatically indent code in any way that is both consistent and desirable, and I mostly just use regular expressions and plugins to indent things.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/99137</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/99137</guid><dc:creator><![CDATA[Mark Olson]]></dc:creator><pubDate>Tue, 14 Jan 2025 19:27:51 GMT</pubDate></item></channel></rss>