3 Beginner Questions
-
2 questions.
I’m practicing HTML. The document is saved as .html. NP++ is correctly providing element colors and closing tags. However, if I start to type a tag (for example) <cit, NP++ will invariably offer the correct full tag name in a drop-down. I hit ‘enter’ and <cit becomes <cite. But why doesn’t NP++ close the tag instead of me having to type the ‘>’? Is there a setting that I’ve missed?
I’ve manually indented the page as following:
<html>
<body>
<p>Now when I type the text of this paragraph, I would like all the text to be left justified in line with ‘Now’. Instead, the text runs to the left margin as in this post. Is there not a setting to keep text justified following a tag?Lastly, I can’t find a searchable Help file?
Thanks,
Mark
-
Preparing quality help file/system is lots of work. NP++ like many other free projects avoid this work.
Forums like this are sort of a replacement.NP++ language support is mostly limited to syntax highlighting, that is coloring.
Auto indentation is mostly the same for all languages except for selection of tabs or spaces.
Your request to indent by html tag is very specific for html so it is irelevant as common feature. I doubt that you can even come to an agreement with other html developers about the “correct” way to indent.I don’t use auto completions (I always disable them) so I can’t really comment about the auto closing of ‘>’.
As far as I remember the logic is to add the auto closing symbol as soon as the opening symbol is typed and put the cursor between them.
Adding closure after you type something requires different and rather complicated logic. -
I changed the shortcut for Launch in Firefox to Ctrl + F12. Click Run/Modify shortcut, the screen confirms the shortcut is in place and there are no conflicts. Click the cursor in an active NP++ HTML code page, do Ctrl+F12 and nothing happens.
Click Menu, Run/Launch in Firefox and launch occurs.
What am I missing?
-
For the
<cit
… auto-completion, if you haveEdit > Preferences > Auto-Completion > ☑ Enable auto-completion on each input
enabled (which it sounds like you do), and if you have the Auto-Insert matched pair set so that one of the three pairs is<
and>
, then if you type<
it will automatically add the ending
<>
then continue typing cit
<cit>
and after the
t
, it will pop-down the menu where you can hitENTER
to auto-completecite
:<cite>
It’s mildly surprising that they’ve got the round, square, and curly brackets with the pairs pre-defined, but not angle-brackets, given the propensity for angle brackets in common languages like HTML and XML… But typing two chararacters into the matched-pair list is sufficient to remedy that oversight.
Unfortunately, it’s enabled globally, not per-language, so if you shift often between HTML and C (or some other language) where the angle-brackets are greater-than and less-than comparisons, it would become quite inconvenient. Make sure you know what you’re doing.
You might also be able to edit the HTML auto-complete file (the
c:\program files\notepad++\plugins\APIs\html.xml
, or similar folder relative to your notepad++ install directory) to include the closing angle-bracket. -
Thanks, the tag auto complete works great. No problem, at this time, with the global effect. I’m on a long-term code learning curve starting at the bottom with the simplest–HTML. By the time I get to something that remotely cares about ‘greater than’, there’s a good chance that someone just might make the auto completion language specific.
I don’t suppose you see where I went afoul with my Run shortcut posted above?
-
Not so fast.
When the matching <> pair are added for #1, NP++ does precisely as you stated. However, it then stops automatically adding the closing tag despite same still being checked.
Given (apparently) the choice, I’m reverting to how I used the autocomplete previously. The auto enter of the closing tag is more time efficient vs. auto adding the initial tag’s closing >.
-
I find the autocomplete to be more of a nuisance than help. If it closes the tag after the cursor, you just have to arrow over the closing angle bracket anyway and if it closes to the left of the cursor, and you want to put in other attributes, you’re arrowing back.
If you’re working extensively in HMTL, then you should try either the Zen Coding - Python or the Emmet plugin. Emmet is just Zen Coding renamed and slightly updated, but I find Emmet to be a bit more laggy then Zen. You can input long strings of css-like identifiers and the plugin will expand all of them to full tags and reasonable indenting. table>tr5>td6 will be expanded to a decent start on a table. For me, this is better than autocomplete.
I’d also recommend html tag for finding matching tags and selecting everything between them.Sorry I can’t help you with the shortcut key for opening in a browser, that should have worked. You can check the “shortcuts.xml” file probably located in %appdata%\Notepad++ and see if anything looks wonky.
Good Luck
-
@MarkInEvergreen said:
I changed the shortcut for Launch in Firefox to Ctrl + F12. Click Run/Modify shortcut, the screen confirms the shortcut is in place and there are no conflicts. Click the cursor in an active NP++ HTML code page, do Ctrl+F12 and nothing happens.
Click Menu, Run/Launch in Firefox and launch occurs.
What am I missing?
Since you’re not using a webserver to serve your files, why not open the file directly in the browser?
Just drag and drop the html file into the browser window.
Refresh the page when you’re done editing the file in NPP.
CTRL+F5 force refreshes the page, omitting the caching behaviour of browsers.NB: Pure HTML + CSS pages don’t need a webserver to serve the page as there’s nothing to pre/process on the server for these barebone html pages. All the rendering is done in the browser.