akahuku / wasavi

wasavi is an extension for Chrome, Firefox, and Opera. wasavi changes a textarea element to virtual vi editor which supports almost all the vi/ex commands.
http://appsweets.net/wasavi/
Other
1.51k stars 66 forks source link
extension javascript vi

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

日本語版のREADME

A Quick Walkthrough

Salient Features

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 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 modify initial settings:

Open preference wasavi extension (or enter :options on wasavi), and edit "exrc" textbox.

How to control beep

Add set noerrorbells to your exrc to disable beep sound. If you prefer a visual bell, add set visualbell instead.

Also, a chime at wasavi startup can be disabled with set nolaunchbell.

The volume of any beeps can be controlled with set bellvolume=N. Range of value N is 1 to 100.

How to access local files

See document.

How to use wasavi with Vimperator/Keysnail/VimFx on Firefox

Vimperator

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.

Keysnail

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

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

VimFx

Latest VimFx recognizes wasavi as editable element. While wasavi is running, VimFx suspends temporarily.

To use VimFx's key binding while wasavi is running, click outside area of wasavi or enter :set esctoblur and press <esc> in normal mode. Then keyboard focus would be removed from wasavi, and you can use VimFx's key binding.

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/OneDrive files or local 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.

How to cooperate with Migemo

wasavi for Chrome can Migemo search. Install Migemo Server, then input a special meta character \M in search query of / or ? command. If \M included in search query, these search commands are executed via migemo.

I have noticed a bug

Please create an issue on wasavi issue tracker

Tips and Tricks

Commands implemented

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

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)

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 ^A ^X

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:

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

Line input mode commands

Bound mode commands

Bound mode is similar to vim's visual mode.

Surrounding identifiers

Surrounding string

Vim features in wasavi