sponsor Vim development Vim logo Vim Book Ad

toggle_words.vim : toggle words like:'true'=>'false', 'True'=>'False' etc

 script karma  Rating 35/16, Downloaded by 3280  Comments, bugs, improvements  Vim wiki

created by
Vincent Wang
 
script type
utility
 
description
" Documentation:
"   The purpose of this plugin is very simple, it can toggle words among
"   'true'=>'false', 'True'=>'False', 'if'=>'elseif'=>'else'=>'endif' etc .
"
"   To use it, move the cursor on some words like 'true', 'False', 'YES', etc,
"   call command
"     :ToggleWord
"
"   It will toggle 'true'=>'false', 'False'=>'True', 'YES'=>'NO' etc. Yes,
"   this script will try to take the case into account when toggling words, so
"   'True' will be toggled to 'False' instead of 'false'. Currently the way to
"   check the case is very simple, but it works well for me.
"
"   You can define a map for 'ToggleWord' comand to make it easier:
"     nmap ,t :ToggleWord<CR>
"
"   This script can search the candicate words to toggle based on
"   current filetype, for example, you can put the following configuration
"   into your .vimrc to define some words for python:
"      let g:toggle_words_dict = {'python': [['if', 'elif', 'else']]}
"  
"   There are some default words for toggling predefined in the
"   script(g:_toogle_words_dict) that will work for all filetypes.
"   Any comment, suggestion, bug report are welcomed.
 
install details
just put this script into YOUR_HOME_DIR/[._]vim/plugin folder.
 

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_words.vim 1.5 2009-02-26 7.0 Vincent Wang add support to extend default toggle words ('*'), based on patch provided by Jeremy Cantrell, thanks
toggle_words.vim 1.3 2008-07-20 7.0 Vincent Wang * fix error of 'E488: Trailing characters', patch provided by Jeremy Cantrell
toggle_words.vim 1.2 2008-07-20 7.0 Vincent Wang * fixed typo(november => novermber)
* sorted and stacked the definitions to make them more readable/editable
* added a few new definitions (allow/deny, min/max, before/after, block/inline/none, left/right)
* add revision history
(most of above changes come from Fergus Bremner, thanks Fergus!)
toggle_words.vim 1.01 2007-06-29 7.0 Vincent Wang Yes, this script will try to take the case into account when toggling words, so 'True' will be toggled to 'False' instead of 'false'. Currently the way to check the case is very simple, but it works well for me.
toggle_words.vim 1.0 2006-10-12 7.0 Vincent Wang 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