sponsor Vim development Vim logo go to HTTPS page Vim Book Ad

CtrlXA : make Ctrl-X and Ctrl-A run through keyword cycles

 script karma  Rating 1/1, Downloaded by 55    Comments, bugs, improvements  Vim wiki

created by
Enno Nagel
 
script type
utility
 
description
This Vim plug-in makes the key bindings <Ctrl-X/A> additionally cycle through keywords in lists such as true/false, yes/no, set/unset or yesterday/today/tomorrow.

These keywords are configurable by the variable g:CtrlXA_Toggles which defaults to

  let g:CtrlXA_Toggles = [
      \ ['true', 'false'], ['True', 'False'], ['TRUE', 'FALSE'] ,
      \ ['yes', 'no'], ['Yes', 'No'], ['YES', 'NO'] ,
      \ ['on', 'off'], ['On', 'Off'], ['ON', 'OFF'] ,
      \ ['set', 'unset'] ,
      \ ['is', 'isnot'] ,
      \ ['==', '!='] , ['<', '>'], ['<=', '>='], ['=~', '!~'],
      \ ['up', 'down'] ,
      \ ['before', 'after'] ,
      \ ['right', 'wrong'], ['Right', 'Wrong'], ['rightly', 'wrongly'], ['Rightly', 'Wrongly'] ,
      \ ['enable', 'disable'], ['Enable', 'Disable'], ['enabled', 'disabled'], ['Enabled', 'Disabled'] ,
      \ ]

There is also its buffer-local analogue, which allows for file-type specific
keyword cycles by, for example

  autocmd FileType vim
              \ let b:CtrlXA_Toggles = [
              \ ['if', 'else', 'elseif', 'endif'],
              \ ] + g:CtrlXA_Toggles
  autocmd FileType sh
              \ let b:CtrlXA_Toggles = [
              \ ['if', 'elif', 'else', 'fi'],
              \ ] + g:CtrlXA_Toggles

  autocmd FileType tex
              \ let b:CtrlXA_Toggles = [
              \ ['final', 'draft'],
              \ ['|', '\nmid'], ['=', '\neq'], \
              \ ['\leq', '\geq],
              \ ] + g:CtrlXA_Toggles

This will

- inherit the keyword cycles of the global variable override the cycling, and
- give precedence to the keyword cycles of the local variable.

The first two file-type specific keyword cycles are already included by default.


vim-CtrlXA is developed at https://github.com/Konfekt/vim-CtrlXA where issues can be filed.
 
install details
unzip vim-CtrlXA.zip into ~/.vim (respectivley %USERPROFILE/_vim in Microsoft Windows).
 

Rating scripts is only available on the HTTPS page

script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-CtrlXA.zip 1.2 2017-08-31 5.7 Enno Nagel allow for non-keyword characters
vim-CtrlXA.zip 1.1 2017-08-29 5.7 Enno Nagel Support file-type specific keyword cycles.
vim-CtrlXA.zip 1.0 2017-08-26 5.7 Enno Nagel Initial upload
ip used for rating: 54.162.139.105

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