Permalink
Browse files

changed KataRenumber to accept a range; added KataGroupRenumber and <…

…ll>kgr map; altered .steps file format to be more .ini like
  • Loading branch information...
1 parent 59227f4 commit 9d23db4d27a8587de4cacd3a50e89de01641bb1b @dahu dahu committed May 24, 2010
Showing with 17 additions and 6 deletions.
  1. +17 −4 ftplugin/kata.vim
  2. +0 −2 vim_1_white.steps
View
@@ -11,12 +11,25 @@ let b:did_ftplugin = 1
setlocal commentstring=#%s foldmethod=marker
setlocal nospell nohlsearch
-function! KataRenumber()
+function! KataRenumber() range
let b:k_count = 1
- exe ":g/^(\\d\\+/s//\\='('.b:k_count/ | let b:k_count += 1"
- norm ``
+ exe a:firstline . ',' . a:lastline . "g/^(\\d\\+/s//\\='('.b:k_count/ | let b:k_count += 1"
endfunction
-nnoremap <buffer> <silent> <LocalLeader>kr :call KataRenumber()<cr>
+nnoremap <buffer> <silent> <LocalLeader>kr ms :1,$ call KataRenumber()<cr>`s
+
+function! KataGroupRenumber()
+ let group_boundary = '^\[.\{-}\]$'
+
+ " Locate the boundary of the group we're in
+ let firstline = search(group_boundary,'bnW') + 1
+ let lastline = search(group_boundary, 'nW') - 1
+ if lastline < 0
+ let lastline = line('$')
+ endif
+
+ exe firstline . ',' . lastline 'call KataRenumber()'
+endfunction
+nnoremap <buffer> <silent> <LocalLeader>kgr ms :call KataGroupRenumber()<cr>`s
function! KataNextQuestion()
call search("(\\d\\+)")
View
@@ -7,7 +7,6 @@ o---| |--| |--|
> lllljlllkllljjllkllkllljjhhjhhhhhhhkhhhhhhjllll
-[movement-along-a-path]
(2) Follow the path from 'o' to 'x':
o-| |-| |--| |--|
|-| ||-| | | |
@@ -23,7 +22,6 @@ o-| |-| |--| |--|
> xlxxlxlllxjhhxllxlx
-[move-and-delete]
(2) Delete the .'s in the following lines:
***.**.*.**
.*..*.***.*

0 comments on commit 9d23db4

Please sign in to comment.