为什么statusline的%R不起作用?

Vim、Emacs配置和使用
回复
头像
redhatlinux10
帖子: 773
注册时间: 2008-01-22 23:24
来自: 三亚
联系:

为什么statusline的%R不起作用?

#1

帖子 redhatlinux10 » 2011-06-07 17:45

我写了个简单的vimscript函数,用于定制statusline
[vim]
set statusline=%!NpplikeStatusLine()
set laststatus=2
function NpplikeStatusLine()
let ft = &fileencoding
let bom = &bomb
let bommsg = bom ? ' with BOM' : ' without BOM'
if ft ==? 'utf-8'
let ret = '[%R] [FORMAT=%{&ff}] [ENCODING=%{&fileencoding}'
let ret .= bommsg
let ret .= '] [TYPE=%Y] [ASCII=\%03.3b] [HEX=\%02.2B] [POS=%04l,%04v][%p%%] [LINES=%L]'
return ret
else
return '[%R] [FORMAT=%{&ff}] [ENCODING=%{&fileencoding}] [TYPE=%Y] [ASCII=\%03.3b] [HEX=\%02.2B] [POS=%04l,%04v][%p%%] [LINES=%L]'
endfunction
[/vim]
可是令人奇怪的是,为什么显示后,%R没有值呢?%Y都是有的。
截图00.jpg
我用的是windowsxp上面的gvim 7.3
头像
lilydjwg
论坛版主
帖子: 4249
注册时间: 2009-04-11 23:46
系统: Arch Linux
联系:

Re: 为什么statusline的%R不起作用?

#2

帖子 lilydjwg » 2011-06-07 18:15

好长。。。。

你的文件不是只读的,当然就没有了。
头像
redhatlinux10
帖子: 773
注册时间: 2008-01-22 23:24
来自: 三亚
联系:

Re: 为什么statusline的%R不起作用?

#3

帖子 redhatlinux10 » 2011-06-07 22:14

lilydjwg 写了:好长。。。。

你的文件不是只读的,当然就没有了。
一语点醒梦中人。
回复