Commits

ZyX_I  committed a873eb4

Added opening search in a vertical split, possibly using window with already existing search
Added options (nolist and textwidth=0)

  • Participants
  • Parent commits 6067605

Comments (0)

Files changed (1)

File ftplugin/notmuch_folders.vim

+scriptencoding utf-8
+if exists('s:_pluginloaded')
+    call s:F.setoptions()
+endif
 execute frawor#Setup('0.0', {'@/mappings': '0.0',
             \                  '@notmuch': '0.0',})
 function s:F.open()
         return ''
     endif
     let [fdescrs, path]=s:_r.nm.getbvals('fdescrs', 'path')
+    let cmd="\<C-\>\<C-n>:"
+    let foundw=0
+    for w in range(1, winnr('$'))
+        if bufname(winbufnr(w))[:8] is# 'nmsearch:'
+            let cmd.=w."wincmd w\n:edit"
+            let foundw=1
+            break
+        endif
+    endfor
+    if !foundw
+        let lwidth=virtcol('$')
+        let wwidth=&columns-lwidth
+        let cmd.="rightbelow ".wwidth."vsplit"
+    endif
     let idx=line('.')-2
-    return "\<C-\>\<C-n>:e ".
-                \fnameescape('nmsearch://'.s:_r.nm.escape(path).';'.
+    let cmd.=" ".fnameescape('nmsearch://'.s:_r.nm.escape(path).';'.
                 \                          s:_r.nm.escape(fdescrs[idx][1]))."\n"
+    return cmd
 endfunction
 call s:_f.mapgroup.add('NMFolders', {
             \  'Open': {'lhs': 'o', 'rhs': s:F.open,         },
             \'Reload': {'lhs': 'R', 'rhs': "\<C-\>\<C-n>:e\n"},
             \})
+function s:F.setoptions()
+    setlocal nolist
+    setlocal textwidth=0
+endfunction
+call s:F.setoptions()