unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Franz Fellner <alpine.art.de@gmail.com>
To: Ian Main <imain@stemwinder.org>, Ian Main <imain@stemwinder.org>,
	 notmuch@notmuchmail.org
Subject: RE: [PATCH] VIM: Improve search list
Date: Sat, 18 Oct 2014 22:31:52 +0200	[thread overview]
Message-ID: <5442ce38e11bf_255f136de9416@TP_L520.notmuch> (raw)
In-Reply-To: <1412621414-31793-1-git-send-email-imain@stemwinder.org>

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

      reply	other threads:[~2014-10-18 20:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06 18:50 [PATCH] VIM: Improve search list Ian Main
2014-10-18 20:31 ` Franz Fellner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5442ce38e11bf_255f136de9416@TP_L520.notmuch \
    --to=alpine.art.de@gmail.com \
    --cc=imain@stemwinder.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).