Entries tagged with “vim” from ant0ine's blog
I'm still looking for the perfect tool to manage my ToDo lists. I tried a lot of different things: wiki, spreadsheet, online web2.0 apps, emails, ..., I always came back to my plain text file. With the time, I added some Vim shortcuts to make the editing easier. This is not perfect, I know it's possible to do better things with Vim. Vim experts, comments are welcome :-)
Here is my tip:
I keep a list of tasks formatted like this (one task per line) :
priority - cat1 - cat2 - task description
and use the following mapping:
map <F1> 5<C-X> map <F2> 5<C-A> map <F3> :.s/^\d\+/99 - _done/<CR>:noh<CR> map <F4> :%!sort -b -n -k 1<CR> map <F5> :%!sort -b -f -k 2<CR>
F1 and F2 decreases and increases the priority number by 5 (you need to have the cursor on the number)
F4 sorts the list by priority
F5 sorts the list by the first category
If you have finished a task, you can delete the line, or hit F3 that set the priority to 99 and the first category to _done (these tasks will always be listed at the end of the list)
I'm a fan of Andy Lester's App::Ack module. This a is a perl program that you can use as a replacement of grep.
Today I wrote a little Vim plugin that integrate ack with Vim. This is a quick hack, it works for me with vim7/ubuntu and vim6.3/fedora.
Just copy/paste the following lines in ~/.vim/plugin/ack.vim
" usage:
" (the same as ack, except that the path is required)
" examples:
" :Ack TODO .
" :Ack sub Util.pm
function! Ack(args)
let cmd = "ack -H --nocolor --nogroup " . a:args
echo "running: " . cmd
let tmpfile = tempname()
let cmd = cmd . " > " . tmpfile
call system(cmd)
let efm_bak = &efm
set efm=%f:%l:%m
execute "silent! cgetfile " . tmpfile
let &efm = efm_bak
botright copen
call delete(tmpfile)
endfunction
command! -nargs=* -complete=file Ack call Ack(<q-args>)
UPDATE:
ack-1.60 is out, and the documentation mentions another way to integrate ack and vim by using the :grep function of vim:
set grepprg=ack
I think this is a better solution, and to make it nicely integrated with vim, I wrote this new little function:
function! Ack(args)
let grepprg_bak=&grepprg
set grepprg=ack\ -H\ --nocolor\ --nogroup
execute "silent! grep " . a:args
botright copen
let &grepprg=grepprg_bak
endfunction
command! -nargs=* -complete=file Ack call Ack(<q-args>)
Just replace the old code by the new one in ~/.vim/plugin/ack.vim This time it works even if you don't specify the path, and you can still use the :grep function as before, grepprg is saved and restored.
I voted "life changing" for this one: grep.vim
