Navigation Menu

Skip to content

Commit

Permalink
More cycle groups, read me fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
zef committed Aug 23, 2011
1 parent d5e4160 commit cc394e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.textile
Expand Up @@ -2,7 +2,7 @@ h1. Cycle.vim


A vim plugin that allows you to toggle between pairs or lists of related words. The A vim plugin that allows you to toggle between pairs or lists of related words. The
default mappings are the same as those with which you can increment and decrement 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. a number under the cursor: <code><C-A></code> and <code><C-X></code>, respectively.


h2. Customization h2. Customization


Expand Down
23 changes: 16 additions & 7 deletions plugin/cycle.vim
@@ -1,9 +1,9 @@
" cycle.vim - Toggle between related words " cycle.vim - Toggle between related words


if exists("g:loaded_cycle") " if exists("g:loaded_cycle")
finish " finish
endif " endif
let g:loaded_cycle = 1 " let g:loaded_cycle = 1


let s:options = [ let s:options = [
\ ['==', '!='], \ ['==', '!='],
Expand All @@ -13,6 +13,7 @@ let s:options = [
\ ['if', 'unless'], \ ['if', 'unless'],
\ ['true', 'false'], \ ['true', 'false'],
\ ['YES', 'NO'], \ ['YES', 'NO'],
\ ['first', 'last'],
\] \]


" CSS/Sass/JavaScript/HTML " CSS/Sass/JavaScript/HTML
Expand All @@ -22,6 +23,7 @@ let s:options = s:options + [
\ ['top', 'bottom'], \ ['top', 'bottom'],
\ ['margin', 'padding'], \ ['margin', 'padding'],
\ ['height', 'width'], \ ['height', 'width'],
\ ['absolute', 'relative'],
\ ['div', 'p', 'span'], \ ['div', 'p', 'span'],
\ ['h1', 'h2', 'h3'], \ ['h1', 'h2', 'h3'],
\ ['png', 'jpg', 'gif'], \ ['png', 'jpg', 'gif'],
Expand Down Expand Up @@ -67,10 +69,17 @@ function! s:Cycle(word, direction)
endfunction endfunction


" Need to implement system to include things like this based on filetype " Need to implement system to include things like this based on filetype
" Ruby " Ruby (or Rails)
call AddCycleGroup(['else', 'elsif']) call AddCycleGroup(['else', 'elsif'])

call AddCycleGroup(['include', 'require'])

call AddCycleGroup(['class', 'module'])
call AddCycleGroup(['Time', 'Date'])
call AddCycleGroup(['present', 'blank'])

" js/jQuery
call AddCycleGroup(['show', 'hide'])
call AddCycleGroup(['mouseover', 'mouseout'])
call AddCycleGroup(['mouseenter', 'mouseleave'])


nnoremap <silent> <Plug>CycleNext :<C-U>call <SID>Cycle(expand("<cword>"), 1)<CR> nnoremap <silent> <Plug>CycleNext :<C-U>call <SID>Cycle(expand("<cword>"), 1)<CR>
nnoremap <silent> <Plug>CyclePrevious :<C-U>call <SID>Cycle(expand("<cword>"), -1)<CR> nnoremap <silent> <Plug>CyclePrevious :<C-U>call <SID>Cycle(expand("<cword>"), -1)<CR>
Expand Down

0 comments on commit cc394e6

Please sign in to comment.