From: Franz Fellner Date: Sat, 18 Oct 2014 20:31:52 +0000 (+0200) Subject: RE: [PATCH] VIM: Improve search list X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=94a5e459db9d91250a500e627326de07e9832784;p=notmuch-archives.git RE: [PATCH] VIM: Improve search list --- diff --git a/aa/f266587401e6d52ba9702e58f01ebe9297b6b0 b/aa/f266587401e6d52ba9702e58f01ebe9297b6b0 new file mode 100644 index 000000000..1bdedef87 --- /dev/null +++ b/aa/f266587401e6d52ba9702e58f01ebe9297b6b0 @@ -0,0 +1,165 @@ +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 B6F1F431FBD + for ; Sat, 18 Oct 2014 13:31:50 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +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 KRw8hCgx9K-M for ; + Sat, 18 Oct 2014 13:31:43 -0700 (PDT) +Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com + [74.125.82.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 50356431FB6 for ; Sat, 18 Oct 2014 13:31:43 -0700 + (PDT) +Received: by mail-wg0-f43.google.com with SMTP id m15so2996051wgh.14 + for ; Sat, 18 Oct 2014 13:31:42 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=date:from:to:message-id:in-reply-to:references:subject:mime-version + :content-type:content-transfer-encoding; + bh=yBT4SoiHm0D4+jzcJQUVtX7Dko8VjUf6R1T++zwnev0=; + b=V0lvmy+KJGwHFSQqpQRAXiD9nR6JmWGW+MZZoJjzUj8BT5pS1m9X5Re6o9hxkr2a4r + Gi8aWJy3us7WZatLK3q874Z1y/j4ez+bhpD4A6CCPIFl7FQy/41JK2QGeKy9mXdX7CnP + IBK/il0K5DzdW0UJbCv6jb/L3L3sCHxBE7b0lCPIubwu4FzaLekrxAeYb8GYxiRgx2oS + sKBbuK0e6DG3BLqnkSjW0o5VZMtzra/nD3YhApS++FvltblWB18oVtOqFmOT3oF6aaFk + 26+AFTVgZUBKC4MXlylL0Vmu6PjiTY/MNZv73OIBhpM1pJWKErq9KvMJDI0iJEF59QQo + Z87Q== +X-Received: by 10.180.101.102 with SMTP id ff6mr8398485wib.34.1413664302216; + Sat, 18 Oct 2014 13:31:42 -0700 (PDT) +Received: from localhost (p5B00C687.dip0.t-ipconnect.de. [91.0.198.135]) + by mx.google.com with ESMTPSA id yr9sm6158028wjc.31.2014.10.18.13.31.40 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 18 Oct 2014 13:31:41 -0700 (PDT) +Date: Sat, 18 Oct 2014 22:31:52 +0200 +From: Franz Fellner +To: Ian Main , Ian Main , + notmuch@notmuchmail.org +Message-ID: <5442ce38e11bf_255f136de9416@TP_L520.notmuch> +In-Reply-To: <1412621414-31793-1-git-send-email-imain@stemwinder.org> +References: <1412621414-31793-1-git-send-email-imain@stemwinder.org> +Subject: RE: [PATCH] VIM: Improve search list +Mime-Version: 1.0 +Content-Type: text/plain; + charset=utf-8 +Content-Transfer-Encoding: 7bit +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, 18 Oct 2014 20:31:50 -0000 + +LGTM + +Franz + +Ian Main wrote: +> Make the width of the search name column expand/contract with the +> length of the longest search name string. +> +> Fix syntax highlighting to make the above work right. +> +> Add the ability to use a blank search pattern to create a spacer +> to break up searches into groups. +> --- +> vim/notmuch.txt | 4 ++++ +> vim/notmuch.vim | 16 ++++++++++++++-- +> vim/syntax/notmuch-folders.vim | 2 +- +> 3 files changed, 19 insertions(+), 3 deletions(-) +> +> diff --git a/vim/notmuch.txt b/vim/notmuch.txt +> index 4374102..3a73912 100644 +> --- a/vim/notmuch.txt +> +++ b/vim/notmuch.txt +> @@ -94,11 +94,15 @@ You can add the following configurations to your `.vimrc`, or +> *g:notmuch_folders* +> +> The first thing you might want to do is set your custom searches. +> + +> +Adding an empty set of strings results in a blank line which allows you +> +to break up searches into groups. +> > +> let g:notmuch_folders = [ +> \ [ 'new', 'tag:inbox and tag:unread' ], +> \ [ 'inbox', 'tag:inbox' ], +> \ [ 'unread', 'tag:unread' ], +> + \ [ '', '' ], +> \ [ 'to-do', 'tag:to-do' ], +> \ [ 'to-me', 'to:john.doe and tag:new' ], +> \ ] +> diff --git a/vim/notmuch.vim b/vim/notmuch.vim +> index 331e930..61a7260 100644 +> --- a/vim/notmuch.vim +> +++ b/vim/notmuch.vim +> @@ -374,7 +374,9 @@ function! s:folders_show_search() +> ruby << EOF +> n = $curbuf.line_number +> s = $searches[n - 1] +> - VIM::command("call s:search('#{s}')") +> + if s.length > 0 +> + VIM::command("call s:search('#{s}')") +> + end +> EOF +> endfunction +> +> @@ -633,11 +635,21 @@ ruby << EOF +> folders = VIM::evaluate('g:notmuch_folders') +> count_threads = VIM::evaluate('g:notmuch_folders_count_threads') == 1 +> $searches.clear +> + longest_name = 0 +> + folders.each do |name, search| +> + if name.length > longest_name +> + longest_name = name.length +> + end +> + end +> folders.each do |name, search| +> q = $curbuf.query(search) +> $searches << search +> count = count_threads ? q.search_threads.count : q.search_messages.count +> - b << "%9d %-20s (%s)" % [count, name, search] +> + if name == '' +> + b << "" +> + else +> + b << "%9d %-#{longest_name + 1}s (%s)" % [count, name, search] +> + end +> end +> end +> end +> diff --git a/vim/syntax/notmuch-folders.vim b/vim/syntax/notmuch-folders.vim +> index 9477f86..03209c1 100644 +> --- a/vim/syntax/notmuch-folders.vim +> +++ b/vim/syntax/notmuch-folders.vim +> @@ -1,7 +1,7 @@ +> " notmuch folders mode syntax file +> +> syntax region nmFoldersCount start='^' end='\%10v' +> -syntax region nmFoldersName start='\%11v' end='\%31v' +> +syntax region nmFoldersName start='\%11v' end=' ('me=e-1 +> syntax match nmFoldersSearch /([^()]\+)$/ +> +> highlight link nmFoldersCount Statement +> -- +> 1.9.3 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch + +