Wikia

Vim Tips Wiki

Changes: Status line to display more information

Edit

Back to page

(Move categories to tip template)
(Remove html character entities)
 
Line 15: Line 15:
   
 
<pre>
 
<pre>
set statusline=%&lt;%f\ %h%m%r%=%-20.(line=%l,col=%c%V,totlin=%L%)\%h%m%r%=%-40(,bytval=0x%B,%n%Y%)\%P
+
set statusline=%<%f\ %h%m%r%=%-20.(line=%l,col=%c%V,totlin=%L%)\%h%m%r%=%-40(,bytval=0x%B,%n%Y%)\%P
 
</pre>
 
</pre>
   
 
==Comments==
 
==Comments==
 
<pre>
 
<pre>
set statusline=%&lt;%f%&lt;%{FileTime()}%&lt;%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}
+
set statusline=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}
 
set rulerformat=%15(%c%V\ %p%%%)
 
set rulerformat=%15(%c%V\ %p%%%)
"set rulerformat=%&lt;%f%&lt;%{FileTime()}%&lt;%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}
+
"set rulerformat=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}
   
 
fun! FileTime()
 
fun! FileTime()
 
let ext=tolower(expand("%:e"))
 
let ext=tolower(expand("%:e"))
let fname=tolower(expand('%&lt;'))
+
let fname=tolower(expand('%<'))
 
let filename=fname . '.' . ext
 
let filename=fname . '.' . ext
 
let msg=""
 
let msg=""

Latest revision as of 00:22, September 30, 2008

Tip 1470 Printable Monobook Previous Next

created January 12, 2007 · complexity basic · author Vijayandra Singh · version 5.7


Paste the following in your vimrc to display more information in the status line: line number, hex value under cursor, total lines, %position in file.

set statusline=%<%f\ %h%m%r%=%-20.(line=%l,col=%c%V,totlin=%L%)\%h%m%r%=%-40(,bytval=0x%B,%n%Y%)\%P

CommentsEdit

set statusline=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}
set rulerformat=%15(%c%V\ %p%%%)
"set rulerformat=%<%f%<%{FileTime()}%<%h%m%r%=%-20.(line=%03l,col=%02c%V,totlin=%L%)\%h%m%r%=%-30(,BfNm=%n%Y%)\%P\*%=%{CurTime()}

fun! FileTime()
  let ext=tolower(expand("%:e"))
  let fname=tolower(expand('%<'))
  let filename=fname . '.' . ext
  let msg=""
  let msg=msg." ".strftime("(Modified %b,%d %y %H:%M:%S)",getftime(filename))
  return msg
endf

fun! CurTime()
  let ftime=""
  let ftime=ftime." ".strftime("%b,%d %y %H:%M:%S")
  return ftime
endf

slr.vim script#1501 is useful too. It allows the setting of multiple status lines and provides macros to switch between them.


Around Wikia's network

Random Wiki