Write the editor by yourself-Lumia Sidebar

Source: Internet
Author: User

It seems that we are imitating others' editors from the very beginning. I don't know if this is necessary, but sometimes we feel that there is no need to create another wheel, or we should consider the features we want into the system, not like others?

Final Effect

The Mock atom editor is coming to an end here.

Makefile

It may be better to write the script, but there is still noMakefileIt makes people feel good.

The code is still on github. It may be a little too large and still goes throughzipCompressed.gitProcess

zip -r app.nw * -x ".git/*"

The zip file does not contain a specific path.

nw = /Applications/node-webkit/node-webkit.app/Contents/MacOS/node-webkitdefault:    zip -r app.nw * -x ".git/*"    @echo "done"    $(nw) app.nw

It seems that cross-platform is not considered here, but I think this is not a problem. The problem is solved by node-webkit and relies heavily on a library. (Reprinted and retained: Write the editor by yourself -- Lumia Sidebar)

Package node_modules?

I have experienced similar things before using python, so it is good whether you say it or not, and the size is not very large.

 "dependencies": {    "underscore": "~1.6.0",    "jquery": "~2.1.0",    "coffee-script": "~1.7.1",    "backbone": "~1.1.2",    "string": "~1.8.0",    "jade":"~1.3.1"  }

The main library is the above.

Lumia Sidebar

Constructing a sidebar is relatively simple for HTML, and the atom style is used here .. Although it can be written, it seems unnecessary. The only thing you need to add is ''# file' and a css.

#files {         font-size: 11px;      }

Next

  • Traverse files
  • Get File Name
  • Open a file

The first two things have passed through the node-webkit example. What we need to do is to open the file.

 var folder = new folder_view.Folder($('#files'));    folder.open(process.cwd());    folder.on('navigate', function(dir, mime) {        if (mime.type == 'folder') {            folder.open(mime.path);        } else {            onChosenFileToOpen(mime.path);        }    });

That is, to determine whether it is a directory. When we click on a file, open the file.

onChosenFileToOpen();Is the function used to open the file to the editor.

What else?
  • Add package management
  • Add Extension
  • Added terminal functions
  • Fix bugs?

What about last? Become another sublime text? Another atom?

Missing parts
  • No advantages of nodejs
  • No good use of webkit
  • Far from the underlying system
Core features:

An editor should have its own characteristics before developers can use it. If the editor is no different from the editor, then they can use a better editor, with better community support. Instead of meeting the needs of the masses and the needs of the masses, some people will develop better and have better competitiveness.

In the early days, Vim was lighter than Emacs, but Emacs was much more powerful than Vim, so the two groups were separated.

In other words, Sublime is a lightweight editor. Compared with intellij idea, we also have other options to compare textmate and atom, because sublime is charged.

Intellij idea is a better choice for people who need to refactor. This is not available in general editors, but for those who write other languages, QT may be a better answer. They need cross-platform support and other better support. Different people have different requirements for IDE, and IDE is also targeted, compared with the non-targeted editor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.