Wednesday, August 25, 2010

改用 Emacs

在 VIM 使用到這種程度之後,覺得有點頂到 VIM 的 glass ceiling 了:

Sunday, August 08, 2010

Tuesday, July 27, 2010

在 Windows 的 VIM 中顯示中文


if has("multi_byte")if has("multi_byte")
set encoding=utf-8
setglobal fileencoding=big5
set fileencoding=big5
set bomb
set termencoding=big5
set fileencodings=ucs-bom,taiwan,utf-8,prc,ucs-2le,latin1
set guifont=Consolas:h11
set guifontwide=細明體:h11
else
echoerr "Sorry, this version of (g)vim was not compiled with multi_byte"
endif


has("multi_byte")測試在 compile vim 時有沒有加入 multibyte 支援。如果沒有,就不能用 Unicode 了。

"encoding"設定 vim 內部如何表示字元。如果要用 Unicode 的話,Utf-8 是個不錯的選擇。

"fileencoding" sets the encoding for a particular file (local to buffer);

:setglobal sets the default value. An empty value can also be used: it defaults to same as "encoding". Or you may want to set one of the ucs encodings, It might make the same disk file bigger or smaller depending on your particular mix of characters. Also, IIUC, utf-8 is always big-endian (high bit first) while ucs can be big-endian or little-endian, so if you use it, you will probably need to set "bomb" (see below).

"bomb" (boolean)如果設定的話,vim 會在 ucs 的檔案開頭放個 "byte order mark"。這個和大多數不是 ucs 的檔案無關(utf-8, iso-8859, etc.) 有興趣想瞭解的人可以看看 http://www.unicode.org/faq/utf_bom.html 。

"termencoding" defines how your keyboard encodes what you type. The value you put there will depend on your locale: iso-8859-15 is Latin1 + Euro currency sign, but you may want something else for, say, an Eastern European keyboard.

"fileencodings" defines the heuristic to set "fileencoding" (local to buffer) when reading an existing file. The first one that matches will be used (and, IIUC, if there is no match, Vim falls back on Latin1).

Ucs-bom is "ucs with byte-order-mark"; it must not come after utf-8 if you want it to be used.

Monday, June 28, 2010

了解/瞭解

「為了解這個問題」
「為瞭解這個問題」

還是用瞭解好。

Saturday, May 22, 2010

Firefox 全螢幕下顯示 Tabs

在 about:config 裏設定:
browser.fullscreen.autohide False
browser.fullscreen.animateUp 0
即可

Thursday, May 20, 2010

"tons of typos in the comments"

http://x264dev.multimedia.cx/?p=377

"The code quality is much better than VP3, though there's still tons of
typos in the comments."

公司規定 source code 中的註解只能使用英文,
如果不要出現 ASCII 值大於 127 的就叫英文的話,那 "tons of typos" 不知道該
算什麼?

Friday, May 14, 2010

[VMware] 讓 Ctrl-Alt-Ins 變成關機,而不是重開機

找到 /etc/rc6.d/S90reboot,編輯裡面的內容,原來為:

log_action_msg "Will now restart"
reboot -d -f -i

改為:

log_action_msg "Will now shut down"
poweroff -v

[VMware] 在登入畫面顯示 IP

在 /etc/network/if-up.d/ 目錄中加一個檔案 issue,內容如下:

#!/bin/sh

if [ "$METHOD" = loopback ]; then
exit 0
fi

# Only run from ifup
if [ "$MODE" != start ]; then
exit 0
fi

cp /etc/issue.ip /etc/issue
/sbin/ifconfig | grep "inet addr" | grep -v "127.0.0.1" | awk '{ print $2 }' | awk -F: '{ print $2 }' >> /etc/issue
echo "" >> /etc/issue

編輯完後,記得要 chmod +x issue。

把 /etc/ 中原來的 issue 複製一份為 issue.ip 好讓我們的 script 有原始的
issue 來源。

下次重開機,就會出現虛擬機的 IP address 在 login 畫面了。

Thursday, May 06, 2010

頭文字大寫的使用

在這兩個地方找到頭文字大寫,其他小寫的使用規則:
http://henshaw.me/704/rules-for-capitalization-in-a-title
http://aitech.ac.jp/~ckelly/midi/help/caps.html

一般是給文章的標題使用,大概因為歌名也算是歌詞的標題,所以一體適用吧。