sponsor Vim development Vim logo Vim Book Ad

toggle_word.vim : toggles words, ie. turn on into off, true into false, etc.

 script karma  Rating 22/12, Downloaded by 1517  Comments, bugs, improvements  Vim wiki

created by
Alexandru Ungur
 
script type
utility
 
description
Toggles words and preserves case. The words will get converted like this:

  on -> off
  On -> Off
  ON -> OFF

any other case gets converted to lowercase, e.g.:

  tRUe -> false

Inspired from vimscript #1676
All I really wanted besides what that script did, was the ability to
preserve the case of words.

Usage:
Once installed it will give you a ToggleWord() command and will map it by
default to "<leader>t". All you need to do is position the cursor over the word
you want to toggle and press \t in normal or visual mode.
 
install details
Please see INSTALL
 

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
toggle_word.zip 1.4 2008-06-03 7.0 Alexandru Ungur - Loaded a more comprehensive base dictionary trying to make
   the plugin more useful out of the box. Suggestions for
   adding more entries to the default dictionary are welcome;

- Changed the way that the user defined (g:toggle_words)
   dictionary works: it now gets merged into the default one,
   so you can simply skip the entries already defined in the
   base dictionary unless you need to override them.

- Retired the 'ruby' version of the plugin. You can fetch it from v1.3
   if you need it, but no further development will be done on it
toggle_word.zip 1.3 2007-02-05 7.0 Alexandru Ungur - Refactored the code once again, many thanks to Gary Wright for the beautiful solution
   he suggested for the Ruby version of the plugin,
- Initially introduced the "Vim7" version of the plugin which does not depend on +ruby at all,
- Added documentation,
- Changed the default binding from ,t to <leader>t
toggle_word.vim 1.2 2007-01-10 6.0 Alexandru Ungur Refactored the code a little bit
toggle_word.vim 1.1 2007-01-03 6.0 Alexandru Ungur Simplified the dictionary format. Now you don't have to worry about quotes,
commas and square brackets anymore, it's all "just text".
toggle_word.vim 1.0 2006-12-30 6.0 Alexandru Ungur Initial upload
ip used for rating: 18.191.181.231

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