Code Monkey home page Code Monkey logo

coolwanglu / vim.js Goto Github PK

View Code? Open in Web Editor NEW
4.5K 139.0 314.0 64.41 MB

JavaScript port of Vim

Home Page: http://coolwanglu.github.io/vim.js/emterpreter/vim.html

License: Other

Makefile 1.75% CSS 0.04% HTML 0.03% Shell 0.15% C 51.62% Vim Script 43.34% Awk 0.10% Perl 0.28% PostScript 0.32% Smalltalk 0.13% Emacs Lisp 0.15% Erlang 0.14% Mathematica 0.17% NewLisp 0.19% Ruby 0.14% SystemVerilog 0.14% C++ 0.59% Python 0.01% Objective-C 0.03% Prolog 0.70%

vim.js's Introduction

Vim.js : JavaScript port of Vim

A Tool/Toy for Non-Beginners

by Lu Wang

Try it online

Variations

Recommended browsers: Firefox, Chrome, IE

Vim.js Features

  • ASM.js enabled
  • Persistent ~/.vimrc
  • Execute JavaScript from Vim.js
  • Read local files
  • Read files from Dropbox

Run :e $VIM/vimrc for more detail.

Vim Features

The online demo is built with the small feature set (--with-features=small), with also a few from the normal set. Run :version to check details. (--with-features=normal is too large and too slow for online usage.)

Some features can be requested via pull requests, some are not intended to be included. Please discuss with me first before you work on a PR.

Tips for hackers

  • Need emscripten with ASYNCIFY enabled
  • Need GCC & cproto (maybe) — Sometimes you need to run make proto when you see errors about 'undeclared variables/functions/structs' or '***.pro' file not found
  • Read build.sh
  • The building process might take lots of memory

Contact

Lu Wang coolwanglu(a)gmail.com — please do not expect a prompt response.

License

Read LICENSE

vim.js's People

Contributors

coolwanglu avatar emnh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim.js's Issues

Cannot compile in XUbuntu 14.04.2 LTS

The following error message appears repeatedly after typing make:

vim.h:398:61: fatal error: auto/osdef.h: No such file or directory
 # include "auto/osdef.h" /* bring missing declarations in */

Files not found on compile

os_web.pro file not found
gui_web.pro file not found

./proto.h:248:13: fatal error: 'gui_web.pro' file not found
#   include "gui_web.pro"
            ^
1 warning and 1 error generated.
ERROR    root: compiler frontend failed to generate LLVM bitcode, halting

Don't catch keyboard events outside vim canvas

If you want to embed vim.js on a bigger page, you need to be able to use keyboard outside vim canvas. Currently the page listens on document and uses preventDefault. I will send a pull request to fix this.

Error while building

I tried to compiled the vim.js but got stuck at

checking for tgetent in -ltinfo... no
checking for tgetent in -lncurses... no
checking for tgetent in -ltermlib... no
checking for tgetent in -ltermcap... no
checking for tgetent in -lcurses... no
no terminal library found
checking for tgetent()... configure: error: NOT FOUND!
      You need to install a terminal library; for example ncurses.
      Or specify the name of the library with --with-tlib.
ERROR:root:Configure step failed with non-zero return code: 1.  Command line: ./configure --enable-gui=web --with-features=small --disable-selinux --disable-xsmp --disable-xsmp-interact --disable-luainterp --disable-mzschemeinterp --disable-perlinterp --disable-pythoninterp --disable-python3interp --disable-tclinterp --disable-rubyinterp --disable-cscope --disable-workshop --disable-netbeans --disable-sniff --disable-multibyte --disable-hangulinput --disable-xim --disable-fontset --disable-gtk2-check --disable-gnome-check --disable-motif-check --disable-athena-check --disable-nextaw-check --disable-carbon-check --disable-gtktest --disable-largefile --disable-acl --disable-gpm --disable-sysmouse --disable-nls --with-modified-by=Lu Wang --with-compiledby=Lu Wang at /src/vim.js

Havent changed anything in the build.sh. Any idea how to pass this tgetent thing?

So great repo, why update is stop?

Thanks for every distributor, bring so great app,
Now, I expect a interesting using journey.
Thanks to everyone.

But why,
vim is hot, web is hot, js is hot, node is hot,
However,
why does vim.js developing is so cold?
I am so puzzled with this,
Would someone thinks like what I thought?
Would someone discusses on this issue?

Delete doesn't work

Can't delete the characters using "Delete" button in Mac.

I am using Chrome 31 on Mac OS X.

How would one write an autocomplete handler in JavaScript?

