[RFC] vim plugin rewrite II

2012-01-14 Thread an...@khirnov.net

Hi,
this is a followup to my mail from spring where i presented a partial
rewrite of the vim plugin using python. There weren't many comments back
then, so I hope there will be more now.

I've changed the filenames so my version now coexists with the current
vim plugin. You can find it in

git://git.khirnov.net/git/notmuch

branch vim. Simply copy vim/plugin/{nm_vim.py,notmuch-vimpy.vim} to the
vim plugins dir and vim/syntax/{nm_vimpy*} to the vim syntax dir and run
:NMVimpy() in vim. You'll need vim with python support and
python-notmuch bindings.

The advantages over current vim client are still the following:
* sending and displaying/saving attachments
* much better unicode support
* tag name and search commands completion
* proper representation of the thread structure
* easier to extend thanks to python's massive standard library

Please comment.

-- 
Anton Khirnov


[RFC/PATCH] Vim client rewrite

2011-05-15 Thread an...@khirnov.net

Hi,

my attempts to make the vim client more usable somehow spiraled out of
control and turned into a huge rewrite. The intermediate results I
hereby present for your amusement and comments.
(attached as whole files, since the patch would be unreadable)

The main point of the rewrite is splitting of a large part of the code
into Python. This should have the following advantages:
1) python-notmuch bindings can be used, which should allow for cleaner
   and more reliable code than running the binary and parsing its output
   with regexps.
   (also provides a nice use case for python-notmuch)
2) Python's huge standard library makes implementing some features MUCH easier.
3) More people know Python than vimscript, thus making the client
   development easier

The code is ? quality, but should be close to usable.
It already has some features not present in the mainline vim client,
like attachments (viewing and sending, saving to file should be trivial
to add, will be done when I have some time), better support for unicode
and more.

Some UI features from the mainline versions that I didn't use were
removed and customization options are somewhat lacking atm. This is of
course to be improved later, depending on the responses.

Comments, bugreports and fixes very much welcome.

--
Anton Khirnov
-- next part --
" notmuch.vim plugin --- run notmuch within vim
"
" Copyright ? Carl Worth
"
" This file is part of Notmuch.
"
" Notmuch is free software: you can redistribute it and/or modify it
" under the terms of the GNU General Public License as published by
" the Free Software Foundation, either version 3 of the License, or
" (at your option) any later version.
"
" Notmuch is distributed in the hope that it will be useful, but
" WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
" General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with Notmuch.  If not, see .
"
" Authors: Bart Trojanowski 
" Contributors: Felipe Contreras ,
"   Peter Hartman 
"

if exists('s:notmuch_loaded') || 
finish
endif
let s:notmuch_loaded = 1


" --- configuration defaults {{{1

let s:notmuch_defaults = {
\ 'g:notmuch_cmd':   'notmuch'  
  ,
\
\ 'g:notmuch_search_newest_first':   1  
  ,
\
\ 'g:notmuch_compose_insert_mode_start': 1  
  ,
\ 'g:notmuch_compose_header_help':   1  
  ,
\ 'g:notmuch_compose_temp_file_dir': '~/.notmuch/compose/'  
  ,
\ 'g:notmuch_fcc_maildir':   'sent' 
  ,
\ }

" defaults for g:notmuch_folders
" override with: let g:notmuch_folders = [ ... ]
let s:notmuch_folders_defaults = [
\ [ 'new','tag:inbox and tag:unread' ],
\ [ 'inbox',  'tag:inbox'],
\ [ 'unread', 'tag:unread'   ],
\ ]

let s:notmuch_show_headers_defaults = [
\ 'From',
\ 'To',
\ 'Cc',
\ 'Subject',
\ 'Date',
\ 'Reply-To',
\ 'Message-Id',
\]

" defaults for g:notmuch_compose_headers
" override with: let g:notmuch_compose_headers = [ ... ]
let s:notmuch_compose_headers_defaults = [
\ 'From',
\ 'To',
\ 'Cc',
\ 'Bcc',
\ 'Subject'
\ ]

" --- keyboard mapping definitions {{{1

" --- --- bindings for folders mode {{{2

let g:notmuch_folders_maps = {
\ 'm':  ':call NM_new_mail()',
\ 's':  ':call NM_search_prompt(0)',
\ 'q':  ':call NM_kill_this_buffer()',
\ '=':  ':call NM_folders_refresh_view()',
\ '':':call NM_folders_show_search()',
\ '':':call NM_folders_show_search(''tag:unread'')',
\ 'tt': ':call NM_folders_from_tags()',
\ }

" --- --- bindings for search screen {{{2
let g:notmuch_search_maps = {
\ '':':call NM_search_show_thread()',
\ '':':call NM_search_show_thread()',
\ '':  ':call NM_search_expand()',
\ 'a':  ':call NM_search_archive_thread()',
\ 'A':  ':call 
NM_search_mark_read_then_archive_thread()',
\ 'D':  ':call NM_search_delete_thread()',
\ 'f':  ':call NM_search_filter()',
\ 'm':  ':call NM_new_mail()',
\ 'o':  ':call NM_search_toggle_order()',
\ 'r':  ':call NM_search_reply_to_thread()',
\ 's':  ':call NM_search_prompt(0)',
\ ',s': ':call NM_search_prompt(1)',
\ 'q':  ':call NM_kill_this_buffer()',
\ '+':  ':call NM_search_add_tags([])',
\ '-':  ':call NM_search_remove_tags([])',
\ '=':  ':call