Skip to content

Commit

Permalink
Submiting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Yordanov committed Mar 3, 2012
1 parent daa2218 commit 7010ece
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 35 deletions.
14 changes: 6 additions & 8 deletions README.mkd
@@ -1,5 +1,6 @@
## Overview
Basically, this is the [TextMate Tasks Bundle](http://henrik.nyh.se/2007/08/tasks-bundle "TextMate Tasks Bundle") port for Vim.
This fork is made compatible with linux and pathogen.

## ScreenShot

Expand All @@ -23,16 +24,13 @@ For those guys who use [pathogen](http://github.com/tpope/vim-pathogen "pathogen
$ cd ~/.vim/bundle
$ git clone git://github.com/samsonw/vim-task.git

unfortunately ftdetect directory seems not take effect in [pathogen](http://github.com/tpope/vim-pathogen "pathogen"), I’m still wondering about why, but anyway here is a temporary workaround for now:
$ mkdir -p ~/.vim/ftdetect
$ cd ~/.vim/ftdetect
$ ln -s ../bundle/vim-task/ftdetect/task.vim task.vim

## Shortcut Key, Key Binding & Customization
By default, I mapped Ctrl+Command+Enter for toggling task status, you can simply remap to what’s the most comfortable for you:
By default, I mapped Alt-z for toggling task status, you can simply remap to what’s the most comfortable for you:

inoremap <silent> <buffer> <C-D-CR> <ESC>:call Toggle_task_status()<CR>i
noremap <silent> <buffer> <C-D-CR> :call Toggle_task_status()<CR>
inoremap <silent> <buffer> <M-z> <ESC>:call Toggle_task_status()<CR>i
noremap <silent> <buffer> <M-z> :call Toggle_task_status()<CR>
inoremap <silent> <buffer> <M-Z> :call Toggle_task_status_remove()<CR>i
noremap <silent> <buffer> <M-Z> :call Toggle_task_status_remove()<CR>

Note, if you find the key binding doesn’t work as expect, please make sure your vim instance was compiled with the +ruby feature.

Expand Down
27 changes: 0 additions & 27 deletions ftplugin/task.vim

This file was deleted.

40 changes: 40 additions & 0 deletions plugin/task.vim
@@ -0,0 +1,40 @@
" Boilerplate
if (exists("b:did_ftplugin"))
finish
endif
let b:did_ftplugin = 1

let s:cpo_save = &cpo
set cpo&vim

function! Toggle_task_status_remove()
let line = getline('.')
if match(line, '^\(\s*\)-') == 0
let line = substitute(line, '^\(\s*\)-', '\1', '')
else
let line = substitute(line, '^\(\s*\)✓', '\1', '')
endif
call setline('.', line)
endfunction

function! Toggle_task_status()
let line = getline('.')
if match(line, '^\(\s*\)-') == 0
let line = substitute(line, '^\(\s*\)-', '\1✓', '')
elseif match(line, '^\(\s*\)✓') == 0
let line = substitute(line, '^\(\s*\)✓', '\1-', '')
else
let line = substitute(line, '^\(\s*\)', '\1-', '')
endif
call setline('.', line)
endfunction

inoremap <silent> <buffer> <M-z> <ESC>:call Toggle_task_status()<CR>i
noremap <silent> <buffer> <M-z> :call Toggle_task_status()<CR>
inoremap <silent> <buffer> <M-Z> :call Toggle_task_status_remove()<CR>i
noremap <silent> <buffer> <M-Z> :call Toggle_task_status_remove()<CR>
" Boilerplate
let &cpo = s:cpo_save
unlet s:cpo_save

0 comments on commit 7010ece

Please sign in to comment.