標籤

4GL (1) 人才發展 (10) 人物 (3) 太陽能 (4) 心理 (3) 心靈 (10) 文學 (31) 生活常識 (14) 光學 (1) 名句 (10) 即時通訊軟體 (2) 奇狐 (2) 爬蟲 (1) 音樂 (2) 產業 (5) 郭語錄 (3) 無聊 (3) 統計 (4) 新聞 (1) 經濟學 (1) 經營管理 (42) 解析度 (1) 遊戲 (5) 電學 (1) 網管 (10) 廣告 (1) 數學 (1) 機率 (1) 雜趣 (1) 證券 (4) 證券期貨 (1) ABAP (15) AD (1) agentflow (4) AJAX (1) Android (1) AnyChart (1) Apache (14) BASIS (4) BDL (1) C# (1) Church (1) CIE (1) CO (38) Converter (1) cron (1) CSS (23) DMS (1) DVD (1) Eclipse (1) English (1) excel (5) Exchange (4) Failover (1) Fedora (1) FI (57) File Transfer (1) Firefox (3) FM (2) fourjs (1) Genero (1) gladiatus (1) google (1) Google Maps API (2) grep (1) Grub (1) HR (2) html (23) HTS (8) IE (1) IE 8 (1) IIS (1) IMAP (3) Internet Explorer (1) java (4) JavaScript (22) jQuery (6) JSON (1) K3b (1) ldd (1) LED (3) Linux (120) Linux Mint (4) Load Balance (1) Microsoft (2) MIS (2) MM (51) MSSQL (1) MySQL (27) Network (1) NFS (1) Office (1) OpenSSL (1) Oracle (131) Outlook (3) PDF (6) Perl (60) PHP (33) PL/SQL (1) PL/SQL Developer (1) PM (3) Postfix (2) postfwd (1) PostgreSQL (1) PP (50) python (5) QM (1) Red Hat (4) Reporting Service (28) ruby (11) SAP (234) scp (1) SD (16) sed (1) Selenium (3) Selenium-WebDriver (5) shell (5) SQL (4) SQL server (8) sqlplus (1) SQuirreL SQL Client (1) SSH (3) SWOT (3) Symantec (2) T-SQL (7) Tera Term (2) tip (1) tiptop (24) Tomcat (6) Trouble Shooting (1) Tuning (5) Ubuntu (37) ufw (1) utf-8 (1) VIM (11) Virtual Machine (2) VirtualBox (1) vnc (3) Web Service (2) wget (1) Windows (19) Windows (1) WM (6) Xvfb (2) youtube (1) yum (2)

2014年8月5日 星期二

tiptop:呼叫SQL and DATE 轉換STRING


 
DEFINE p_date  DATE
DEFINE s_date  VARCHAR(10)

LET s_date = g_oea.oea02 USING "yyyy/mm/dd"
PREPARE s2 FROM "select ds.axmt410.get_oeb15(?,?) from dual"
EXECUTE s2 USING g_oea.ta_oea07,s_date INTO p_date
FREE s2


(axmt410.get_oeb15的參數都是VARCHAR2)

鼎新 ERP 技轉課程之 TIPTOP GP 程式開發

http://magicliao.wordpress.com/2010/12/01/%E9%BC%8E%E6%96%B0-erp-%E6%8A%80%E8%BD%89%E8%AA%B2%E7%A8%8B%E4%B9%8B-tiptop-gp-%E7%A8%8B%E5%BC%8F%E9%96%8B%E7%99%BC/

環境架構:
  p_zx 為建立使用者帳號的畫面
  使用 TELNET 或 SSH 模式登入的話需要在 LINUX 主機建立對應帳號
  執行程式呼叫 r.r2 或 exe2 加程式名稱,r.r2 只能在當下目錄執行
  執行主功能呼叫 udm7,Web 模式自動呼叫這支程式
  在 TIPTOP 任何一支程式中按下 Ctrl+G 可開出 Command Run 畫面
TIPTOP 資料區:
  正式區─公司正常運作的區域
  測試區─系統測試用,練習操作或測試功能
  標準區─鼎新提供版本更新時放在標準區,不可修改
資料夾:
  config─參數檔
  各模組(aap,adm,aim,atm,azz…)─ERP標準模組,標準模組一律為三碼,a開頭為台灣,g開頭為大陸,c開頭為客製,模組名稱在 p_zmd 中查詢及建立
  各模組底下的資料夾:
    4gl: Source Code
    42m: 編譯後的執行檔
    42r: 編譯連結完成的執行檔
    4fd: 畫面檔,舊版為 per
    42f: 編譯後的畫面檔
    sch: 資料結構檔
  系統模組(lib,sub,qry)─系統管理模組,lib及sub是不可單獨執行的
    lib: 所有作業都必需使用的功能,例如判斷權限
    sub: 很多作業都用到的功能,例如自動取號
    qry: 查詢資料的功能
  系統模組會打包成 42x 檔放在 42m 資料夾底下,使用 r.gx 模組代號,手動打包系統模組的 42x
  系統模組函數:
    lib函數為 cl_ 開頭;sub 函數為 s_ 開頭;qry 函數為 q_ 開頭
    p_link 可查詢作業連結,p_findfunc 可查詢函數名稱
作業命名原則:
  一至三碼為模組(範例中的aim),第四碼為程式類型(範例中的第二個i),五至七碼為流水號(範例中的100),範例:aimi100.4gl
  程式類型:i─建檔;q─查詢;t─處理;s─參數設定;p─批次處理;r─報表作業;
變數命名原則:
  修改原有的作業,不要改名,但要搬到客製區底下,畫面檔也要搬到客製區,新增作業時依命名原則存在客製區,可使用 p_zz 定義作業的執行路徑
資料表命名原則:
  前四碼表示資料表開頭,使用二至四碼的英文加數字,後面加上_file,範例:ima_file
  欄位名稱為資料表開頭加上流水號,範例:ima01,ima02…
  特定用途會用資料表開頭加上用途
  索引為資料表開頭加上流水號
  Primary Key 為資料表開頭加pk
  使用 p_zta 查詢所有的資料結構
  資料表的"檔案名稱"及"檔案目的"可以多語系
  欄位的"屬性"分為標準(出貨值)及客製(自行新增)
  欄位的"欄位說明"可以多語系
  「建立Table」的按鈕為新增一個空白資料表,如果已存在會失敗
  「資料庫比對」可用來比對指定的來源與目的資料庫Schema的差異
客製 Table 命名原則:
  tc_xxx_file:客製新增,xxx為三碼英或數字
  ta_xxx_file:修改標準 Table
  不允許修改標準欄位的 type,size,不允許更改欄位用途,不允許使用 No Used 的欄位
Config:
  4ad: 存放程式 Action 代碼與多語系說明,
    TIPTOP 語言代碼:0-繁體中文,1-英文,2-簡體中文
    /語言/系統/程式代碼.4ad
  4tm: Top Menu 的內容檔案,可在 p_base_act 中查詢
  4st: 存放螢幕顯示的 Style
  4tb: Toolbar 的內容檔案,可在 p_zz 中查詢
  4sm: 存放系統 Start Menu 的內容檔案,可在 p_zm 中查詢
    /語言/menu_id.4sm
  top.global: 定義 TIPTOP 全系統共用的全域變數
  schema: 存放 ds.sch 檔案
  dsfgl2.bin: 存放 TIPTOP 提供的系統工具
  log: 程式錯誤記錄
  p_cron: 存放使用者設定的背景作業的相關檔案,使用 p_cron 設定
環境變數:$開頭,一律為大寫
  $XXX─標準模組路徑
  $XXXi─系統模組下的 42r
  $ORALE_SID─Oracle Instance 變數
系統工具:
  rebuild─全系統重新編譯,大概需要兩小時
  r.gf─預覽42f,r.gf formname lang p/c y/n
  將新增作業加到 Start Menu 時使用 p_zm,建立 Start Menu 時使用 p_zz,模組代號為 “MENU"
交談指令:支援 ON ACTION
  CONSTRUCT: 接受畫面輸入的查詢條件轉成 SQL 指令的 WHERE 字串
  INPUT/INPUT ARRAY: 接受畫面輸入的值存到資料庫
  DISPLAY ARRAY: 將資料庫的值顯示到畫面上
  MENU: 表示功能表
  PROMPT: 表示彈出式視窗,通常用於顯示訊息並傳回使用者回覆
  TIPTOP 標準用法在交談指令中必定要加
    ON ACTION controlg:
    ON ACTION help: 提供"說明"的資訊
    ON ACTION about: 提供"關於"的資訊
    ON ACTION locale: 切換語言別
    ON IDLE g_idle_seconds: 處理閒置

2014年8月4日 星期一

vim 配色

http://www.puritys.me/docs-blog/article-110-vim-%E9%85%8D%E8%89%B2.html

預設的 vim 只有 16 種顏色,但是改一改設定檔之後,就能夠用 256 種顏色,使用 256 色前,必需先編輯 ~/.vimrc 的檔案,加入這句 「set t_Co=256」。大小寫要一模一樣,否則就沒有作用了。

我的 vim 配色 (黑)

vim style black

vim 配色程式碼

這段程式碼可以直接寫進 ~/.vimrc ,或是使用建立檔案在 ~/.vim/colors/ 的路徑下,這樣 vim 也會自動載入這個檔案,最後在 ~/vimrc 中加入樣式的名稱 「colorscheme mystyle」。

我的 vim 配色 (白)

黑底白字的配色表看久了,眼睛會開始覺得糢糊,所以後來我又改了一個白底黑字的版本,並且把 c++ , php ,javascript 的 syntax 配色都加上去,用了這個配色之後,字體變清楚了,眼睛也比較不累,又可以長時間加班囉......
vim style white light
這段程式碼可以直接寫進 ~/.vimrc ,或是使用建立檔案在 ~/.vim/colors/ 的路徑下,這樣 vim 也會自動載入這個檔案,最後在 ~/vimrc 中加入樣式的名稱 「colorscheme mystyle_white」。

vim Syntax

除了有配色表之外,還可以針對不同的語言給予不同的 Syntax , 一般來說 c , c++ , php , shell 等等都已經內建在 vim7 的 package 裡了,所以不用煩腦 syntax 問題。
但是像我常常會用 vim 編輯 javascript , 面對沒有 Syntax 的字體,真的是非常辛苦,而增加 javascript syntax 的方式也不會太難,第一步是先下載 javascript syntax http://www.vim.org/scripts/script.php?script_id=1840 ,再將下載回來的檔案改名為 javascript.vim ,並放置在目錄 ~/.vim/syntax/javascrip.vim,最後再更改 「.vimrc」 ,加入語法「 au BufRead,BufNewFile *.sjs set filetype=javascript」。
在製作 vim syntax 配色時,需要一邊修改一邊預覽,這時可以使用 「:syn off | syn on」 這句語法,來重新載入修改後的 syntax 配色表。

其他相關

2014年8月3日 星期日

挑選 Vim 顏色(Color Scheme)

http://blog.longwin.com.tw/2009/03/choose-vim-color-scheme-2009/

Vim 除了預設的顏色外, 除了自己設定, 還是有很多前輩已經設好, 將 Color Scheme 釋放出來.
預設的 default、desert、darkblue 等, 都還蠻不錯的, 另外安裝的 ir_black 也不錯: gVim 的 color scheme (ir_black.vim)

挑選、下載 Vim Color Scheme

哪裡可以挑選這些 Color Scheme 呢?

安裝 Vim Color Scheme

挑選到喜歡的 Color Scheme 後, 安裝步驟:
  1. 下載 COLOR_SCHEME.vim
  2. mkdir ~/.vim/colors/
  3. mv COLOR_SCHEME.vim ~/.vim/colors/
  4. vim ~/.vimrc # 加入下述內容
    colorscheme COLOR_SCHEME
  5. 註1: .vimrc 要記得加 set t_Co=256 來支援 256 色的環境, 才不會覺得跟預覽圖不一樣.
  6. 註2: syntax on ... 這個應該不用多做解釋吧~ XD

於 Vim 執行時, 切換 Color Scheme

  • :colorscheme COLOR_SCHEME 
  •  

2014年8月2日 星期六

工作面試五大要點

http://mag.udn.com/mag/edu/storypage.jsp?f_ART_ID=525266

學校教育通常著重在知識、技能的養成,幫助學生未來能在各產業中發揮所能;然而,要如何爭取到理想工作,卻是時常被忽略的一課。美國網路媒體 THNKR 特此廣邀各領域職涯專家,提醒各位求職朋友面試時需著重的五大重點:
1. Practice and Prepare 練習與準備
萬全準備是求職的關鍵,了解該公司需求,表現出「我不只是要找份工作,而是要為貴公司工作」。此外,面試官不會著重在你過去的職位表現,他們想知道的是「當你面對危機時,你會怎麼處理?」務必準備好此類問題的回答,並多加練習如何清楚表達。

※Due diligence 原為商業用語,指的是企業在併購前對目標公司進行的評估動作,而後衍伸為「審慎調查、實質審查」的意思,現在也經常看到此詞語用在日常生活中。
影片中強調 Do your diligence 就是要求職者在前往面試之前,務必先調查該公司整體背景、營運狀況等,才能讓面試官感受到 You come prepared.(你有備而來)。
2. Be Memorable 加深印象
回答面試官問題時,切記以下三重點:
一、確實回答問題;
二、提出例子,讓面試官留下深刻印象;
三、表達出你的答案對他們、以及對那份工作來說是非常重要的。
面試官通常不是決定是否要雇用你的人,他們需要將資訊轉達至最終決策者,若你的應答能脫穎而出,爭取到職位的機會也相對提高。

3. Think about Perspective 想想對方觀點
「知己知彼,百戰百勝」了解該公司需求,站在面試官角度思考。美國商管類涯暢銷書作者丹尼爾·品克(Daniel H. Pink)表示,許多求職者總是積極推銷自己的能力,強調「該職位由我接手必會不同凡響」;但面試官想要的是「能讓他們的生活更好過」的人,若能表現出這 一面,便能增加你的吸引力。

4. Honesty is the Best Policy 誠實為上策
若是與前公司不歡而散,或是因為某種原因遭到開除,別隱瞞、別說謊。在這資訊交流發達的年代,要查出你的背景完全不費力。記得,別數落前公司的不是,而是要準備談談價值觀的問題,說明你的離開是因為 value clash(價值觀衝突),而不是能力或態度問題。

5. Be Aware of Body Language 注意肢體語言
除言語表達外,肢體語言也能透露出你是否能勝任該職位。面試者常因緊張而往後退、雙手縮到桌面下、或是交叉雙腳,但這些動作都使你變得渺小,可能也表現出不真誠的樣子。將身體稍微往前傾、雙手置於可見範圍、維持良好視線接觸,如此才能傳達熱情及自信。

表現出可靠、真誠、誠實。若不受青睞,表示你並不適合該公司,千萬別放棄,總是會有更好的工作會出現在求職路上。

2014年7月31日 星期四

sz and rz : file transfer command in teraterm over ans SSH connection

http://marge.phys.washington.edu/software/SSH_File_Transfer.html

How to transfer files over an SSH connection


This HOWTO focuses on the situation where the user connects from a Windows machine using TeraTerm with the SSH extension. The server is assumed be a Unix-like machine which will only accept SSH connections from the client.
In most of the examples, the server is assumed to be named "remote," the local machine to be named "local," and the file to be named "foo."

Samba

This ducks the entire issue. For a permanent installation, Samba is the way to go. Samba is a fantastically useful program which allows files residing on a unix machine to be shared with Windows machines. The Unix machine will appear in the Network Neighborhood, and fine-grained control is available to select which files are available to which users. Printing support is also provided. Samba has to be installed by the system administrator. Be sure to run NT service pack 3 or above, Windows 98, or recent upgrades to Windows 95, otherwise your password will be leaked to the network. Also, be sure to enable encrypted passwords in Samba, otherwise it will not be able to talk to the Windows clients. Samba can be installed by your system administrator

SCP

If you're connecting from a unix-like machine to a unix-like machine, this HOWTO is not for you. Your situation is much easier. Use the command "scp" which is analogous to the more common "rcp." If you want to copy the file "foo" to the machine "remote" you would issue the following command:   scp foo remote:
Note the colon at the end of the line. If you omit the colon, you will just make a local copy of the file named "remote."
See the man page on scp for more information.
 

Modem-Style Transfer Programs

One way to transfer files over an SSH connection is to use modem-to-modem transfer protocols like kermit or xmodem. This is probably the easiest to set up. All the communication which would normally take place between two modems is piped through the SSH connection. There's a lot of extra overhead to this technique, so it may not be the best for large files over slow connections. Of the available options, ZModem is probably the easiest to use.

ZModem: Uploading Local to Remote

  1. From the command line on the remote machine, type "sz filename"  You can specify multiple filenames on the same command line. You will see some garbage appear on the screen. This is the sz program waiting to hear the correct response. Your screen will look approximately like this:

  2. [zager@marge zager]$ sz foo
    Š*B00000000000000
  3. From the File menu in TeraTerm, select Transfer|ZMODEM|Receive. The file transfer should begin.

ZModem: Downloading Remote to Local

  1. From the command line, type "rz"  You do not need to specify a filename. rz will produce some garbage on the screen. Your screen will look approximately like this.

  2. [zager@marge zager]$ rz
    Šz waiting to receive.**B0100000023be50
  3. From the File menu in TeraTerm, select Transfer|ZMODEM|Send... You should see a standard Windows file selection dialog. Select the file(s) you would like to send, click the "Open" button. The transfer should start
If something goes wrong with the transfer, sz and rz should both time out eventually. Pressing Control-C, Control-Z, and otherwise pounding on the keyboard has little effect. sz and rz are programs which can be installed and run as a regular user. No special priviledges are required.

FTP

It is much harder to configure FTP to work over an SSH connection. The reason to do this is that you have some nifty graphical FTP clients on your PC which you enjoy using, and use often. That will make it worth the setup. Otherwise, you are encouraged to take a second look at the section above.

Overview

The SSH protocol includes a feature known as "port-forwarding." This allows a network connection which looks like it begins at one end of the SSH connection to be sent through SSH to the remote end, and passed on elsewhere. We will tell the LOCAL machine to listen for an ftp connection, then forward that connection to the REMOTE machine. Then, to make use of this new link, we will tell our FTP client to connect to the LOCAL machine instead of the REMOTE one.

Preconditions

  1. The remote server must be configured to allow ftp connections from itself, even though it does not allow connections from the outside world. The system administrator will have to do this. It may also be possible for you to run your own renegade ftp server on a non-priviledged port.
  2. Your ftp client must support passive mode. The default ftp clients in Windows 95 and Windows NT do not support passive mode. The fancier ftp programs generally do. Internet Neighborhood, available at http://www.knoware.com is a nice ftp program which does support passive mode.
  3. You must have the SSH plug-in version 1.4 or higher. Maybe version 1.3 would work, I never saw it. But version 1.2 does not support port forwarding.

Configuring TeraTerm-SSH

  1. Select the TeraTerm menu option Setup|SSH Forwarding... If you do not have an option "SSH Forwarding..." under your Setup menu, then you need to upgrade your version of the SSH plugin.
  2. Click on the Add button
  3. Forward from the local port "ftp" to the remote machine "remote" , port "ftp."
  4. Click on the Ok button
  5. The "Port Forwarding" list should now have one entry: "Local 21 (ftp) to remote "remote" port 21 (ftp)."
  6. Click on the Ok button
  7. Select the menu option Setup|Save Setup... to make your changes permanent.

Configuring your FTP Client

The particulars of how to do this will vary with your FTP client. But there are two major steps:
  1. Tell your ftp client that you want to connect to "localhost" This is counterintuitive. Remember, the port forwarding is going to magically transmit this connection to the other end, so it's ok.
  2. Tell your ftp client to use passive mode. This may be under settings labeled "advanced" or "firewall." If you are able to log in with your username and password, but are not able to transmit any data, then you have not enabled passive mode.
Once you have done these two steps, you should be able to use the ftp client normally to connect to the remote site.

Special Case: Running an FTP server on the Client

If you are already running an FTP server on the client, then you have a couple extra steps to do. SSH will not be able to set up its port forwarding since your ftp server will already have control of the ftp port. The solution is to use a non-standard port for the ftp connection.
When configuring Tera-Term SSH, instead of forwarding from the port "ftp," pick a free port. You really should check what ports are free, but a number like 54321 might be safe. The number should be over 1000 and less than 65536.
When configuring the FTP client, look for a "port" option and set that to the same port as you set for SSH. This is likely be be near where you set the name of the machine to which you connect. (Which you set to "localhost," right?) There is also probably a "port" option near firewall settings, but this is probably not what you're after.

Other Tricks

Forwarding Mail Connections

The standard POP and IMAP mail protocols blab your username and password in cleartext, just like ftp would. If you use mail programs like Eudora, Outlook, or Netscape Messenger, your password is probably being leaked. You can do a similar trick of forwarding POP, POP3, or IMAP traffic through SSH to secure these connections. Note that you will need to have an SSH window open to the server in order to check your mail.

VIM syntax highlight


1. 在$HOME/.vimrc加上以下內容

colorscheme default
set term=ansi
syntax on

2. http://www.cnblogs.com/ifantastic/p/3524751.html

Vim手记:语法高亮

本文覆盖范围:
  • Vim的着色方案
  • 设置高亮
  • 选择颜色
  • 语法高亮除错
每个程序员的文本编辑器缺少了语法高亮、特殊关键字和短语着色,都是不完整的。语法高亮突出了文档的结构,帮助发现排字错误,利于调试,整体上让文本编辑更轻松更有效率。本篇我们将探讨一下Vim的语法高亮范式以及如何建立和定制着色方案。

Vim着色方案
首先说明,本文谈论的不是哪种颜色最好,而是Vim如何处理语法高亮的问题。

在决定如何给一个文件着色时,Vim首先将文件分解成若干结构组。这些都是通过编写好的语法命令文件来实现,这些文件在Vim加载一个文件的时候就 自动加载了,加载过程则是基于一系列复杂规则。如果Vim选择了一个错误的语法命令文件,你可以通过以下命令手工指定一个正确的文件:
:set syn=syntax-type

其中syntax-type是一个文件的类型。通常文件类型就是文件扩展名,例如选择PHP语法高亮,则将syntax-type设置为“php”。

Vim主要使用以下九种高亮分组:
Comment    : 注释
Constant   : 常量,例如数字、引号内字符串、布尔值。
Identifier : 变量标识符名称。
Statement  : 编程语言的声明,一般是像“if”或“while”这样的关键字。
PreProc    : 预处理,例如C语言中的“#include”。
Type       : 变量类型,例如“int”。
Special    : 特殊符号,通常是类似字符串中的“\n”。
Underlined : 文本下划线。
Error      : 显示编程语言错误的文本。

另外还有一个分组叫做Normal,表示普通文本。

也许你已经注意到,这些高亮分组主要针对编程语言,这是因为语法高亮对它们最有用。但是,Vim的高亮命令覆盖的文件类型远超过编程语言,包括从HTML到EMAIL的任何东西。

Vim还支持三种输出设备:black-and-white terminal(黑白终端),color terminal(彩色终端)和GUI(图形化的用户接口)。因为它们每一个都有自己独特的高亮能力,Vim为它们维护了三个独立的高亮方案。

建立高亮

实现高亮的最简便方式就是使用别人写好的.vimrc文件,就像这个(点击下载)。大多数时候这样做都挺好使。但是,如果它不好使或者你想从头开始,以下就是告诉你如何从头开始。

你必须在你的.vimrc文件的第一行写入:
syntax on

这行命令告诉Vim开始使用语法高亮。如果你暂时不想改动文件,你也可以在Vim窗口输入它作为一行命令。

如果你正在使用黑白终端或者GUI接口,一切都工作得刚刚好。如果你正在使用一个支持彩色的终端,你也许不得不将以下命令置于syntax on上一行:
set term=ansi

你也可以尝试一下color_xterm来代替ansi。

选择颜色

Vim有一套默认颜色方案,在我看来,有点过度明亮和混乱(注释和变量颜色是一样的)。但是每个人都有一套自己的颜色偏好,因此你可能会很想了解如何改变它的色彩来符合自己的口味。

Vim着色使用:highlight和:hi命令。:hi命令实际上是多用途命令,它负责许多例行着色,我们仅用它的颜色选择功用。它具有以下语法:
:hi Group key=value ...

Group就是前面所说的9个高亮分组名。

key-value键值对规定了不同输出终端的高亮值。这里有三个基本键名:term、cterm和gui,代表着黑白终端、彩色终端和图形界面。 除了term以外,另外两个基本键还有两个扩展键名base-namefg和base-namebg,分别代表对应终端的前景和背景颜色。基本键只能拥有 非色彩的高亮值,例如加粗和下划线。

以下是一些高亮键和它们可能的值:
term/cterm/gui: bold, underline, reverse, italic, none

ctermfg/ctermbg: red, yellow, green , blue, magenta, cyan, white, blcak, gray

guifg/guibg: 以上所有颜色,而且还可以使用#rrggbb格式色彩。

例如,我想高亮我的预处理声明为bright magenta,可以使用如下命令:
:hi PreProc ctermfg=magenta cterm=bold guifg=#FF00FF

注意,我可以在一行中使用多个键值对,他们都会应用于同一个高亮分组。

通常来说,只要你喜欢一个着色方案,你可以将它设置在你的~/.vimrc文件中,Vim会自动将其加载。

语法高亮除错

Vim的语法高亮偶尔也存在一些小问题,我就经常遭遇到其中的三个。

没有彩色,只有黑白终端高亮。
导致这种情况的最常见的原因是Vim无法确定终端是否具备彩色能力。要修复它,首先确保在.vimrc文件第一行设置了term=ansi,一定要 在syntax on所在行之前。另外还要在shell中将环境变量TERM设置为color_xterm和color-xterm。

颜色有了,但不是我想要的。
这常发生在你试图修改别人的.vimrc文件以为己用的时候。有时,你只需要将自己的色彩定义全部放到文件的底部去就可以修复。如果不奏效的话,检查所有可疑的代码,然后将它们注释。(注释方法为在行首添加双引号)

滚屏时颜色乱成一团
Vim在确定高亮法则的时候使用多种探索方法来节约时间,有时这会造成一些故障。查看:h syn-sync可以得到更多细节。要修复这个,你可使用以下命令:
syn sync minlines=1000

你也可以在.vimrc文件中设置更大的数值。在Vim 6.0及以上版本,你可以使用以下命令:
syn sync fromstart

该命令强制高亮引擎从文件第一行开始解析文件,这对大文件而言会很慢,但它可以确保色彩准确度。

此时此刻,如果你习惯了使用Vim,并且你已经鼓捣了一阵它的配置,发现一些你喜欢的特性,恭喜你,你现在是一个Vim User了。当然,在本教程中我还会教更多的关于Vim的东西,有人写了一整本关于编程的书,但我希望你从本教程可以掌握一些基础知识并且探索更多知识。 享受学习,这是一项你永远不会后悔拥有的技能。