Coder Social home page Coder Social logo

vim-cycle's Introduction

Cycle.vim

A Vim plugin that allows you to toggle between pairs or lists of related words. Use by placing your cursor on a word, like left, and press control-a. The word will be replaced with right. The default mappings are the same as those with which you can increment and decrement a number under the cursor: <C-A> and <C-X>, respectively.

Check out the code to see what cycle groups are included by default.

Customization

You can add your own word groups:

call AddCycleGroup(['one', 'two', 'three'])

To deal with conflicts, Cycle.vim also supports adding groups that are specific to a certain filetype:

call AddCycleGroup('ruby', ['class', 'module'])
call AddCycleGroup('python', ['else', 'elif'])

When multiple groups define the same word, groups belonging to specific filetypes will be used instead of global groups. This is useful in the cases above, since in HTML we would want class to cycle with id and Python uses elif while some other languages use else if or elsif.

Providing a list of filetypes is also supported:

call AddCycleGroup(['ruby', 'eruby', 'perl'], ['else', 'elsif'])

However, if there are no conflicting cases it is preferable to define all cycle groups in the global namespace, using filetype-specific groups only in case of conflict.

Matches are evaluated in reverse order, so whatever has been defined most recently will take precedence over groups defined previously. Keep this in mind when defining new cycle groups to make sure broad definitions are not matched when they are not desired.

Todo

  • The ability to handle pairs: quotes, brackets, html tags, etc.
  • Operate on non-lowercase text and retain case
  • Put cursor back at beginning of word if it started there

Bugs

  • Does not work with speeddating.vim - currently won't work if speeddating is installed.

vim-cycle's People

Contributors

blackknight36 avatar itchyny avatar z775729168 avatar zef avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.