]> git.notmuchmail.org Git - notmuch/blobdiff - vim/plugin/notmuch.vim
vim: don't use scrolloff/sidesscrolloff in notmuch buffers
[notmuch] / vim / plugin / notmuch.vim
index 7927dd62e77e3f685ddd3e9c3818729551337e1b..b4eeb416ce608ad58b31883639d1f8a03bd76141 100644 (file)
@@ -517,22 +517,25 @@ endfunction
 
 " --- --- show screen helper functions {{{2
 
+function! s:NM_show_get_message_for_line(line)
+        for msg in b:nm_raw_info['msgs']
+                if a:line > msg['end']
+                        continue
+                endif
+                return msg
+        endfor
+        return {}
+endfunction
+
 function! s:NM_show_message_id()
         if !exists('b:nm_raw_info')
                 echoe 'no b:nm_raw_info'
                 return ''
         endif
-        let info = b:nm_raw_info
-        let lnum = line('.')
-        for msg in info['msgs']
-                if lnum > msg['end']
-                        continue
-                endif
-                if has_key(msg,'id')
-                        return msg['id']
-                endif
-                return ''
-        endfor
+        let msg = <SID>NM_show_get_message_for_line(line('.'))
+        if has_key(msg,'id')
+                return msg['id']
+        endif
         return ''
 endfunction
 
@@ -788,6 +791,8 @@ function! s:NM_newBuffer(type, content)
         silent put=a:content
         keepjumps 0d
         setlocal nomodifiable
+        set scrolloff=0
+        set sidescrolloff=0
         execute printf('set filetype=notmuch-%s', a:type)
         execute printf('set syntax=notmuch-%s', a:type)
         let b:nm_type = a:type