[PATCH] VIM: Improve moving between messages in a thread

Franz Fellner alpine.art.de at gmail.com
Fri Oct 10 02:21:22 PDT 2014


Patch works fine for me. It also would be nice to have a "move to next
unread message" function.
Most beautiful would be a treeview of the thread structure. Currently
threads are rendered as plain list, so you can't immediately see and
jump to the quoted mail. Bower IMHO uses the best approach here. I tried
emacs treeview but did not really like it (partly because I failed badly
to implement a solution that shows treeview by default). Indent the
whole large Message view IMHO also is not a good (at least to me)
solution.

On Mon,  6 Oct 2014 10:55:16 -0700, Ian Main <imain at stemwinder.org> wrote:
> @@ -113,6 +114,22 @@ EOF
>  	call s:kill_this_buffer()
>  endfunction
>  
> +function! s:show_prev_msg()
> +ruby << EOF
> +	r, c = $curwin.cursor
> +	n = $curbuf.line_number
> +	i = $messages.index { |m| n >= m.start && n <= m.end }
> +	m = $messages[i - 1] if i > 0

This one
> +	vim_puts ("messages index is #{i} and m is #{m}")
was missed ;)

> +	if m
> +		r = m.body_start + 1
> +		scrolloff = VIM::evaluate("&scrolloff")
> +		VIM::command("normal #{m.start + scrolloff}zt")
> +		$curwin.cursor = r + scrolloff, c
> +	end
> +EOF
> +endfunction
> +
>  function! s:show_next_msg()
>  ruby << EOF
>  	r, c = $curwin.cursor
> @@ -121,8 +138,9 @@ ruby << EOF
>  	m = $messages[i + 1]
>  	if m
>  		r = m.body_start + 1
> -		VIM::command("normal #{m.start}zt")
> -		$curwin.cursor = r, c
> +		scrolloff = VIM::evaluate("&scrolloff")
> +		VIM::command("normal #{m.start + scrolloff}zt")
> +		$curwin.cursor = r + scrolloff, c
>  	end
>  EOF
>  endfunction
> -- 
> 1.9.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list