Skip to content

bootleq/vim-cycle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

96 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cycle.vim

Cycle text within predefined candidates.

  • yes => no => yes
  • January => February => March
  • trUe => faLse   keep case by default
  • " => '   can handle non-keywords
  • => 可   multibyte is fine
  • Rails Metal => Thrash => Technical Death   handle multi-words by visual selection, or smart auto search
  • <em>important</em> => <strong>important</strong>   tag pairs cycle together
  • quoted => quoted   special pairs cycle together

Configuration Example

let g:cycle_no_mappings = 1
let g:cycle_max_conflict = 14
let g:cycle_select_ui = 'ui.select'
let g:cycle_conflict_ui = 'confirm'
let g:cycle_phased_search = 1

nmap <silent> <LocalLeader>a <Plug>CycleNext
vmap <silent> <LocalLeader>a <Plug>CycleNext
nmap <silent> <Leader>a <Plug>CyclePrev
vmap <silent> <Leader>a <Plug>CyclePrev
nmap <silent> <LocalLeader>ga <Plug>CycleSelect
vmap <silent> <LocalLeader>ga <Plug>CycleSelect

let g:cycle_default_groups = [
      \   [['true', 'false']],
      \   [['yes', 'no']],
      \   [['on', 'off']],
      \   [['+', '-']],
      \   [['>', '<']],
      \   [['"', "'"]],
      \   [['==', '!=']],
      \   [['0', '1']],
      \   [['and', 'or']],
      \   [['next', 'previous', 'prev']],
      \   [['asc', 'desc']],
      \   [['', '']],
      \   [['', '', '']],
      \   [['', '', '', '', '', '', '', '']],
      \   [['lat', 'lon']],
      \   [['latitude', 'longitude']],
      \   [['ancestor', 'descendant']],
      \   [['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
      \     'Friday', 'Saturday'], ['hard_case', {'name': 'Days'}]],
      \   [['(:)', '(:)', '「:」', '『:』'], 'sub_pairs'],
      \ ]

" For fileType "ruby" only
let g:cycle_default_groups_for_ruby = [
      \   [['stylesheet_link_tag', 'javascript_include_tag']],
      \ ]

" For HTML, but here just blindly add to global groups
let g:cycle_default_groups += [
      \   [['h1', 'h2', 'h3', 'h4'], 'sub_tag'],
      \   [['ul', 'ol'], 'sub_tag'],
      \   [['em', 'strong', 'small'], 'sub_tag'],
      \ ]

let g:cycle_default_groups += [
      \   [['', '', '', '', '', '', '']],
      \   [['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']],
      \   [['January', 'February', 'March', 'April', 'May', 'June', 'July',
      \     'August', 'September', 'October', 'November', 'December']],
      \   [['portrait', 'landscape']],
      \ ]

Similar Projects

  • SwapIt by Michael Brown
    Original ideas of special features including visual multi-words, xml tag pairs, omni-complete cycling.

  • Cycle.vim by Zef
    Yes, there is already a plugin named 'Cycle'. Maybe I have to rename mine.

  • switch.vim by AndrewRadev
    Supports more complicated patterns like ruby :a => 'b' to a: 'b', which is generally unable to achieve by alternative projects.

  • vim-clurin by syngan
    Another early implementation, seems to have custom pattern and replace function features, but lacks documentation.

  • toggle.vim by Timo Teifel
    Maybe the very first plugin that introduced this idea.

Blog Posts

TODO

wiki/TODO

About

Cycle text within predefined candidates.

Resources

Stars

Watchers

Forks

Packages

No packages published