sponsor Vim development Vim logo Vim Book Ad

html advanced text objects : some alternate text objects for html

 script karma  Rating 7/3, Downloaded by 1499  Comments, bugs, improvements  Vim wiki

created by
Michael Brown
 
script type
ftplugin
 
description
Repo: http://github.com/mjbrownie/html-textobjects
Example vid (includes other plugins): http://www.youtube.com/watch?v=NbV-OrFMalU

The inbuilt text object for html (cit cat) is great for the immediate tag but requires some additional movement if you have nesting.
This plugin gives you some more text objects to play with eg 'cahf' (cut-around-html-form) 'cihb' (cut-in-html-body) , 'viht' (visual-inner-html-table) , 'gUihd' (go UPPERCASE in html div)

This is still very much a work in progress any ideas on mapping naming conventions/ bugs etc please contact me.

" Dependencies:
"
" textobj-user by Kana Natsuno
" http://www.vim.org/scripts/script.php?script_id=2100
"
"
" Overview:
"
" This plugin adds some textobjects to the html filetype
"
" ihf/ahf - in/around a <form>
" ihf/ahd - in/around a <div>
" ihf/ahs - in/around a <span>
"
"
" ihb <body>
" ihp <p>
" ihu <ul>
" ihl <li>
" iht <table>
" ihr <tr>
" ihc <td> (in-html-cell to avoid clash with <div>)
""
" so Use as you would other text objects in visual selection, cutting and
" dealleting etc.
"
" Installation:
"
" Please ensure you have the above plugins installed as instructed
" This file should be in your after/ftplugin for html
"
" ~/.vim/after/ftplugin/html/html_textobjects.vim
"
" }}

Note theres a complimentary django textobject script

http://www.vim.org/scripts/script.php?script_id=2999
 
install details
File needs to be in " ~/.vim/after/ftplugin/html/html_textobjects.vim
 

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
mjbrownie-html-textobjects-cbf4ba7.zip 0.2.1 2010-03-11 7.0 Michael Brown Fixed a bufnr bug affecting around mappings
mjbrownie-html-textobjects-f6e5573.zip 0.2.0 2010-03-11 7.0 Michael Brown Improved nesting handling. Removed matchit dependency
mjbrownie-html-textobjects-fdc4678.zip 0.1.1 2010-03-01 7.0 Michael Brown bugfix: fixed greedy visual inner html tags. Improved no match handling
html-textobjects.zip 0.1.0 2010-02-28 7.0 Michael Brown Initial upload
ip used for rating: 142.132.191.50

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.
   
Vim at Github