Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id B849540AB39 for ; Sat, 5 Jun 2010 04:13:20 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rUiBEjwA8DK4 for ; Sat, 5 Jun 2010 04:13:09 -0700 (PDT) Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com [209.85.214.53]) by olra.theworths.org (Postfix) with ESMTP id E16DE4196F4 for ; Sat, 5 Jun 2010 04:12:58 -0700 (PDT) Received: by mail-bw0-f53.google.com with SMTP id 12so686857bwz.26 for ; Sat, 05 Jun 2010 04:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=vc/4dOw8rgURF8yfGlWmvaXdhtsLvjJXPDmQMKUmf+Q=; b=Fd1QJQ0aCrEFeAtVpIS+QJyfee+MMDcNumzPE/jB2KeMUy2Jp99cASB6QHzLhSHdrR Z4piBlXVlin226ZRRZyXq/sXs9GJLDBBUgfESfpptcwfNny2l8obhTBDgyHtJgXKFGHf 6FIOQaGdLUPGgzoaB5LKREQ+S0vifqDKjCTUs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=HWfXsXOTKC1qM2Vb+edrV/5y8HLQbGX2/996dwdwarCNMQjlT5qCdMtv6eynD6orCF /0bL6xEYMjeHDbVsbAEcHG5AP4loeyPevJx72c5imN9bt6J8aMAOx6WrTtwjtjE05f0E GZneXHBf8j8BvSbvEe2Z+qCMB1l+r3vYw+eoE= Received: by 10.204.83.93 with SMTP id e29mr4818482bkl.142.1275736378537; Sat, 05 Jun 2010 04:12:58 -0700 (PDT) Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80]) by mx.google.com with ESMTPS id v14sm9591566bkz.8.2010.06.05.04.12.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 05 Jun 2010 04:12:58 -0700 (PDT) From: Felipe Contreras To: notmuch@notmuchmail.org Subject: [PATCH 3/9] vim: cleanup search buffer Date: Sat, 5 Jun 2010 14:12:36 +0300 Message-Id: <1275736362-22771-4-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1275736362-22771-1-git-send-email-felipe.contreras@gmail.com> References: <1275736362-22771-1-git-send-email-felipe.contreras@gmail.com> Cc: Bart Trojanowski X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2010 11:13:21 -0000 Signed-off-by: Felipe Contreras --- vim/plugin/notmuch.vim | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 deletions(-) diff --git a/vim/plugin/notmuch.vim b/vim/plugin/notmuch.vim index 3a19616..b8c9858 100644 --- a/vim/plugin/notmuch.vim +++ b/vim/plugin/notmuch.vim @@ -243,26 +243,23 @@ function! s:NM_cmd_search(words) let b:nm_raw_lines = lines let b:nm_search_words = a:words - call NM_cmd_search_mksyntax() call NM_set_map('n', g:notmuch_search_maps) setlocal cursorline setlocal nowrap endfunction function! s:NM_cmd_search_fmtline(line) - let m = matchlist(a:line, '^\(thread:\S\+\)\s\([^]]\+\]\) \([^;]\+\); \(.*\) (\([^(]*\))$') + let m = matchlist(a:line, '^\(thread:\S\+\)\s\(.\{12\}\) \[\(\d\+\)/\d\+\] \([^;]\+\); \%(\[[^\[]\+\] \)*\(.*\) (\([^(]*\))$') if !len(m) return 'ERROR PARSING: ' . a:line endif let max = g:notmuch_search_from_column_width - let from = m[3] - if strlen(from) >= max - let from = substitute(m[3][0:max-4], '[^A-Za-z1-9_]*$', '', '') . '...' - endif - return printf('%-20s %-20s | %s (%s)', m[2], from, m[4], m[5]) -endfunction -function! s:NM_cmd_search_mksyntax() - syntax clear nmSearchFrom - exec printf('syntax match nmSearchFrom /\(\] \)\@<=.\{%d\}/ oneline contained', g:notmuch_search_from_column_width) + let flist = [] + for at in split(m[4], ", ") + let p = min([stridx(at, "."), stridx(at, "@")]) + call insert(flist, tolower(at[0:p - 1])) + endfor + let from = join(flist, ", ") + return printf("%-12s %3s %-20.20s | %s (%s)", m[2], m[3], from, m[5], m[6]) endfunction " --- --- search screen action functions {{{2 -- 1.7.1