Merge branch 'MacVim'
[MacVim/KaoriYa.git] / src / MacVim / gvimrc
blob0051e957805b35ff681ba459bce3831368cb4dd4
1 " System gvimrc file for MacVim
3 " Maintainer:   Bjorn Winckler <bjorn.winckler@gmail.com>
4 " Last Change:  Sun Aug 29 2009
6 " This is a work in progress.  If you feel so inclined, please help me improve
7 " this file.
10 " Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise
11 " <CR> would not be recognized.  See ":help 'cpoptions'".
12 let s:cpo_save = &cpo
13 set cpo&vim
17 " Global default options
20 if !exists("syntax_on")
21   syntax on
22 endif
24 if !exists("colors_name")
25     " Use the macvim color scheme by default
26     colorscheme macvim
27 endif
29 " To make tabs more readable, the label only contains the tail of the file
30 " name and the buffer modified flag.
31 set guitablabel=%M%t
34 " Send print jobs to Preview.app.  This does not delete the temporary ps file
35 " that is generated by :hardcopy.
36 set printexpr=system('open\ -a\ Preview\ '.v:fname_in)\ +\ v:shell_error
39 " This is so that HIG Cmd and Option movement mappings can be disabled by
40 " adding the line
41 "   let macvim_skip_cmd_opt_movement = 1
42 " to the user .vimrc
44 if !exists("macvim_skip_cmd_opt_movement")
45   no   <D-Left>       <Home>
46   no!  <D-Left>       <Home>
47   no   <M-Left>       <C-Left>
48   no!  <M-Left>       <C-Left>
50   no   <D-Right>      <End>
51   no!  <D-Right>      <End>
52   no   <M-Right>      <C-Right>
53   no!  <M-Right>      <C-Right>
55   no   <D-Up>         <C-Home>
56   ino  <D-Up>         <C-Home>
57   map  <M-Up>         {
58   imap <M-Up>         <C-o>{
60   no   <D-Down>       <C-End>
61   ino  <D-Down>       <C-End>
62   map  <M-Down>       }
63   imap <M-Down>       <C-o>}
65   imap <M-BS>         <C-w>
66   imap <D-BS>         <C-u>
67 endif " !exists("macvim_skip_cmd_opt_movement")
70 " This is so that the HIG shift movement related settings can be enabled by
71 " adding the line
72 "   let macvim_hig_shift_movement = 1
73 " to the user .vimrc (not .gvimrc!).
75 if exists("macvim_hig_shift_movement")
76   " Shift + special movement key (<S-Left>, etc.) and mouse starts insert mode
77   set selectmode=mouse,key
78   set keymodel=startsel,stopsel
80   " HIG related shift + special movement key mappings
81   nn   <S-D-Left>     <S-Home>
82   vn   <S-D-Left>     <S-Home>
83   ino  <S-D-Left>     <S-Home>
84   nn   <S-M-Left>     <S-C-Left>
85   vn   <S-M-Left>     <S-C-Left>
86   ino  <S-M-Left>     <S-C-Left>
88   nn   <S-D-Right>    <S-End>
89   vn   <S-D-Right>    <S-End>
90   ino  <S-D-Right>    <S-End>
91   nn   <S-M-Right>    <S-C-Right>
92   vn   <S-M-Right>    <S-C-Right>
93   ino  <S-M-Right>    <S-C-Right>
95   nn   <S-D-Up>       <S-C-Home>
96   vn   <S-D-Up>       <S-C-Home>
97   ino  <S-D-Up>       <S-C-Home>
99   nn   <S-D-Down>     <S-C-End>
100   vn   <S-D-Down>     <S-C-End>
101   ino  <S-D-Down>     <S-C-End>
102 endif " exists("macvim_hig_shift_movement")
105 " Restore the previous value of 'cpoptions'.
106 let &cpo = s:cpo_save
107 unlet s:cpo_save
110 " vim:set ts=8 sts=2 sw=2 tw=0: (この行に関しては:help modelineを参照)
112 " An example for a Japanese version gvimrc file.
113 " 日本語版のデフォルトGUI設定ファイル(gvimrc) - Vim7用試作
115 " Last Change: 08-Jul-2007.
116 " Maintainer:  MURAOKA Taro <koron@tka.att.ne.jp>
118 " 解説:
119 " このファイルにはVimの起動時に必ず設定される、GUI関連の設定が書かれていま
120 " す。編集時の挙動に関する設定はvimrcに書かかれています。
122 " 個人用設定は_gvimrcというファイルを作成しそこで行ないます。_gvimrcはこの
123 " ファイルの後に読込まれるため、ここに書かれた内容を上書きして設定することが
124 " 出来ます。_gvimrcは$HOMEまたは$VIMに置いておく必要があります。$HOMEは$VIM
125 " よりも優先され、$HOMEでみつかった場合$VIMは読込まれません。
127 " 管理者向けに本設定ファイルを直接書き換えずに済ませることを目的として、サイ
128 " トローカルな設定を別ファイルで行なえるように配慮してあります。Vim起動時に
129 " サイトローカルな設定ファイル($VIM/gvimrc_local.vim)が存在するならば、本設
130 " 定ファイルの主要部分が読み込まれる前に自動的に読み込みます。
132 " 読み込み後、変数g:gvimrc_local_finishが非0の値に設定されていた場合には本設
133 " 定ファイルに書かれた内容は一切実行されません。デフォルト動作を全て差し替え
134 " たい場合に利用して下さい。
136 " 参考:
137 "   :help gvimrc
138 "   :echo $HOME
139 "   :echo $VIM
140 "   :version
142 "---------------------------------------------------------------------------
143 " サイトローカルな設定($VIM/gvimrc_local.vim)があれば読み込む。読み込んだ後
144 " に変数g:gvimrc_local_finishに非0な値が設定されていた場合には、それ以上の設
145 " 定ファイルの読込を中止する。
146 if 1 && filereadable($VIM . '/gvimrc_local.vim')
147   source $VIM/gvimrc_local.vim
148   if exists('g:gvimrc_local_finish') && g:gvimrc_local_finish != 0
149     finish
150   endif
151 endif
153 "---------------------------------------------------------------------------
154 " ユーザ優先設定($HOME/.gvimrc_first.vim)があれば読み込む。読み込んだ後に変
155 " 数g:gvimrc_first_finishに非0な値が設定されていた場合には、それ以上の設定
156 " ファイルの読込を中止する。
157 if 0 && exists('$HOME') && filereadable($HOME . '/.gvimrc_first.vim')
158   unlet! g:gvimrc_first_finish
159   source $HOME/.gvimrc_first.vim
160   if exists('g:gvimrc_first_finish') && g:gvimrc_first_finish != 0
161     finish
162   endif
163 endif
165 "---------------------------------------------------------------------------
166 " Bram氏の提供する設定例をインクルード (別ファイル:vimrc_example.vim)。これ
167 " 以前にg:no_gvimrc_exampleに非0な値を設定しておけばインクルードしない。
168 if 1 && (!exists('g:no_gvimrc_example') || g:no_gvimrc_example == 0)
169   source $VIMRUNTIME/gvimrc_example.vim
170 endif
172 "---------------------------------------------------------------------------
173 " カラー設定:
174 "colorscheme morning
176 "---------------------------------------------------------------------------
177 " フォント設定:
179 if has('win32')
180   " Windows用
181   set guifont=MS_Gothic:h12:cSHIFTJIS
182   "set guifont=MS_Mincho:h12:cSHIFTJIS
183   " 行間隔の設定
184   set linespace=1
185   " 一部のUCS文字の幅を自動計測して決める
186   if has('kaoriya')
187     set ambiwidth=auto
188   endif
189 elseif has('mac') || has('gui_macvim')
190   set guifont=Osaka-Mono:h14
191   set guifontwide=Osaka-Mono:h14
192 elseif has('xfontset')
193   " UNIX用 (xfontsetを使用)
194   set guifontset=a14,r14,k14
195 endif
197 "---------------------------------------------------------------------------
198 " ウインドウに関する設定:
200 " ウインドウの幅
201 set columns=80
202 " ウインドウの高さ
203 set lines=25
204 " コマンドラインの高さ(GUI使用時)
205 set cmdheight=2
206 " 画面を黒地に白にする (次行の先頭の " を削除すれば有効になる)
207 "colorscheme evening " (GUI使用時)
209 "---------------------------------------------------------------------------
210 " 日本語入力に関する設定:
212 if has('multi_byte_ime') || has('xim') || has('mac') || has('gui_macvim')
213   " IME ON時のカーソルの色を設定(設定例:紫)
214   highlight CursorIM guibg=Purple guifg=NONE
215   " 挿入モード・検索モードでのデフォルトのIME状態設定
216   set noimdisable
217   set iminsert=0 imsearch=0
218   if has('xim') && has('GUI_GTK')
219     " XIMの入力開始キーを設定:
220     " 下記の s-space はShift+Spaceの意味でkinput2+canna用設定
221     "set imactivatekey=s-space
222   endif
223   " 挿入モードでのIME状態を記憶させない場合、次行のコメントを解除
224   "inoremap <silent> <ESC> <ESC>:set iminsert=0<CR>
225 endif
227 "---------------------------------------------------------------------------
228 " マウスに関する設定:
230 " 解説:
231 " mousefocusは幾つか問題(一例:ウィンドウを分割しているラインにカーソルがあっ
232 " ている時の挙動)があるのでデフォルトでは設定しない。Windowsではmousehide
233 " が、マウスカーソルをVimのタイトルバーに置き日本語を入力するとチラチラする
234 " という問題を引き起す。
236 " どのモードでもマウスを使えるようにする
237 set mouse=a
238 " マウスの移動でフォーカスを自動的に切替えない (mousefocus:切替る)
239 set nomousefocus
240 " 入力時にマウスポインタを隠す (nomousehide:隠さない)
241 set mousehide
242 " ビジュアル選択(D&D他)を自動的にクリップボードへ (:help guioptions_a)
243 "set guioptions+=a
245 "---------------------------------------------------------------------------
246 " メニューに関する設定:
248 " 解説:
249 " "M"オプションが指定されたときはメニュー("m")・ツールバー("T")供に登録され
250 " ないので、自動的にそれらの領域を削除するようにした。よって、デフォルトのそ
251 " れらを無視してユーザが独自の一式を登録した場合には、それらが表示されないと
252 " いう問題が生じ得る。しかしあまりにレアなケースであると考えられるので無視す
253 " る。
255 if &guioptions =~# 'M'
256   let &guioptions = substitute(&guioptions, '[mT]', '', 'g')
257 endif
259 "---------------------------------------------------------------------------
260 " その他、見栄えに関する設定:
262 " 検索文字列をハイライトしない(_vimrcではなく_gvimrcで設定する必要がある)
263 "set nohlsearch
265 "---------------------------------------------------------------------------
266 " 印刷に関する設定:
268 " 注釈:
269 " 印刷はGUIでなくてもできるのでvimrcで設定したほうが良いかもしれない。この辺
270 " りはWindowsではかなり曖昧。一般的に印刷には明朝、と言われることがあるらし
271 " いのでデフォルトフォントは明朝にしておく。ゴシックを使いたい場合はコメント
272 " アウトしてあるprintfontを参考に。
274 " 参考:
275 "   :hardcopy
276 "   :help 'printfont'
277 "   :help printing
279 " 印刷用フォント
280 if has('printer')
281   if has('win32')
282     set printfont=MS_Mincho:h12:cSHIFTJIS
283     "set printfont=MS_Gothic:h12:cSHIFTJIS
284   endif
285 endif
287 " Copyright (C) 2007 KaoriYa/MURAOKA Taro