Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
8dc8f44f
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8dc8f44f
编写于
9月 07, 2006
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update Emacs/vim editor info.
上级
c84db61c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
103 addition
and
40 deletion
+103
-40
doc/src/FAQ/FAQ_DEV.html
doc/src/FAQ/FAQ_DEV.html
+1
-1
doc/src/sgml/sources.sgml
doc/src/sgml/sources.sgml
+6
-39
src/tools/editors/emacs.samples
src/tools/editors/emacs.samples
+78
-0
src/tools/editors/vim.samples
src/tools/editors/vim.samples
+18
-0
未找到文件。
doc/src/FAQ/FAQ_DEV.html
浏览文件 @
8dc8f44f
...
...
@@ -370,7 +370,7 @@
less:
less -x4
</PRE>
<P>
The
<I>
tools
</I>
directory of the latest sources contains sample
<P>
The
<I>
tools
/editors
</I>
directory of the latest sources contains sample
settings that can be used with the
<I>
emacs, xemacs
</I>
and
<I>
vim
</I>
editors, that assist in keeping to PostgreSQL coding standards.
</P>
...
...
doc/src/sgml/sources.sgml
浏览文件 @
8dc8f44f
<!-- $PostgreSQL: pgsql/doc/src/sgml/sources.sgml,v 2.1
7 2006/03/10 19:10:49
momjian Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/sources.sgml,v 2.1
8 2006/09/07 00:10:46
momjian Exp $ -->
<chapter id="source">
<title>PostgreSQL Coding Conventions</title>
...
...
@@ -21,44 +21,11 @@
</para>
<para>
For <productname>Emacs</productname>, add the following (or
something similar) to your <filename>~/.emacs</filename>
initialization file:
<programlisting>
;; 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
</programlisting>
</para>
<para>
For <application>vi</application>, your
<filename>~/.vimrc</filename> or equivalent file should contain
the following:
<programlisting>
set tabstop=4
</programlisting>
or equivalently from within <application>vi</application>, try
<programlisting>
:set ts=4
</programlisting>
The <filename>src/tools</filename> directory contains sample settings
files that can be used with the <productname>emacs</productname>,
<productname>xemacs</productname> or <productname>vim</productname>
editors to help ensure that they format code according to these
conventions.
</para>
<para>
...
...
src/tools/editors/emacs.samples
0 → 100644
浏览文件 @
8dc8f44f
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; This file contains several examples of how to set up emacs and/or xemacs
;;; to edit PostgreSQL code.
;;;
;;; Whichever set you choose would go in your .emacs file or equivalent.
;;;
;;; You only need one of these.
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; This set is known to work with old versions of emacs
(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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Similar approach, known to work with xemacs
;;; Use of a named style makes it easy to use the style elsewhere
(c-add-style "pgsql"
'("bsd"
(indent-tabs-mode . t)
(c-basic-offset . 4)
(tab-width . 4)
(c-offsets-alist .
((case-label . +)))
)
nil ) ; t = set this mode, nil = don't
(defun pgsql-c-mode ()
(c-mode)
(c-set-style "pgsql")
)
(setq auto-mode-alist
(cons '("\\(postgres\\|pgsql\\).*\\.[chyl]\\'" . pgsql-c-mode)
auto-mode-alist))
(setq auto-mode-alist
(cons '("\\(postgres\\|pgsql\\).*\\.cc\\'" . pgsql-c-mode)
auto-mode-alist))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Slightly different approach - use a hook instead of a mode
(add-hook 'c-mode-hook
(function
(lambda nil
(if (string-match "pgsql" buffer-file-name)
(progn
(c-set-style "bsd")
(setq c-basic-offset 4)
(setq tab-width 4)
(c-set-offset 'case-label '+)
(setq indent-tabs-mode t)
)
))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
src/tools/editors/vim.samples
0 → 100644
浏览文件 @
8dc8f44f
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" These settings are appropriate for editing PostgreSQL code with vim
"
" You would copy this into your .vimrc or equivalent
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
:if match(getcwd(), "/pgsql") >=0 || match(getcwd(), "/postgresql") >= 0
: set cinoptions=(0
: set tabstop=4
: set shiftwidth=4
:endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录