Git Product home page Git Product logo

jn-npp-emmet's Introduction

jN-npp-emmet

Add Emmet to Notepad++.

Apparently, current Emmet plugin for Notepad++ is extreme slow on big file (emmetio/npp#2). This version is much faster although I don't know where is the problem :|

Installation

  1. Install jn-npp-plugin.
  2. Copy everything in dist into plugins\jN\includes.
  3. Restart Notepad++, or just start it if it is already closed.
  4. Keymap and other settings would be generated to %appdata%\Notepad++\plugins\config\. After changing the settings, restart Nodepad++ to take effect.

Config

All config files are placed in the config directory: %appdata%\Notepad++\plugins\config.

emmet.keymap.json

{
  // The order of key combination doesn't matter
  "encode_decode_data_url": "Ctrl+Shift+I",
  "prev_edit_point": "Ctrl+Alt+Left",
  "next_edit_point": "Ctrl+Alt+Right",
  ...
  // Disable the action with `null`. You can still execute it with emmet menu.
  "insert_formatted_line_break_only": null,
  "insert_formatted_line_break": null,
  "balance_inward": "Ctrl+Shift+D",
  ...
}

emmet.menu.json

[
  {
    "type": "action", // action, submenu, separator
    "name": "expand_abbreviation",  // the name of the action
    "label": "Expand Abbreviation"  // if the item is lack of .label, it will use .name as fallback.
  },
  {
    "type": "separator"
  },
  {
    "type": "action",
    "name": "encode_decode_data_url",
    "label": "Encode\\Decode data:URL image"
  },
  ...
  {
    "name": "Numbers",
    "type": "submenu",
    "items": [  // the items in the submenu.
      {
        "type": "action",
        "name": "evaluate_math_expression",
        "label": "Evaluate Math Expression"
      },
      {
        "type": "action",
        "name": "increment_number_by_1",
        "label": "Increment number by 1"
      },
      ...
    ]
  },
  ...
]

emmet.settings.json

{
  // setting to false will make tab working in all file types
  "enableTabExpensionByFileType": true,
  // "txt", "php", "c", "cpp", "cs", "objc", "java", "rc", "html", "xml", "makefile", "pascal", "batch", "ini", "nfo", "user", "asp", "sql", "vb", "js", "css", "perl", "python", "lua", "tex", "fortran", "bash", "flash", "nsis", "tcl", "lisp", "scheme", "asm", "diff", "props", "ps", "ruby", "smalltalk", "vhdl", "kix", "au3", "caml", "ada", "verilog", "matlab", "haskell", "inno", "searchresult", "cmake", "yaml", "cobol", "gui4cli", "d", "powershell", "r", "jsp", "coffeescript", "json", "javascript", "external"
  "enableTabExpensionUnder": ["html", "css"]
}

Emmet customization

Emmet allows you to change its behavior through 3 JSON files: snippets.json, preferences.json, and syntaxProfiles.json. In jn-npp-emmet, they would be read from the config folder with filename prefix emmet. i.e. emmet.snippets.json, emmet.preferences.json, and emmet.syntaxProfiles.json.

FileStream.js

http://hp.vector.co.jp/authors/VA033015/fsjs.html (offline)

http://ftp.vector.co.jp/46/91/2590/fsjs1081221.zip

I randomly found this with Google.

Todos

  • Make license compatible with jN's zen_coding script.

Speed test

test.html: L4533, L4680, L4

  • better-matcher: 115, 688, 31
  • zen-coding: 105, 679, 26
  • quick-match: 67, 20, 34
  • quick-match-2: 72, 27, 26

Changelog

  • 1.2.2 (Apr 9, 2018)
    • Update emmet. Fix infinite recursion bug.
    • Fix: close autocomplete dialog after execution.
    • Fix: TypeError when calling endsWith.
    • Add: load syntaxProfiles. Switch to emmet.loadUserData.
    • Change: the hotkey of Balance (outward). Ctrl + D -> Ctrl + Alt + D.
  • 1.2.0 (Mar 10, 2018)
    • Update eslint to v4.18.2.
    • Change: dist folder structure. Libraries are put inside dist/emmet subfolder.
    • Add info header to dist/emmet.js.
    • Fix: file related actions doesn't work.
    • Fix: dialog service.
  • 1.1.2 (Nov 30, 2017)
    • Update emmet to v1.6.3.
    • Fix: single open tag is not handled correctly.
  • 1.1.1 (Dec 23, 2016)
    • Update emmet to v1.6.1.
    • Fix: scrollbar doesn't scroll when setting caret pos.
  • 1.1.0 (Jul 9, 2016)
    • Update emmet to v1.6.0.
    • Drop Grunt.
    • Drop submodule, use npm to manage dependencies.
  • 1.0.1 (Apr 12, 2016)
    • Fix infinite loop bug. #7
  • 1.0.0 (Apr 3, 2016)
    • Use eight04/emmet@dev-quick-match-2.
    • Drop MenuCmds.js (#6)
    • Use notepad++ command for tab insertion.
    • Use cache to speed up action.
    • Fix dialog bug in Windows 10.
    • Add option: disable tab expension if not working with HTML or CSS files.
  • 0.2.0 (Feb 26, 2016)
    • Add readBinary feature.
    • Temporary fix with read file API. Update image size should work now.
    • Add User defined menu. Lacated at %appdata%\Notepad++\plugins\config\emmet.menu.json
    • Rewrite the dialog module, which can remember the last position and size.
  • 0.1.0
    • Initial release.

jn-npp-emmet's People

Contributors

arkadiuszmichalski avatar eight04 avatar tomasz1986 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jn-npp-emmet's Issues

Last jN 2.2.185.2 and Wrap With Abbreviation generate error

After update jN to last version I get error when second time invoke Wrap With Abbreviation, first time works correct (show dialog box) but next time always throw.
Error info:
'handle.document' jest pusty lub nie jest obiektem line: 128, pos: 7
It came from jN\includes\emmet.js.
When I back to previous jN 2.1.181 version (from 2016) problem not exist.

Platform detial:
Windows7 64-bit
Notepad++ 7.5.5 32-bit
jN 2.2.185.2
jN-npp-emmet 1.1.2

Add some infos to main project file

Can you add to plugins\jN\includes\emmet.js some comments at the begining with jn-npp-emmet version, emmet version, jN version, author, project adress and other usefull info? This can be help full for opening new bugs.

Less depending on the other files

This require("includes/MenuCmds.js"); is really needs? Only one times used MenuCmds.EDIT_INS_TAB(); but we must have this file in includes folder (its came from jN plugin, not yours, plus xxx scripts which are usually removes or disables). You should inform what files are neccessary in your install guide.

Wrap with Abbreviation return error

On Win7 64bit, IE11, NPP 6.9 + last jN and your Emment I see that when run "Wrap with Abbreviation" I get error... I try figured out what is going on and catch this line in Dialog.js:
20 styles.styleSheet.cssText = this.cfg.css || '\nbody {overflow: auto;}\n';
so change them to:
20 styles.textContent = this.cfg.css || '\nbody {overflow: auto;}\n';
and works.

Btw., is there any solution to remember last position and sizes of this window? Every time when I run this command I get default window (somewhere in the middle in my screen)?

Hang action around some unstandarized html tags at the begining

Small testcase:

<@include "aaaa">expand hang
expand hang
<div>
expand OK
</div>
expand OK
<@include "aaaa">
expand OK

but if I add one line at the begining then all worsk fine

expand OK
<@include "aaaa">expand OK
expand OK
<div>
expand OK
</div>
expand OK
<@include "aaaa">
expand OK

Update to Emmet 2.0.0

Any plan to migrate this plugin to Emmet 2.0.0 or version 1.6.3 will be the last?

Image actions not work

Option 'Update Image Size' works in NPP? I try with some absolute and relative path but without any result. Even when I put image file in the same folder where my html file and use nothing happend. The same is for "Encode\Decode data:URL image".

The same problem like before #1 (comment) , after fix was fine but now see once again update image size or encode/decode not work. Looks like it's Emmet fault, not new jN version.

I don't know what old version I used (some from 2016), but in this version all this command works fine.
0.2.0 (Feb 26, 2016) << here you fix this bug.

Emmet preferences config not working and get notice box!

Hi,

I type "mr" and using key trigger (Ctrl + `) many time, I get this:

1

I want update some Emmet preferences (https://docs.emmet.io/customization/preferences/) inside:
%appdata%\Notepad++\plugins\config\emmet.settings.json but it not work, ex:

{
	"preferences": {
		"css.valueSeparator": ":",
		"css.propertyEnd": "; "
	},
	"enableTabExpensionByFileType": true,
	"enableTabExpensionUnder": ["html", "css"]
}

Thank so much!

P/S: with long css file, it take some seconds for Emmet working!

Ctrl+D Hotkey conflict

The default hotkey for "Balance (outward)" i.e. Ctrl+D is conflicted with NPP's "Duplicate line" command. Use Ctrl+Alt+D instead.

Still slower comparing to previouse Zen Coding

I make more test and see that this version is significantly slower when comparing to Zen Coding 0.7 + NppScripting (older version of jN). Still can be downloaded from http://docs.notepad-plus-plus.org/index.php?title=Plugin_Central#_188
For bigger files the differences are clearly in favor of the older implementation (especially for Expand Abbrevation). I check this for files with 500, 1000, 1500, 2000 lines and run command on last line. In future is there any chance to improve speed?

Run Emmet commands via other plugins or add them to NPP context menu

Emmet has own menu (in old style) so we can't add his options to NPP context menu or run them with other plugins. I test this variants without any positive results:

  • NPPExec, use npp_menucommand Emmet|Wrap With Abbreviationd, find this item but not invoke
  • Python Script, use notepad.runMenuCommand('Emmet', 'Wrap with Abbreviation'), like above, find this item but not invoke
  • editing contextMenu.xml file without success

The only solution what I found is write script for WSH (.js or .vbs) with send keys (shortcut for Emment commands) and run this script with above tools. But it needs to define shortcut for any actions or other scripts (created via jN) which is inconvenient.

Any advice how can I solve this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.