Merge remote branch 'jukie/vim'

This commit is contained in:
Carl Worth 2009-11-27 17:32:50 -08:00
commit c835e2a505
7 changed files with 1617 additions and 0 deletions

24
vim/Makefile Normal file
View file

@ -0,0 +1,24 @@
.PHONY: all help install link symlink
FILES = plugin/notmuch.vim \
$(wildcard syntax/notmuch-*.vim)
PREFIX = $(shell ls -d ~/.vim/)
OUT_FILES = $(FILES:%=${PREFIX}/%)
all: help
help:
@echo "I don't actually build anything, but I will help you install"
@echo "notmuch support for vim."
@echo
@echo " make install - copy plugin scripts and syntax files to ~/.vim"
@echo " make symlink - create symlinks in ~/.vim (useful for development)"
install: ${OUT_FILES}
link symlink:
${MAKE} SYMLINK=1 install
${OUT_FILES}: ${PREFIX}/%: %
$(if ${SYMLINK},ln -fs,cp) `pwd`/$< $@

90
vim/README Normal file
View file

@ -0,0 +1,90 @@
This directory contains a vim script that allows reading notmuch mail
through vim.
NOTE: this is a work in progress. Patches welcome. <bart@jukie.net>
Dependencies:
notmuch:
Naturally, it expects you have notmuch installed and configured.
mail:
To send mail, notmuch.vim uses the UNIX mail command.
git-diff:
The vim interface makes use of the git-diff.vim syntax file
which is available from
http://github.com/motemen/git-vim/blob/master/syntax/git-diff.vim
To install:
make install
To run:
vim -c ':NotMuch'
from vim:
:NotMuch
:NotMuch new to:bart@jukie.net 'subject:this is a test'
Buffer types:
[notmuch-folders]
Folder list, or technically a list of saved searches.
Keybindings:
<Enter> - show the selected search
m - compose a new message
s - enter search criteria
= - refresh display
[notmuch-search]
You are presented with the search results when you run :NotMuch.
Keybindings:
<Space> - show the selected thread colapsing unmatched items
<Enter> - show the entire selected thread
a - archive message (remove inbox tag)
f - filter the current search terms
o - toggle search screen order
m - compose a new message
r - reply to thread
s - enter search criteria
,s - alter search criteria
t - filter the current search terms with tags
q - return to folder display, or undo filter
+ - add tag(s) to selected message
- - remove tag(s) from selected message
= - refresh display
? - reveal the thread ID of what's under cursor
^] - search using word under cursor
[notmuch-show]
This is the display of the message.
Keybindings:
<Space> - mark read, archive, go to next matching message
^n - next message
^p - previous message
b - toggle folding of message bodies
c - toggle folding of citations
h - toggle folding of extra header lines
i - toggle folding of signatures
m - compose a new message
r - reply to the message
s - enter search criteria
q - return to search display
? - reveal the message and thread IDs of what's under cursor
^] - search using word under cursor
[notmuch-compose]
When you're writing an email, you're in this mode.
Insert-mode keybindings:
<Tab> - go to the next header line
Normal-mode keybindings:
<Tab> - go to the next header line
,s - send this message
,q - abort this message

1435
vim/plugin/notmuch.vim Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
runtime! syntax/mail.vim
syntax region nmComposeHelp contains=nmComposeHelpLine start='^Notmuch-Help:\%1l' end='^\(Notmuch-Help:\)\@!'
syntax match nmComposeHelpLine /Notmuch-Help:/ contained
highlight link nmComposeHelp Include
highlight link nmComposeHelpLine Error

View file

@ -0,0 +1,12 @@
" notmuch folders mode syntax file
syntax region nmFoldersCount start='^' end='\%10v'
syntax region nmFoldersName start='\%11v' end='\%31v'
syntax match nmFoldersSearch /([^()]\+)$/
highlight link nmFoldersCount Statement
highlight link nmFoldersName Type
highlight link nmFoldersSearch String
highlight CursorLine term=reverse cterm=reverse gui=reverse

View file

@ -0,0 +1,24 @@
" notmuch search mode syntax file
" TODO: I cannot figure out why nmSearchTags is not matching anything :(
syntax region nmSearchDate start='^' end='\%13v' oneline
syntax region nmSearchCountAndFrom start='\%14v\[' end='|' oneline contains=nmSearchCount,nmSearchFrom
syntax region nmSearchCount start='\[' end='\]' oneline contained contains=nmSearchCountZero,nmSearchCountSome,nmSearchCountAll
syntax region nmSearchFrom start='\]\@<=' end='|' oneline contained
syntax match nmSearchCountZero '0/\(\d\+\)' contained
syntax match nmSearchCountSome '\([1-9]\d*\)/\(\d\+\)' contained
syntax match nmSearchCountAll '\(\d\+\)/\1' contained
syntax match nmSearchSquareBracketText '\(\[\w\+\]\)'
syntax match nmSearchTags /([^)]\+)$/
highlight link nmSearchDate Statement
"highlight link nmSearchCount Comment
highlight link nmSearchCountZero Function
highlight link nmSearchCountSome Special
highlight link nmSearchCountAll Type
highlight link nmSearchFrom Include
highlight link nmSearchSquareBracketText Special
highlight link nmSearchTags String
highlight CursorLine term=reverse cterm=reverse gui=reverse

View file

@ -0,0 +1,25 @@
" notmuch show mode syntax file
syntax cluster nmShowMsgDesc contains=nmShowMsgDescWho,nmShowMsgDescDate,nmShowMsgDescTags
syntax match nmShowMsgDescWho /[^)]\+)/ contained
syntax match nmShowMsgDescDate / ([^)]\+[0-9]) / contained
syntax match nmShowMsgDescTags /([^)]\+)$/ contained
syntax cluster nmShowMsgHead contains=nmShowMsgHeadKey,nmShowMsgHeadVal
syntax match nmShowMsgHeadKey /^[^:]\+: / contained
syntax match nmShowMsgHeadVal /^\([^:]\+: \)\@<=.*/ contained
syntax cluster nmShowMsgBody contains=@nmShowMsgBodyMail,@nmShowMsgBodyGit
syntax include @nmShowMsgBodyMail syntax/mail.vim
" git-diff.vim marks up diffs in emails, see README for details
silent! syntax include @nmShowMsgBodyGit syntax/git-diff.vim
highlight nmShowMsgDescWho term=reverse cterm=reverse gui=reverse
highlight link nmShowMsgDescDate Type
highlight link nmShowMsgDescTags String
highlight link nmShowMsgHeadKey Macro
"highlight link nmShowMsgHeadVal NONE
highlight Folded term=reverse ctermfg=LightGrey ctermbg=Black guifg=LightGray guibg=Black