Giter Club home page Giter Club logo

wasavi's Introduction

wasavi (VI editor for any web page)

wasavi is an extension for Chrome, Opera and Firefox. wasavi transforms TEXTAREA element of any page into a VI editor, so you can edit the text in VI. wasavi supports almost all VI commands and some ex commands.

wasavi is under development. Any bug report or feature request is welcome.

And we also welcome a donation to continue development:

Donate Flattr

A Quick Walkthrough

  • Here is a native TEXTAREA

    native textarea

  • Focus the TEXTAREA, and press Ctrl+Enter to launch wasavi

    wasavi running

Salient Features

  • wasavi supports some ex commands. This is the output of :set all

    set all

  • Vim's incremental search

    incremental search

  • wasavi online app. Open this link on a browser that has wasavi extension. wasavi will launch automatically. Then you can read and write files at your Dropbox/Google Drive account.

    stand alone

How to install

Currently, wasavi is available for following browsers only. Select your browser and click the link. Standard extension installation procedure of your browser will follow. These extensions are hosted at the addons store of their respective browser.

Source code and latest development releases are hosted at Github:

A note for Opera users

Presto based Opera does not support DOM3 Composition Event therefore input via IME is not guaranteed. Presto based Opera does not allow extension to manipulate system clipboard, so the register * is unavailable on Opera.

A note for Chrome users

Chrome has reserved some fundamental shortcuts, such as Ctrl+T, Ctrl+W and Ctrl+N. Although these keys cannot be used in wasavi, you can use Alt+T, Alt+W and Alt+N.

Frequently Asked Questions

How to launch wasavi

Focus TEXTAREA and press Ctrl+Enter.

How to quit wasavi

To quit wasavi press ZZ or :q or :wq or any other VI quit command.

Which options are accepted by the :set command?

See this table.

Note: there are also options which are accepted but don't have any effect yet.

How to use wasavi with Vimperator on Firefox

Put wasavi_mediator.js in your Vimperator plugin directory, for example, ~/.vimperator/plugin or %HOME%\vimperator\plugin.

This plugin will control the pass-through mode of Vimperator according to the state of wasavi.

How to use wasavi with Keysnail on Firefox

Put wasavi_mediator.ks.js in your Keysnail plugin directory.

This plugin will control suspend mode of Keysnail according to the state of wasavi.

How to use wasavi as an independent text editor

Install the wasavi extension and open the link to wasavi online app. wasavi will start automatically. You can use ex commands :read, :write, :edit or :file to access your Dropbox/Google Drive files. You will have to authorize wasavi via OAuth to access these storages.

About automatic setting override

The :set commands which you input while wasavi is running are stored to extension's persistent storage, and those are regenerated when you launch wasavi next time.

This setting override mechanism works each independent URLs (max 30). If you think this is unnecessary, put :set nooverride in your exrc. Then overriding will be skipped.

I have noticed a bug

Please create an issue on wasavi issue tracker

Tips and Tricks

  • to maximize the wasavi: :set fullscreen or :set fs
  • to restore the wasavi: :set nofullscreen or :set nofs
  • to change a color theme: :set theme=blight or :set theme=charcoal or :set theme=matrix
  • to modify initial settings: open preference wasavi extension (or enter :options on wasavi), and edit "exrc" textbox.
  • abbreviate syntax is
    • :abbreviate displays all the abbreviations currently registered.
    • :abbreviate [clear] clears all the abbreviations.
    • :abbreviate lhs displays the abbreviation corresponding to lhs.
    • :abbreviate lhs rhs registers a abbreviation which expands lhs to rhs.
    • :abbreviate [noremap] lhs rhs also registers, but it is not effected remap mechanism.
  • map syntax is
    • :map displays all the mappings currently registered.
    • :map [clear] clears all the mappings.
    • :map lhs rhs registers a rule which translates lhs to rhs. Its translation is recursive. About syntax of key stroke descriptor like <esc> in the lhs and rhs, see this page.
    • :map [noremap] lhs rhs also registers, but it is non-recursive.
    • :map targets the normal mode mappings. On the other hand, :map! targets the insert mode. This is equivalent to vim's :imap.
  • j k ^ $ moves cursor by physical row, on the other hand, gj gk g^ g$ moves by wrapped row. To swap the behavior: :set jkdenotative
  • f/F/t/T extension for Japanese: these commands recognizes reading (ro-ma ji expression) of hiragana, katakana, and kanji. For example, fk will place a cursor on 'か', 'カ', '漢' and so on.
  • f/F/t/T extension for Latin script: these commands recognizes the base alphabet of diacritical marked letter. For example, fa will place a cursor on 'å', 'ä', 'à', 'â', 'ā' and so on. Also see mapping table.
  • use a online storage as file system:
    • :filesystem status shows all file systems currently available.
    • :filesystem default shows default file system. You can set default file system via :filesystem default dropbox or :filesystem default gdrive.
    • :filesystem reset discards the access token for online storage.
    • You can place the file system name at the head of a file name explicitly: for instance, :read dropbox:/hello.txt.
  • When you read from the register of A to Z, some registers returns special content:
    • B register: user agent string
    • D register: current date time string (formatted by using datetime option as template of strftime(3))
    • T register: title string
    • U register: URL string
    • W register: version string of wasavi
  • To return a setting to default state:
    • :set <option-name>& or :set <option-name>&default
  • To return all settings to default state:
    • :set all& or :set all&default
  • To return a setting to the state just after evaluation of exrc:
    • :set <option-name>&exrc
  • To return all settings to the state just after evaluation of exrc:
    • :set all&exrc
  • To submit a form automatically after writing text and closing wasavi:
    • :wqs
    • :submit (this can be shortened to :sub )

