sponsor Vim development Vim logo Vim Book Ad

inline_edit.vim : Edit code that's embedded within other code

 script karma  Rating 8/6, Downloaded by 325    Comments, bugs, improvements  Vim wiki

created by
Andrew Radev
 
script type
utility
 
description
Github project: https://github.com/AndrewRadev/inline_edit.vim

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

Given the following example:

    <script type="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.

Currently, it works for:

- Javascript and CSS within HTML -- see above example
- SQL within ruby (matches "<<-SQL")

    def some_heavy_query
      execute <<-SQL
        SELECT * FROM users WHERE something = 'other';
      SQL
    end

- Code within fenced markdown blocks

    Some text.

    ``` ruby
    def foo
      puts "OK"
    end
    ```

    Some other text.

- Django blocks in templates

    {%  block content %}
    <h1>{{ section.title }}</h1>
    {% endblock %}

Please check the docs for more detailed instructions.

If you encounter any bugs or have ideas for new features, the issue tracker is on github, at https://github.com/AndrewRadev/inline_edit.vim/issues.
 
install details
There are several ways to install the plugin. The recommended one is by using
Tim Pope's pathogen (http://www.vim.org/scripts/script.php?script_id=2332). In
that case, you can clone the plugin's git repository like so:

    git clone git://github.com/AndrewRadev/inline_edit.vim.git ~/.vim/bundle/inline_edit

If your vim configuration is under git version control, you could also set up
the repository as a submodule, which would allow you to update more easily.
The command is (provided you're in ~/.vim):

    git submodule add git://github.com/AndrewRadev/inline_edit.vim.git bundle/inline_edit

Another way is to simply copy all the essential directories inside the ~.vim/
directory: plugin, autoload, doc.
 

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
inline_edit.zip 0.2.0 2013-03-10 7.0 Andrew Radev - Edit scripts embedded in Vimscript (ruby, python, etc.)
- Easier extending for html-like filetypes
- Correct handling of RO buffers
- Edit heredocs in shell, ruby, perl
- Better cursor repositioning
- "scratch" and "tempfile" temporary buffer types
- Various bugfixes
inline_edit.zip 0.1.0 2011-12-17 7.0 Andrew Radev - Support for stylesheet tags in HTML
- InlineEdit-ing a visually selected area
- Possibility to use several proxy buffers at the same time
- Possibility to extend plugin with new patterns
- Support for filetypes with &noexpandtab
inline_edit.zip 0.0.1 2011-11-29 7.0 Andrew Radev Initial upload
ip used for rating: 54.81.76.47

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