Sublime text overrides Emmet snippets - html

My problem is simply that some of the Emmet snippets and abbreviations get overridden by the Sublime Text 3 default tags - for example, when I type 'link' and press TAB I don't end up with:
<link rel="stylesheet" href="">
as stated in the Emmet documentation (https://github.com/emmetio/emmet/blob/master/lib/snippets.json).
Instead I get:
<link rel="stylesheet" type="text/css" href="">
This which is the Sublime Text 3 default. The same goes for 'img' and a few other useful tags, and now I'm wondering: why is that and what can I do "fix" it? I want the Emmet snippets to have "first dibs", and not the other way around.

Open Preferences -> Package Settings -> Emmet -> Settings-User and add the following content (it should be empty upon opening it for the first time):
{
"remove_html_completions": true
}
Save the file, then restart Sublime.
For a look at all the options you can customize, open Preferences -> Package Settings -> Emmet -> Settings-Default. If you see anything that you'd like to change, copy the setting to Settings-User, making sure there's a comma , at the end of each line except the last one.

Just for the record I want to convey that I've finally found the solution to my problem. It would seem as if Emmet has this built in setting where you can specify in which scopes you want your code editors' defaults to override Emmet, and as a default this is set to "text.html". Hence what I needed to do to resolve my issue was just to change this setting to none by simply typing
{
"disabled_single_snippet_for_scopes": ""
}
In the Emmet user settings. Cheers!

It’s pretty hard for Emmet to play nice with native Sublime Text snippets due to lack of API. But Emmet tries to guess what you want to do as much as possible.
By default, when you type something in ST that matches native snippet you’ll likely see an autocomplete popup with snippets proposals. Which means you’ll likely want to expand native snippet by pressing Tab key. On the other hand, most Emmet abbreviations doesn’t look like predefined snippet, e.g. you won’t see autocomplete popup when typing abbreviation.
Thus, Emmet doesn’t expand abbreviations by Tab key when autocomplete popup is visible. It seems like a decent solution for native snippets problem (ST API can tell if popup is visible). I’m pretty sure in your link example there was autocomplete popup visible.
For hardcore Emmet users it’s possible to disable this behaviour and force Emmet to always expand abbreviations by Tab, event if autocomplete popup is visible. To do so, go to Preferences → Settings-User and add the following option:
"disable_tab_abbreviations_on_auto_complete": false
See https://github.com/sergeche/emmet-sublime/blob/master/Preferences.sublime-settings#L29

Related

Why does my text editor suggest "XXX" when editing html

When i type in "x", my text editor, atom.io, suggests "xxx". If i select it, it simply displays
<!-- XXX: -->
What does it mean or stand for?
This is a snippet provided by Atom. More about snippets: http://flight-manual.atom.io/using-atom/sections/snippets/
More about the meaning of XXX: What is the meaning of #XXX?
It's caused by the "autocomplete" feature in Atom. To turn it off, go to Atom -> Preferences, select "Packages" on the left, scroll down to "autocomplete-snippets" and click the Disable button.
This will disable the autocompletion of all "snippets" but auto-completing of things like variable names etc will still work.

Auto Completion Closing tags in html notepad++

I have just started using notepad++. I wanted to know if there is a way to create a closing tag automatically in HTML, For example:
If I type:
<body>
It will close the tag automatically:
</body>
I tried to adjust the Settings/Preferences/Auto-Completion, And I enabled the HTML/XML close tags, but that didn't work, Does anyone have a solution?
Thanks.
I thing that You looking for plugin TextFX Settings. To enable it go into menu:
TextFX -> TextFX Settings -> chek option 'auto close XHTML tags'
If You don't have installed this plugin, do this:
Click Plugins -> Plugin Manager -> Show Plugin Manager
On the 'available' find and select 'TextFX Characters'
Click Install and restart Notepad++
Enable the 'auto close XHTM tags' as described above.
And do not forget to set the type of document to HTML.
If you have done everything listed, and it still doesn't work. Try going to the "Language" (next to the settings part) and turn html on. This was the problem for me. Now it works fine for my with the autocomplete.
As fas as I remember (when I used windows machine), there was common problem with html tags.
Try to uncheck all checkboxes in Preferences when on the list (on the left side).
Next, hit close.
Then open it again and check only html/xml close tag checkbox.
In my case it helps.
This question is exactly answered by Noha Kareem, here:
Auto close of html tags and php tags in notepad++ and a semicolon at the end of php lines.
I hope this helps

Format Code In MonoDevelop

I am using MonoDevelop on Mac to write MonoTouch apps. Automatica code indenting/formatting works great while I am typing.
The problem is that when I copy and paste code snippets, in many cases I lose the formatting and lines are combined together, indenting is lost, and it is a huge pain to implement the tabs, spacing, and line breaks manually. Is there anyway I can use a command in monoDevelop to automatically indent and apply the formatting to existing code.
I thought maybe Edit|Format|Format Document/Selection would work, but these commands don't have any affect on the code at all.
Any help?
To format the entire document in one keystroke: control-I
To format a selection: Edit->Format->Format Selection
To customize the formatting: MonoDevelop->Preferences->Source Code->Code Formatting
You actually need to select all your text, and then go to Edit->Format->Format Document. It doesn't seem to work otherwise.
For me on macOS, the shortcut for "auto-format" is CTRL + i.
You can change the shortcut if you want. To change it, go to Preferences -> Key Bindings, then type "format" in the search box and edit the "Format Document" shortcut/key binding.

Surround selection with html tag

Is there any eclipse shortcut/trick/plugin/whatever that will allow me to select a section of text and surround it with an arbitrary html/xml tag when using the html editor.
Something like this textmate video
EDIT: not sure If my Eclipse setup is the same as yours, but...
I have the HTML Editor installed, and if I switch to the Java perspective, I can use Edit -> Quick Fix and then choose Surround with new element to get exactly the effect in your video. (On a Mac, the shortcut for this is ⌘1).
Hope this is helpful.
In the C++ editor, you can try Source -> Surround With... -> Configure Templates to add the tag you want.
The following works and allows for entering random/arbitrary tags:
Select the desired text that you want wrap.
Go to 'Edit > Quick Fix' or press 'Ctrl + 1'.
In the new menu that appears select 'Surround with new element'
However there is an annoyance, please upvote Bug 494169

How to use hotkey in notepad++ webedit plugin?

How to use hotkey in notepad++ webedit plugin?
what are the keyboard shortcuts to press to insert html tags??
Install the "webedit" plugin. Which will allow you to add custom shortcuts.
(Plugins > plugin manager).
After the program restarts, go to plugins > webedit > edit config. And either change an existing one or add a new one, (example &A= | ). You can remove the shortcut icons if they annoy you.
Then you go to, settings, shortcut mapper. Right now, ctl+enter is set to word completion I believe. Change that to something else (on main menu). Then go to the plugin commands tab and find your command and set it to ctl+enter. Then restart, and it should work.
http://www.graphicdesignforum.com/forum/showthread.php?t=52719
All keyboard shortcuts can be assigned/modified using the standard Shortcut Mapper. For more information see the WebEdit.txt help file.
That's what it says in the plugin description, at least.
Setting>Keyboard Shorcut>Plugins commands
then go to
- WebEdit - A
- WebEdit - Div Class
- WebEdit [...]
and select shortcut
I see that someone sort of answered it but I have a few things to add.
When you install WebEdit, go to the config as stated.
Go down to the [Tags] section.
Underneath all the comments, add the shortcut you want.
Here is the syntax:
<Tag>=<Replacement>
For tag, put what you want to replace. For example 'h1' (dont use the carrots).
put the = sign.
Then for replacement, put what you want "h1" to be replaced with.
Here is an example of my h1 hotkey:
h1=<h1>|</h1>
What the pipe character does is tell npp where to put your cursor after the replacement.
So this is how you use it now:
type h1, then press 'Alt+Enter'(by default, you can change this too), then BAM, your 'h1' will be replaced with:
<h1></h1> and your cursor will be sitting between the tags.
You could also do h1=<h1>|\n</h1> which would print the same thing but with a line break.
You can do some pretty awesome stuff with it. Saved me SO much time once I got used to it. I never type without it anymore lol.
Here is what my personal setup looks like under the [Tags] section (and I commented everything below starting with the m=module because it was messing with my 'p' tag and I didn't care anyways.
begin=<!DOCTYPE html>\n<html>\n<head>\n</head>\n<body>\n\n|</body>\n</html>
h1=<h1>|</h1>
h2=<h2>|</h2>
h3=<h3>|</h3>
h4=<h4>|</h4>
h5=<h5>|</h5>
h6=<h6>|</h6>
html=<html>\n|\n</html>
script=<script type="text/javascript">\n\t\n</script>
link=<link rel="stylesheet" type="text/css" href="|">
a=
div=<div>
divclass=<div class="|">
divid=<div id="|">
divend=</div>
p=<p>|</p>
ul=<ul>\n\t|\n</ul>
li=<li>|</li>
header=<header>\n\t|\n</header>
nav=<nav>\n\t|\n</nav>
section=<section>\n\t|\n</section>
article=<article>\n\t|\n</article>
aside=<aside>\n\t|\n</aside>
footer=<footer>\n\t|\n</footer>
Remember one thing; after you edit the WebEdit, you have to restart NPP before the new tag will work.
I know this is a bit old, but you can use the Emmet plugin to speedup your HTML and CSS typing. you can customize your snippets to make any text.
It cames whith dozens of snippets already, you just have to type it and then hit Ctrl+Alt+Enter.
You can find the file to edit in this path:
C:\Program Files (x86)\Notepad++\plugins\EmmetNPP\emmet\snippets.json
It's easy to spot what you have to do.
On the plug-ins menu you will find all options that this plugin offers.
Experiment it like typing html:5 and then hit Ctrl+Alt+Enter.
Or even this ul>li*4>a[href=page.php?id=$]{page $}.
You will be amezed.
Check this online documentation for keyboard & mouse shortcuts