[PATCH 1/4] VIM: implemented message folding in thread view

Franz Fellner alpine.art.de at gmail.com
Thu Jan 22 12:41:47 PST 2015


Hi Bartosz,

We already had folding via syntax in Ians fork. It turned out to be not that great.
https://github.com/imain/notmuch-vim/issues/3
In short:
Those syntax fold marks are for one specific notmuch-show-buffer. If you open a second show-buffer those
new fold marks will overwrite the ones from the previous show-buffer. Switching between those two show-buffers
will spin up CPU for quite some time and completely lock vim.
The fix I worked out was to switch to manual folding. Manual folds get chached for each buffer.

I could come up with a patch, but I think there are more important things, like attachments or storing sent mails.
It also would help a lot if we could reoranize the sources as in Ians fork. Would simplify testing, coding (proper filetype) and backporting patches.

Franz

Bartosz wrote:
> ---
>  vim/notmuch.vim | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/vim/notmuch.vim b/vim/notmuch.vim
> index cad9517..34d4f92 100644
> --- a/vim/notmuch.vim
> +++ b/vim/notmuch.vim
> @@ -345,8 +345,13 @@ ruby << EOF
>  		VIM::command("syntax region nmShowMsg#{i}Desc start='\\%%%il' end='\\%%%il' contains=@nmShowMsgDesc" % [msg.start, msg.start + 1])
>  		VIM::command("syntax region nmShowMsg#{i}Head start='\\%%%il' end='\\%%%il' contains=@nmShowMsgHead" % [msg.start + 1, msg.body_start])
>  		VIM::command("syntax region nmShowMsg#{i}Body start='\\%%%il' end='\\%%%dl' contains=@nmShowMsgBody" % [msg.body_start, msg.end])
> +		VIM::command("syntax region nmShowMsg#{i}Fold start='\\%%%il' end='\\%%%dl' contains=nmShowMsg#{i}Body,nmShowMsg#{i}Head,nmShowMsg#{i}Desc fold" % [msg.start, msg.end])
>  	end
> +	VIM::command("g/^.*(.*unread.*)$/normal zo")
> +	VIM::command("nohl")
> +	VIM::command("normal gg/unread/1") 
>  EOF
> +    set foldmethod=syntax
>  	setlocal nomodifiable
>  	call s:set_map(g:notmuch_show_maps)
>  endfunction
> @@ -957,5 +962,6 @@ EOF
>  endfunction
>  
>  command -nargs=* NotMuch call s:NotMuch(<f-args>)
> +set foldtext=v:folddashes.substitute(getline(v:foldstart),'{{{','','g')
>  
>  " vim: set noexpandtab:
> -- 
> 1.9.3 (Apple Git-50)
> 
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch




More information about the notmuch mailing list