代碼格式使用每個制表符(tab)4列的空白, 目前是保留制表符狀態(也就是說制表符不被展開為空白)。
對於使用 Emacs 的人,把下面行(或者類似的東西)增加到你的 ~/.emacs 初始化文件裡面去:
;; check for files with a path containing "postgres" or "pgsql"
(setq auto-mode-alist
(cons '("\\(postgres\\|pgsql\\).*\\.[ch]\\'" . pgsql-c-mode)
auto-mode-alist))
(setq auto-mode-alist
(cons '("\\(postgres\\|pgsql\\).*\\.cc\\'" . pgsql-c-mode)
auto-mode-alist))
(defun pgsql-c-mode ()
;; sets up formatting for PostgreSQL C code
(interactive)
(c-mode)
(setq-default tab-width 4)
(c-set-style "bsd") ; set c-basic-offset to 4, plus other stuff
(c-set-offset 'case-label '+) ; tweak case indent to match PG custom
(setq indent-tabs-mode t)) ; make sure we keep tabs when indenting
對於 vi,你的 ~/.vimrc 或者相當的文件應該包含下面的東西:
set tabstop=4
或者在 vi 裡面輸入
:set ts=4
純文字瀏覽工具 more 和 less 可以用下面命令調用
more -x4 less -x4