Commands implemented

  • [count] operation [count] motion
  • [count] operation [count] range-symbol
  • [count] surround-operation [count] motion surround-string
  • [count] surround-operation [count] range-symbol surround-string
  • [count] de-surround-operation [count] surround-identifier
  • [count] re-surround-operation [count] surround-identifier surround-string
  • [count] operation-alias
  • [count] surround-operation-alias surround-string
  • [count] motion
  • [count] scroll-command
  • [count] edit-command
  • [count] : ex-command

Operations

c y d > < gq gu gU

Operation Aliases

cc yy dd >> << C Y D gqq guu gUU yss ySS

A counter can be inserted in front of the last 1 character.

Surround Operations

  • to surround: ys yS
  • to remove a surround: ds
  • to change a surround: cs

Motions

- + ^ <home> $ <end> % | , ; _ / ? ' ` ( ) { } [[ ]] <enter> 0 j k h l ^N ^P ^H <down> <up> <left> <right> <space> w W b B e E gg gj gk g^ g$ G H M L f F t T n N

Range symbols (Vim text objects)

  • a" a' a` a[ a] a{ a} aB a< a> a( a) ab aw aW ap as at
  • i" i' i` i[ i] i{ i} iB i< i> i( i) ib iw iW ip is it

Scroll commands

^U ^D ^Y ^E ^B ^F <pageup> <pagedown> z<enter> z. zz z-

Edit commands

x X <delete> p P J . u ^R ~ ^L ^G ga gv m @ q r R a A i I o O & s S v V ZZ gi

ex commands

abbreviate cd chdir copy delete edit file filesystem global join k map mark marks move options print put pwd quit read redo s & ~ set sort submit registers to unabbreviate undo unmap version v write wq wqs xit yank > < @ *

The addressing in ex command is fully supported:

  • whole buffer: %s/re/rep/
  • current line: .p
  • the last line of buffer: $p
  • absolute line number: 1,2p
  • relative line number: +1,+2p
  • regal expression: /re/p ?re?p
  • mark referencing: 'a,'bp

In addition to this wasavi also accepts offset, for example: /re/+1p. Two addresses are usually connected by a ,, wasavi also supports ;.

Input mode commands

  • ^@: input the most recently input text, and exit input mode. this key stroke is actually Ctrl+Space.
  • ^D: unshift. but if the last input character is 0 or ^, delete all indentation
  • ^H: delete a character
  • ^R: paste register's content
  • ^T: shift
  • ^U: delete all the characters entered in the current input session
  • ^V: literal input
  • ^W: delete a word

Line input mode commands

  • ^A: move cursor to top of line
  • ^B: back
  • ^E: move cursor to end of line
  • ^F: forward
  • ^H: delete a character
  • ^N: next history
  • ^P: previous history
  • ^R: paste register's content
  • ^U: delete whole line
  • ^V: literal input
  • ^W: delete a word
  • tab: complete ex command name, set option name, file name argument of read/edit/write/file

Bound mode commands

Bound mode is similar to vim's visual mode.

  • c: delete the bound, and switch to insert mode
  • d: delete the bound
  • y: yank the bound
  • <: unshift the bound
  • >: shift the bound
  • C: delete the line-wise bound, and switch to insert mode
  • S: surround the bound
  • R: same as C
  • D: delete the line-wise bound
  • X: same as D
  • Y: yank the line-wise bound
  • g prefix commands
  • a, i prefix range symbols
  • ~: swap lower case and upper case in the bound
  • :: switch to line input mode
  • J: join the bound
  • p: delete the bound, and paste a register's content
  • P: same as p
  • r: fill the bound up with inputted letter
  • s: same as c
  • u: lower-ize the bound
  • U: upper-ize the bound
  • v: character wise bound mode
  • V: line wise bound mode
  • x: same as d

Surrounding identifiers

  • quotations: one of !#$%&*+,\-.:;=?@^_|~"'`
  • brackets: one of abBrt[]{}()

Surrounding string

  • quotations: one of !#$%&*+,\-.:;=?@^_|~"'`
  • brackets: one of abBr[]{}()
  • tags: one of ^T ,<Tt

Vim features in wasavi

  • multiple level undo/redo
  • incremental search
  • range symbols (aka, Vim text objects)
  • register ", :, *, / (* is used to access system clipboard)
  • auto-reformat in input mode, and reformat operator (gq command) on the state of textwidth > 0
  • bound mode (aka, Vim visual mode)
  • options: iskeyword, incsearch, smartcase, undolevels, quoteescape, relativenumber, textwidth, expandtab, cursorline, cursorcolumn
  • writing to the register of A to Z
  • gu / gU + motion: lowerize or upperize a region
  • partial functionality of Surround.vim
  • partial functionality of :sort (regex pattern, r and i options)

wasavi's People

Contributors

akahuku avatar klaernie avatar kstep avatar talha131 avatar

Watchers

JW avatar James Cloos avatar

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.