I use VIM to edit text-files on my mac. Or I use VIM to edit a couple of text-files containing my my worklogs. So I can keep track of what I have done on different projects and at what time.
Creating a quick log entry
I have edited my .bash_profile with the following line
alias wl='vim + ~/Dropbox/NV/worklog.txt; clear'
This in combination with quick access to terminal.app using Visor makes appending to my worklog almost instant.
- Visor keyboard shortcut, in my case Alt + § (On a Swedish keyboard It makes sense)
- I type wl and press enter
- VIM opens the last line in my worklog
- To enter insert mode and append to the end of the line i type A.
- I type enter -> nnow ,which is my TextExpander abbreviation for inserting a date and time stamp, on the new line. (Example: 2011-04-12 20.20 [Tuesday] )
- The I write a short log of what I’m doing at the moment.
- I save and exit the worklog file by typing Esc (to exit insert mode), then wq -> enter.
Done.
Making the text file readable in VIM
To make this logfile more readable I use a customized color formatting.
Edit the ~/.vimrc file
This is the content of my .vimrc file.
colorscheme desert
syntax on
au BufRead,BufNewFile *.txt set filetype=txt
au! Syntax newlang source ~/.vim/syntax/txt.vim
Create the ~/.vim/syntax/txt.vim
I downloaded Tomasz Kalkosinski’s universal syntax script for all txt docs. But I added a couple of changes of my own:
syn match logDate /^\d\{4}-\d\{2}-\d\{2}/
syn match logTime /\d\{2}:\d\{2}:\d\{2},\d\{3}/
And later in the file:
HiLink logDate Comment
HiLink logTime Todo
You can download my vim.txt file here.