Show search direction in the statusline.
authorIain Patterson <me@iain.cx>
Thu, 30 Jan 2014 10:53:39 +0000 (10:53 +0000)
committerIain Patterson <me@iain.cx>
Mon, 3 Feb 2014 14:10:04 +0000 (14:10 +0000)
Show an up arrow indicator if v:searchforward is 0, indicating that the
last search was backwards.

.vimrc

diff --git a/.vimrc b/.vimrc
index fe6ad8e..d29cc40 100644 (file)
--- a/.vimrc
+++ b/.vimrc
@@ -778,13 +778,28 @@ fun! Show_Bind() "{{{2
   return ""
 endfun "}}}2
 
+" Helper for status line.
+" Show marker if searchforward is unset.
+fun! Show_SearchForward() "{{{2
+  if version >= "702"
+    if ! v:searchforward
+      if Has_Unicode()
+        return "∆"
+      else
+        return "^"
+      endif
+    endif
+  endif
+  return ""
+endfun "}}}2
+
 " Show the status line.
 fun! Show_StatusLine() "{{{2
   if ! has("statusline")
     return
   endif
   call Iain_Vars()
-  let l:sl1='%2n\:\ %<%1*%f%0*\ [%{Show_List()}%{Show_Bind()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%{Show_VirtualEdit()}%{Show_Undo()}%Y%M%R]%{Show_Alt()}\ '
+  let l:sl1='%2n\:\ %<%1*%f%0*\ [%{Show_List()}%{Show_Bind()}%{Show_Case()}%{Show_Tabstop()}%{Show_Paste()}%{Show_VirtualEdit()}%{Show_Undo()}%Y%M%R%{Show_SearchForward()}]%{Show_Alt()}\ '
   let l:sl3='L:%1*%4.6l%0*/%-4.6L\ C:%1*%3.6c%V%0*\ \|\ %P'
   let l:hexformat='%b'
   if b:iainhex