sponsor Vim development Vim logo Vim Book Ad

vim-js-arrow-function : changes a JavaScript anonymous function to an arrow function expression (ES2015)

 script karma  Rating 0/0, Downloaded by 192    Comments, bugs, improvements  Vim wiki

created by
Mark Volkmann
script type
This plugin converts JavaScript anonymous functions to arrow function expressions (introduced in ES 2015).

Place the cursor anywhere inside the function, even on the "function" keyword, and run the JsAnonFnToArrowFn command.

This command is mapped to af unless that is already mapped to something else.
install details
The easiest way to install this is to use Pathogen and "git clone" this repository into the .vim/bundle directory.
Alternatively, you can copy ftplugin/javascript.vim to your ~/.vim/ftplugin directory, but be sure you are not overwriting an existing file.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-js-arrow-function.zip 1.2 2015-06-18 7.0 Mark Volkmann This version avoids remapping a key if it is already mapped.
vim-js-arrow-function.zip 1.1 2015-06-15 7.0 Mark Volkmann This version adds the ability to remove the "return" keyword and braces for anonymous functions that immediately return a value.
function (n) { return n * 2; }
is changed to this:
n => n * 2
vim-js-arrow-function.zip 1.0 2015-06-15 7.0 Mark Volkmann Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
SourceForge.net Logo