Skip to content

Latest commit

History

58 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Problem

Editing javascript within HTML is annoying. To generalize, editing code that's embedded in some different code is annoying.

Solution

Given the following example:

<scripttype="text/javascript">$(document).ready(function(){$('#foo').click(function(){alert('OK');});})</script>

Execute :InlineEdit within the script tag. A proxy buffer is opened with only the javascript. Saving the proxy buffer updates the original one. You can reindent, lint, slice and dice as much as you like.

Check the docs for more information, see the examples directory for some example files to try it on.

If you like the plugin, consider rating it on vim.org.

What does it work for?

  • Javascript and CSS within HTML
<head><scripttype="text/javascript">$(document).ready(function(){$('#foo').click(function(){alert('OK');});})</script><style>body {
color: blue;
background-color: red;
}
</style></head>
  • SQL within ruby (matches "<<-SQL")

    defsome_heavy_queryexecute<<-SQL SELECT * FROM users WHERE something = 'other'; SQLend
  • Code within fenced markdown blocks

 Some text.
``` ruby
def foo
puts "OK"
end
```
``` python
def foo():
print("OK")
```
Some other text.
{%blockcontent%}
<h1>{{ section.title }}</h1>
{%forstoryinstory_list%}
<h2>
<ahref="{{ story.get_absolute_url }}">
{{ story.headline|upper }}
</a>
</h2>
<p>{{ story.tease|truncatewords:"100" }}</p>
{%endfor%}{%endblock%}
  • Visual mode - any area that you mark

About

Edit code that's embedded within other code

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages