<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/main.xsl"?>
<b:blog xmlns="http://www.w3.org/1999/xhtml" xmlns:b="http://blog.othree.net"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://blog.othree.net http://blog.othree.net/blooog.xsd">
	<b:blogTitle>O3noBLOG</b:blogTitle>
	<b:blogDescription></b:blogDescription>
	<b:entries>
		<b:entriesMeta>
			<b:listType>s</b:listType>
			<b:listData listID="000486" baseName="gvim-setting-complete">gVim設定完成</b:listData>

			<b:previous>
				<b:mTitle>網址各部份名稱</b:mTitle>
				<b:mDate>2008/01/18</b:mDate>
				<b:mBase>parts-of-uri</b:mBase>
			</b:previous>


			<b:next>
				<b:mTitle>W3C發佈HTML 5 Working Draft</b:mTitle>
				<b:mDate>2008/01/23</b:mDate>
				<b:mBase>w3c-publish-html-5-wd</b:mBase>
			</b:next>

		</b:entriesMeta>
		<b:entry entryID="000486" baseName="gvim-setting-complete">
			<b:author>
				<b:authorName>othree</b:authorName>
				<b:authorEmail>othree@gmail.com</b:authorEmail>
				<b:authorUrl></b:authorUrl>
			</b:author>
			<b:datetime>
				<b:date>2008-01-23</b:date>
				<b:time>01:05:07</b:time>
			</b:datetime>
			<b:category>vim</b:category>

			<b:CommentsAccepted>1</b:CommentsAccepted>



			<b:PingsAccepted>1</b:PingsAccepted>


			<b:title>gVim設定完成</b:title>
			<b:content>
				<b:summary>最近幾天都在調整家裏和學校電腦的gVim設定，離上次在Windows上用Vim已經好一陣子了，這段時間都是用MadEdit來做為主要的編輯器，不過MadEdit對我來說還有幾個缺點，第一是同時開太多檔案會出錯，第二是預設背景色是白的，要整個重新設定很麻煩，所以最近又重新把Vim裝起來，調整他的設定檔，現在已經調到差不多了，其實還有一些目標想達成，不過還不算必要，而且還找不太到資料，所以就先暫緩。這次我是使用Cornelius的Enhanced Vim Package for Windows為基礎，多加入我之前的一些設定和這次找到的新設定，最後挑了一組還不錯的顏色，然後簡單修改一下，中間比較辛苦的是在字型設定的部份，還好Tiberius剛好發表了程設字型新歡 Inconsolata這篇文章，剛好切中我的問題所在，真是如有神助XD。 在功能的加強上，我找到讓Omni Auto Completion變得更簡單的方法了，之前也說過要Ctrl+x, Ctrl+n兩次組合鍵實在很麻煩，沒想到我在網路上搜尋的過程中，意外發現到這個設定檔，節錄自動完成的部份過來如下： &quot; Omni補完関連 &quot; $VIMRUNTIME/autoload/htmlcomplete.vimの645行目をコメントアウントしておくとhtmlの補完が小文字になる set completeopt=menu,preview,menuone &quot; 補完表示設定 &quot; TabでOmni補完及びポップアップメニューの選択 function InsertTabWrapper(is_shift) if pumvisible() return a:is_shift ? &quot;\&lt;C-p&gt;&quot; : &quot;\&lt;C-n&gt;&quot; endif let col = col('.') - 1 if !col ||...</b:summary>
				<b:mainContent><p>最近幾天都在調整家裏和學校電腦的gVim設定，離上次在Windows上用Vim已經好一陣子了，這段時間都是用<a href="http://madedit.sourceforge.net/">MadEdit</a>來做為主要的編輯器，不過MadEdit對我來說還有幾個缺點，第一是同時開太多檔案會出錯，第二是預設背景色是白的，要整個重新設定很麻煩，所以最近又重新把Vim裝起來，調整他的設定檔，現在已經調到差不多了，其實還有一些目標想達成，不過還不算必要，而且還找不太到資料，所以就先暫緩。這次我是使用Cornelius的<a href="http://c9s.blogspot.com/2007/09/enhanced-gvim-package-for-win32.html">Enhanced Vim Package for Windows</a>為基礎，多加入我之前的一些設定和這次找到的新設定，最後挑了一組還不錯的顏色，然後簡單修改一下，中間比較辛苦的是在字型設定的部份，還好Tiberius剛好發表了<a href="http://sbt.idv.tw/blog/tiberius/2008/01/21/793">程設字型新歡 Inconsolata</a>這篇文章，剛好切中我的問題所在，真是如有神助XD。</p>

<p>在功能的加強上，我找到讓Omni Auto Completion變得更簡單的方法了，之前也說過要Ctrl+x, Ctrl+n兩次組合鍵實在很麻煩，沒想到我在網路上搜尋的過程中，意外發現到<a href="http://relaxedcolumn.blog8.fc2.com/blog-entry-101.html">這個設定檔</a>，節錄自動完成的部份過來如下：</p><pre><code>&quot; Omni補完関連
&quot; $VIMRUNTIME/autoload/htmlcomplete.vimの645行目をコメントアウントしておくとhtmlの補完が小文字になる

set completeopt=menu,preview,menuone &quot; 補完表示設定

&quot; TabでOmni補完及びポップアップメニューの選択
function InsertTabWrapper(is_shift)
    if pumvisible()
        return a:is_shift ? &quot;\&lt;C-p&gt;&quot; : &quot;\&lt;C-n&gt;&quot;
    endif
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ '\k\|&lt;\|/' &quot; htmlで補完できるように&lt;,/でもOmni補完
        return &quot;\&lt;tab&gt;&quot;
    elseif exists('&amp;omnifunc') &amp;&amp; &amp;omnifunc == ''
        return a:is_shift ? &quot;\&lt;C-p&gt;&quot; : &quot;\&lt;C-n&gt;&quot;
    else
        return &quot;\&lt;C-x&gt;\&lt;C-o&gt;&quot;
    endif
endfunction
inoremap &lt;tab&gt; &lt;C-r&gt;=InsertTabWrapper(0)&lt;CR&gt;
&quot; Shift-Tabはうまくいかないようだ
&quot; inoremap &lt;S-tab&gt; &lt;C-r&gt;=InsertTabWrapper(1)&lt;CR&gt;

&quot; CRでOmni確定&amp;改行
function InsertCrWrapper()
    return pumvisible() ? &quot;\&lt;C-y&gt;\&lt;CR&gt;&quot; : &quot;\&lt;CR&gt;&quot;
endfunction
inoremap &lt;CR&gt; &lt;C-r&gt;=InsertCrWrapper()&lt;CR&gt;</code></pre><p>這個設定可以使用Tab鍵來進行自動完成，如果只是直接想要輸入tab，那也可以輸入shift+tab，實際用起來真是想像以上的方便。不過Tab鍵在原來的Enhanced Vim中已經先指派給Snippets了，我是把這部份設定mark起來。</p>

<p><a href="http://www.flickr.com/photos/othree/2209556530/" title="Flickr 上 othree 的 工作環境設定中"><img src="http://farm3.static.flickr.com/2263/2209556530_1039643691.jpg" width="500" height="366" alt="工作環境設定中" /></a></p></b:mainContent>
				<b:extendContent></b:extendContent>
			</b:content>
			<b:comments commentCount="0">

			</b:comments>
			<b:trackbacks trackbackCount="0" trackbackURL="http://othree.net/mt/mt-tb.cgi/484">

			</b:trackbacks>
		</b:entry>
	</b:entries>
</b:blog>