Vim can normally shell out to any program to assist in autocomplete. How can we write such a program in JavaScript, running in the browser, that acts as a program that Vim can "shell out to" in order to determine the completion list?

How to compile small vim.js?

How did you get a small file of only 5.8 MB?
I compile using emscripten 1.2.9 SDK and build.sh using the features you set but I get a 122 MB file.

I tried running the closure compiler to minify it, but it runs out of memory even with java -Xmx2048m.

With emcc -O2 I get a 33 MB file, but then it doesn't work.

`Ctrl` doesn't work

As far as I can see by default only Esc is supported to exit to normal mode (or maybe I'm missing something). But in vim C-c and C-] are doing same task (and they are much more usable). Is there any limitations why C-c and C-] are not implemented?

Extensions Design

This is only a draft, any ideas are welcome.

Motivation

Seems that lots of people are expecting web integrations in vim.js, indeed it might be a good combination for lots of different services, but they might not be necessary for all the users.

A better solution might be to expose enough interface such that people can write and enable only the extensions they need. somewhat like vundle.

Run JavaScript inside Vim.js

Vim script is powerful and widely used, but may be it's too large/slow on vim.js. But sometimes Vim script does not make sense as we have a native JS engine behind it, and javascript is more powerful.

The easiest way of implementation is to hijack :!, it makes sense, easy to use and implement. It's my preferred way, but maybe it will be conflict with existing plugins (suppose that vim script is supported in the future) due to the semantic meaning. But anyway there's no shell (so far) in emscripten and :! won't work anyway...

Otherwise we need to define a new command other than :!, which requires further modification to the original Vim, and I'm kind of against it.

Common functions can be defined inside the vimjs JS Object.

Load external JavaScript

:!vimjs.load_js(url) looks like a good choice

Interaction with Vim.js through JS

To actually access the buffer and other internal structures.

Need lots of work to do, or maybe to enable Vim script instead ... Not sure right now.

File System Extensions

Seems to be popularly demanded, which are fortunately not hard to implement. As long as js can be executed inside vim.js, people can mount different FS using emscripten FS API

Relative libraries:

  • BrowserFS
  • dropbox-js

Async Function Calls

Sometimes only async functions are available (e.g. setTimeout), such that you cannot block the current execution until some condition is met.

Fortunately Vim.js allows you suspend and resume it, such that you can simulate a blocking operation, which actually blocks Vim.js but does not freeze your browser. An extra callback will be provided to resume Vim.js.

Need to work out a new syntax other than :!, as :! should be reserved as a handy to for sync calls.

UTF8 keyboard doesn't work

I tried specials characters and they don't work on a french or norwegian keyboard.

Bépo

Qwerty no

Tested on Firefox 26.

Help doesn't work

Typing :help gives—

E433: No tags file                                                                                                 
E149: Sorry, no help for help.txt 

ctrl-w conflict... :P

Window navigation hotkeys seem to conflict with native browser "tab close" hotkeys in Chrome on Linux. Most likely other platforms as well.

Splitting windows breaks the view

When I split the window in two moving up and down breaks the viewport and practically makes it unusable. When one of the two is closed the visual artifacts remain.

Chrome keyboard issues

Ctrl+Alt+4 gives ¤ instead of $ on Norwegian keyboard

I tried this on a textarea in the same page and it gave the correct $.

The problem would happen if only shift modifier was retained and not ctrl modifier.

I haven't figured out why yet but I am looking at the code.

I will submit a pull request if I figure it out.

Document build issues and dependencies with latest emscripten

Dependencies on Ubuntu are emscripten dependencies and for vim libncurses-dev, libxt-dev and cproto. PS: It can be a bit hard to track down what is missing because make proto will just omit definitions that require more headers rather than fail, so compile will fail later with the missing definitions. You can run e.g.

cd src
gcc -E -DPROTO -DFEAT_SMALL -DFEAT_GUI_WEB ui.c

on the file in question to check for error messages regarding headers.

While running configure, there is a problem that emcc calls clang instead of gcc and then doesn't pick up ncurses system library which makes the configure fail, so before configure do:

cd $EM_DIR
mv emcc emcc.orig
ln -s emcc gcc

Then after configure finishes and before building:

cd $EM_DIR
mv emcc emcc.link
mv emcc.orig emcc

There may be a better way to do this using an environment variable, but I didn't find it.

dont's support key-in chinese

seems, it is only way to support key-in chinese is canvas +(overlay) + input
how did you think? or did you any plan to support chinese?

Project unmaintained?

I'm not sure what the status of the project is, but if it's permanently unmaintained or abandoned please, please, please archive the repository on GitHub.

Hope all is well, you did a really bad ass job.

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.