root/dotfiles/vim/kana-vimrc @ 132

Revision 132, 19.6 kB (checked in by kana, 6 years ago)

dotfiles/bash/kana-bash.d, dotfiles/bash/kana-bash_profile, dotfiles/bash/kana-bashrc:
* Import from my repository.
dotfiles/screen/kana-screenrc:
* Import from my repository.
dotfiles/vim/kana-vim, dotfiles/vim/kana-vimrc:
* Import from my repository.

  • Property svn:keywords set to Id
Line 
1" My .vimrc
2" $Id$
3" SETTINGS WHICH ARE ABSOLUTELY NECESSARY  "{{{1
4
5" To use many extensions of Vim.
6set nocompatible
7
8
9" To deal with Japanese language.
10if $ENV_WORKING ==# 'colinux'
11  set encoding=utf-8
12else
13  set encoding=japan
14endif
15if !exists('did_encoding_settings') && has('iconv')
16  let s:enc_euc = 'euc-jp'
17  let s:enc_jis = 'iso-2022-jp'
18
19  " Does iconv support JIS X 0213 ?
20  if iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213')
21     \ ==# "\xad\xc5\xad\xcb"
22    let s:enc_euc = 'euc-jisx0213,euc-jp'
23    let s:enc_jis = 'iso-2022-jp-3'
24  endif
25
26  " Make fileencodings
27  let &fileencodings = 'ucs-bom'
28  if &encoding !=# 'utf-8'
29    let &fileencodings = &fileencodings . ',' . 'ucs-2le'
30    let &fileencodings = &fileencodings . ',' . 'ucs-2'
31  endif
32  let &fileencodings = &fileencodings . ',' . s:enc_jis
33
34  if &encoding ==# 'utf-8'
35    let &fileencodings = &fileencodings . ',' . s:enc_euc
36    let &fileencodings = &fileencodings . ',' . 'cp932'
37  elseif &encoding =~# '^euc-\%(jp\|jisx0213\)$'
38    let &encoding = s:enc_euc
39    let &fileencodings = &fileencodings . ',' . 'utf-8'
40    let &fileencodings = &fileencodings . ',' . 'cp932'
41  else  " cp932
42    let &fileencodings = &fileencodings . ',' . 'utf-8'
43    let &fileencodings = &fileencodings . ',' . s:enc_euc
44  endif
45  let &fileencodings = &fileencodings . ',' . &encoding
46
47  unlet s:enc_euc
48  unlet s:enc_jis
49
50  let did_encoding_settings = 1
51endif
52
53
54if $ENV_ACCESS ==# 'cygwin'
55  set termencoding=cp932
56elseif $ENV_ACCESS ==# 'linux'
57  set termencoding=euc-jp
58else  " 'colinux'
59  set termencoding=utf-8
60endif
61
62
63
64
65
66
67
68
69" BASIC SETTINGS  "{{{1
70
71if 1 < &t_Co && has('syntax')
72  if &term ==# 'rxvt-cygwin-native'
73    set t_Co=256
74  endif
75  syntax enable
76  colorscheme default
77  set background=dark
78endif
79
80filetype plugin indent on
81
82
83set autoindent
84set backspace=indent,eol,start
85set backup
86set backupcopy&
87set backupdir=.,~/tmp
88set backupskip&
89set backupskip+=svn-commit.tmp,svn-commit.[0-9]*.tmp
90set cinoptions=:0,t0,(0,W1s
91set directory=.,~/tmp
92set noequalalways
93set history=100
94set hlsearch
95set grepprg=internal
96set incsearch
97set mouse=
98set ruler
99set showcmd
100set showmode
101set smartindent
102set updatetime=60000
103set title
104set titlestring=Vim:\ %f\ %h%r%m
105
106set viminfo=<50,'10,h,r/a,n~/.viminfo
107
108" To automatically detect the width and the height of the terminal,
109" the followings must not be set.
110"
111" set columns=80
112" set lines=25
113
114
115let mapleader=','
116let maplocalleader='.'
117
118
119
120
121
122
123
124
125" UTILITY FUNCTIONS & COMMANDS "{{{1
126" Misc.  "{{{2
127
128function! s:ToggleBell()
129  if &visualbell
130    set novisualbell t_vb&
131    echo 'bell on'
132  else
133    set visualbell t_vb=
134    echo 'bell off'
135  endif
136endfunction
137
138function! s:ToggleOption(option_name)
139  execute 'setlocal' a:option_name.'!'
140  execute 'setlocal' a:option_name.'?'
141endfunction
142
143
144function! s:ExtendHighlight(target_group, original_group, new_settings)
145  redir => resp
146  silent execute 'highlight' a:original_group
147  redir END
148  if resp =~# 'xxx cleared'
149    let original_settings = ''
150  elseif resp =~# 'xxx links to'
151    return s:ExtendHighlight(
152         \   a:target_group,
153         \   substitute(resp, '\_.*xxx links to\s\+\(\S\+\)', '\1', ''),
154         \   a:new_settings
155         \ )
156  else  " xxx {key}={arg} ...
157    let t = substitute(resp,'\_.*xxx\(\(\_s\+[^= \t]\+=[^= \t]\+\)*\)','\1','')
158    let original_settings = substitute(t, '\_s\+', ' ', 'g')
159  endif
160
161  silent execute 'highlight' a:target_group 'NONE'
162           \ '|' 'highlight' a:target_group original_settings
163           \ '|' 'highlight' a:target_group a:new_settings
164endfunction
165
166
167function! s:RenameBuffer(name)
168  let name = a:name
169  let i = 0
170  while 1
171    if !bufexists(name)
172      break
173    endif
174    let i = i + 1
175    let name = a:name . ' (' . i . ')'
176  endwhile
177  file `=name`
178endfunction
179
180
181function! s:CreateTemporaryBuffer(name, how_to_open)
182  execute a:how_to_open
183  setlocal bufhidden=wipe buflisted buftype=nofile noswapfile
184  call s:RenameBuffer(a:name)
185endfunction
186
187function! s:CreateCommandOutputBuffer(command, ...)  " spliting_modifier?
188  let spliting_modifier = (1 <= a:0 ? a:1 : '')
189  let previous_window_nr = winnr()
190  let previous_windows_placement = winrestcmd()
191
192  call s:CreateTemporaryBuffer('CMD: '.a:command, spliting_modifier.' new')
193  silent execute 'read !' a:command
194
195  if line('$') == 1 && getline(1) == ''
196    close
197    execute previous_windows_placement
198    execute previous_window_nr 'wincmd w'
199
200    redraw  " to ensure show the following message.
201    echomsg 'No output from the command:' a:command
202    return 0
203  else
204    1
205    delete
206    filetype detect
207    return 1
208  endif
209endfunction
210
211
212function! s:Count(...)
213  if v:count == v:count1  " count is specified.
214    return v:count
215  else  " count is not specified.  (the default '' is useful for special value)
216    return a:0 == 0 ? '' : a:1
217  endif
218endfunction
219
220command! -nargs=* -complete=expression -range -count=0 Execute
221       \ call s:Execute(<f-args>)
222function! s:Execute(...)
223  let args = []
224  for a in a:000
225    if a ==# '[count]'
226      let a = s:Count()
227    endif
228    call add(args, a)
229  endfor
230  execute join(args)
231endfunction
232
233
234
235
236" Help-related stuffs  "{{{2
237
238function! s:HelpBufWinNR()
239  let wn = 1
240  while wn <= winnr('$')
241    let bn = winbufnr(wn)
242    if getbufvar(bn, '&buftype') == 'help'
243      return [bn, wn]
244    endif
245    let wn = wn + 1
246  endwhile
247  return [-1, 0]
248endfunction
249
250function! s:HelpWindowClose()
251  let [help_bufnr, help_winnr] = s:HelpBufWinNR()
252  if help_bufnr == -1
253    return
254  endif
255
256  let current_winnr = winnr()
257  execute help_winnr 'wincmd w'
258  execute 'wincmd c'
259  if current_winnr < help_winnr
260    execute current_winnr 'wincmd w'
261  elseif help_winnr < current_winnr
262    execute (current_winnr-1) 'wincmd w'
263  else
264    " NOP
265  endif
266endfunction
267
268
269
270
271" High-level key sequences  "{{{2
272
273function! s:KeysToComplete()
274  if strlen(&omnifunc)
275    return "\<C-x>\<C-o>"
276  elseif &filetype ==# 'vim'
277    return "\<C-x>\<C-v>"
278  else
279    return "\<C-n>"
280  endif
281endfunction
282
283function! s:KeysToStopInsertModeCompletion()
284  if pumvisible()
285    return "\<C-y>"
286  else
287    return "\<Space>\<BS>"
288  endif
289endfunction
290
291
292
293
294" :edit with specified 'fileencoding'.  "{{{2
295
296com! -nargs=? -complete=file -bang -bar Cp932  edit<bang> ++enc=cp932 <args>
297com! -nargs=? -complete=file -bang -bar Eucjp  edit<bang> ++enc=euc-jp <args>
298com! -nargs=? -complete=file -bang -bar Iso2022jp  Jis<bang> <args>
299com! -nargs=? -complete=file -bang -bar Jis edit<bang> ++enc=iso-2022-jp <args>
300com! -nargs=? -complete=file -bang -bar Sjis  Cp932<bang> <args>
301com! -nargs=? -complete=file -bang -bar Utf8  edit<bang> ++enc=utf-8 <args>
302
303
304
305
306" Jump sections  "{{{2
307
308" for normal mode.  a:pattern is '/regexp' or '?regexp'.
309function! s:JumpSectionN(pattern)
310  let pattern = strpart(a:pattern, '1')
311  if strpart(a:pattern, 0, 1) == '/'
312    let flags = 'W'
313  else
314    let flags = 'Wb'
315  endif
316
317  mark '
318  let i = 0
319  while i < v:count1
320    if search(pattern, flags) == 0
321      if stridx(flags, 'b') != -1
322        normal! gg
323      else
324        normal! G
325      endif
326      break
327    endif
328    let i = i + 1
329  endwhile
330endfunction
331
332
333" for visual mode.  a:motion is '[[', '[]', ']]' or ']['.
334function! s:JumpSectionV(motion)
335  execute 'normal!' "gv\<Esc>"
336  execute 'normal' v:count1 . a:motion
337  let line = line('.')
338  let col = col('.')
339
340  normal! gv
341  call cursor(line, col)
342endfunction
343
344
345" for operator-pending mode.  a:motion is '[[', '[]', ']]' or ']['.
346function! s:JumpSectionO(motion)
347  execute 'normal' v:count1 . a:motion
348endfunction
349
350
351
352
353
354
355
356
357" KEY MAPPINGS  "{{{1
358" RULES:
359" - Separate {lhs} and {rhs} by two spaces.
360" - Write like <C-x>, not <C-X>.
361
362" Misc.  "{{{2
363
364nnoremap <C-h>  :h<Space>
365nnoremap <C-o>  :e<Space>
366nnoremap <C-w>.  :e .<Return>
367nnoremap <silent> <Leader>cD
368       \ :<C-u>call <SID>CreateCommandOutputBuffer('svn diff', 'botright')<CR>
369
370
371" Various hotkeys prefixed by <Space>.
372  " To show <Space> in the bottom line.
373map      <Space>  [Space]
374
375noremap  [Space]  <Nop>
376nnoremap [Space]/  :nohlsearch<Return>
377nnoremap [Space]?  :call <SID>HelpWindowClose()<Return>
378nmap     [Space]b  <Plug>Buffuzzy
379nnoremap [Space]e  :setlocal encoding? termencoding? fenc? fencs?<Return>
380nnoremap [Space]i  :setlocal filetype? fileencoding? fileformat?<Return>
381nnoremap [Space]ob  :call <SID>ToggleBell()<Return>
382nnoremap [Space]ow  :call <SID>ToggleOption('wrap')<Return>
383nnoremap [Space]s  <Nop>
384nnoremap [Space]s.  :source $HOME/.vimrc<Return>
385nnoremap [Space]ss  :source %<Return>
386vnoremap [Space]s  :sort<Return>
387nmap     [Space]w  [Space]ow
388
389
390" Jump list
391nnoremap <C-j>  <C-i>
392nnoremap <C-k>  <C-o>
393
394
395" Switch to the previously edited file (like Vz)
396nnoremap <Esc>2  :e #<Return>
397nmap <F2>  <Esc>2
398
399
400" Visiting windows with one key.
401nnoremap <C-i>  <C-w>w
402nnoremap <Esc>i  <C-w>W
403
404
405" Too lazy to press Shift key.
406noremap ;  :
407noremap :  ;
408
409
410" Disable some dangerous key.
411nnoremap ZZ  <Nop>
412nnoremap ZQ  <Nop>
413
414
415" Ex-mode will be never used and recordings are rarely used.
416nnoremap Q  q
417
418
419" Use a backslash (\) to repeat last change.
420" Since a dot (.) is used as <LocalLeader>.
421nnoremap \  .
422
423
424" Search slashes easily (too lazy to prefix backslashes to slashes)
425cnoremap <expr> /  getcmdtype() == '/' ? '\/' : '/'
426
427
428" Complete or indent.
429inoremap <expr> <C-i>  (<SID>ShouldIndentRatherThanCompleteP()
430                      \ ? '<C-i>'
431                      \ : <SID>KeysToComplete())
432
433function! s:ShouldIndentRatherThanCompleteP()
434  let m = match(getline('.'), '\S')
435  return m == -1 || col('.')-1 <= m
436endfunction
437
438
439" Swap ` and ' -- I prefer ` to ' and ` is not easy to type.
440noremap ' `
441noremap ` '
442
443
444
445
446" For plugin: scratch  "{{{2
447" I already use <C-m> for tag jumping.
448" But I don't use it in the scratch buffer, so it should be overridden.
449
450augroup Scratch
451  au!
452  au User Initialize  nmap <buffer> <C-m>  <Plug>Scratch_ExecuteLine
453  au User Initialize  vmap <buffer> <C-m>  <Plug>Scratch_ExecuteSelection
454augroup END
455
456
457
458
459" Tag-related hotkeys  "{{{2
460" Fallback  "{{{3
461
462" ``T'' is also disabled for consistency.
463noremap  t  <Nop>
464noremap  T  <Nop>
465
466" Alternatives for the original actions.
467noremap  [Space]t  t
468noremap  [Space]T  T
469
470
471" Basics  "{{{3
472nmap     t<Space>  tt
473vmap     t<Space>  tt
474nnoremap tt  <C-]>
475vnoremap tt  <C-]>
476nnoremap tj  :tag<Return>
477nnoremap tk  :pop<Return>
478nnoremap tl  :tags<Return>
479nnoremap tn  :tnext<Return>
480nnoremap tp  :tprevious<Return>
481nnoremap tP  :tfirst<Return>
482nnoremap tN  :tlast<Return>
483
484" additionals, like Web browsers
485nmap     <C-m>  tt
486vmap     <C-m>  tt
487
488
489" With preview window  "{{{3
490nmap     t'<Space>  t't
491vmap     t'<Space>  t't
492nnoremap t't  <C-w>}
493vnoremap t't  <C-w>}
494nnoremap t'n  :ptnext<Return>
495nnoremap t'p  :ptpevious<Return>
496nnoremap t'P  :ptfirst<Return>
497nnoremap t'N  :ptlast<Return>
498
499" although :pclose is not related to tag.
500nnoremap t'c  :pclose<Return>
501
502
503" With :split  "{{{3
504nnoremap tst  <C-w>]
505vnoremap tst  <C-w>]
506nmap     ts<Space>  tst
507vmap     ts<Space>  tst
508nnoremap tsn  :split \| tnext<Return>
509nnoremap tsp  :split \| tpevious<Return>
510nnoremap tsP  :split \| tfirst<Return>
511nnoremap tsN  :split \| tlast<Return>
512
513
514" With :vertical split  "{{{3
515  " |:vsplit|-then-|<C-]>| is simple
516  " but its modification to tag stacks is not same as |<C-w>]|.
517nnoremap tvt  <C-]>:vsplit<Return><C-w>p<C-t><C-w>p
518vnoremap tvt  <C-]>:vsplit<Return><C-w>p<C-t><C-w>p
519nmap     tv<Space>  tvt
520vmap     tv<Space>  tvt
521nnoremap tvn  :vsplit \| tnext<Return>
522nnoremap tvp  :vsplit \| tpevious<Return>
523nnoremap tvP  :vsplit \| tfirst<Return>
524nnoremap tvN  :vsplit \| tlast<Return>
525
526
527
528
529" Quickfix hotkeys  "{{{2
530" Fallback
531nnoremap q  <Nop>
532
533" For quickfix list
534nnoremap qj        :Execute cnext [count]<Return>
535nnoremap qk        :Execute cprevious [count]<Return>
536nnoremap qr        :Execute crewind [count]<Return>
537nnoremap qK        :Execute cfirst [count]<Return>
538nnoremap qJ        :Execute clast [count]<Return>
539nnoremap qfj       :Execute cnfile [count]<Return>
540nnoremap qfk       :Execute cpfile [count]<Return>
541nnoremap ql        :clist<Return>
542nnoremap qq        :Execute cc [count]<Return>
543nnoremap qo        :Execute copen [count]<Return>
544nnoremap qc        :cclose<Return>
545nnoremap qp        :Execute colder [count]<Return>
546nnoremap qn        :Execute cnewer [count]<Return>
547nnoremap qm        :make<Return>
548nnoremap qM        :make<Space>
549nnoremap q<Space>  :make<Space>
550nnoremap qg        :grep<Space>
551
552" For location list (mnemonic: Quickfix list for the current Window)
553nnoremap qwj        :Execute lnext [count]<Return>
554nnoremap qwk        :Execute lprevious [count]<Return>
555nnoremap qwr        :Execute lrewind [count]<Return>
556nnoremap qwK        :Execute lfirst [count]<Return>
557nnoremap qwJ        :Execute llast [count]<Return>
558nnoremap qwfj       :Execute lnfile [count]<Return>
559nnoremap qwfk       :Execute lpfile [count]<Return>
560nnoremap qwl        :llist<Return>
561nnoremap qwq        :Execute ll [count]<Return>
562nnoremap qwo        :Execute lopen [count]<Return>
563nnoremap qwc        :lclose<Return>
564nnoremap qwp        :Execute lolder [count]<Return>
565nnoremap qwn        :Execute lnewer [count]<Return>
566nnoremap qwm        :lmake<Return>
567nnoremap qwM        :lmake<Space>
568nnoremap qw<Space>  :lmake<Space>
569nnoremap qwg        :lgrep<Space>
570
571
572
573
574" Tab-pages hotkeys  "{{{2
575" FIXME: sometimes, hit-enter prompt appears.  but no idea for the reason.
576" Misc.  "{{{3
577nnoremap <C-t>  <Nop>
578
579nnoremap <C-t>n  :<C-u>tabnew<Return>
580nnoremap <C-t>c  :<C-u>tabclose<Return>
581nnoremap <C-t>o  :<C-u>tabonly<Return>
582nnoremap <C-t>i  :<C-u>tabs<Return>
583
584nmap <C-t><C-n>  <C-t>n
585nmap <C-t><C-c>  <C-t>c
586nmap <C-t><C-o>  <C-t>o
587nmap <C-t><C-i>  <C-t>i
588
589
590" Moving around tabs.  "{{{3
591nnoremap <C-t>j  :<C-u>execute 'tabnext'
592                 \ 1 + (tabpagenr() + v:count1 - 1) % tabpagenr('$')<Return>
593nnoremap <C-t>k  :Execute tabprevious [count]<Return>
594nnoremap <C-t>K  :<C-u>tabfirst<Return>
595nnoremap <C-t>J  :<C-u>tablast<Return>
596nmap <C-t>t  <C-t>j
597nmap <C-t>T  <C-t>k
598
599nmap <C-t><C-j>  <C-t>j
600nmap <C-t><C-k>  <C-t>k
601nmap <C-t><C-t>  <C-t>t
602
603
604" Moving tabs themselves.  "{{{3
605nnoremap <C-t>l  :<C-u>execute 'tabmove'
606                 \ min([tabpagenr() + v:count1 - 1, tabpagenr('$')])<Return>
607nnoremap <C-t>h  :<C-u>execute 'tabmove'
608                 \ max([tabpagenr() - v:count1 - 1, 0])<Return>
609nnoremap <C-t>L  :<C-u>tabmove<Return>
610nnoremap <C-t>H  :<C-u>tabmove 0<Return>
611
612nmap <C-t><C-l>  <C-t>l
613nmap <C-t><C-h>  <C-t>h
614
615
616
617
618" For command-line editting  "{{{2
619
620cnoremap <C-u>  <C-e><C-u>
621
622cnoremap <Esc>h  <Left>
623cnoremap <Esc>j  <Down>
624cnoremap <Esc>k  <Up>
625cnoremap <Esc>l  <Right>
626cnoremap <Esc>H  <Home>
627cnoremap <Esc>L  <End>
628cnoremap <Esc>w  <S-Right>
629cnoremap <Esc>b  <S-Left>
630cnoremap <Esc>x  <Del>
631
632
633
634
635" Input the current date/time (Full, Date, Time).  "{{{2
636
637inoremap <Leader>dF  <C-r>=strftime('%Y-%m-%dT%H:%M:%S+09:00')<Return>
638inoremap <Leader>df  <C-r>=strftime('%Y-%m-%dT%H:%M:%S')<Return>
639inoremap <Leader>dd  <C-r>=strftime('%Y-%m-%d')<Return>
640inoremap <Leader>dT  <C-r>=strftime('%H:%M:%S')<Return>
641inoremap <Leader>dt  <C-r>=strftime('%H:%M')<Return>
642
643
644
645
646" Enable ]] and other motions in visual and operator-pending mode.  "{{{2
647
648vnoremap <silent> ]]  :<C-u>call <SID>JumpSectionV(']]')<Return>
649vnoremap <silent> ][  :<C-u>call <SID>JumpSectionV('][')<Return>
650vnoremap <silent> [[  :<C-u>call <SID>JumpSectionV('[[')<Return>
651vnoremap <silent> []  :<C-u>call <SID>JumpSectionV('[]')<Return>
652onoremap <silent> ]]  :<C-u>call <SID>JumpSectionO(']]')<Return>
653onoremap <silent> ][  :<C-u>call <SID>JumpSectionO('][')<Return>
654onoremap <silent> [[  :<C-u>call <SID>JumpSectionO('[[')<Return>
655onoremap <silent> []  :<C-u>call <SID>JumpSectionO('[]')<Return>
656
657
658
659
660
661
662
663
664" FILETYPE  "{{{1
665" Misc.  "{{{2
666
667augroup MyAutoCmd
668  autocmd!
669
670  autocmd FileType dosini
671    \ call <SID>FileType_dosini()
672
673  autocmd FileType python
674    \ call <SID>SetShortIndent()
675    \ | let python_highlight_numbers=1
676    \ | let python_highlight_builtins=1
677    \ | let python_highlight_space_errors=1
678
679  autocmd FileType vim
680    \ call <SID>FileType_vim()
681
682  autocmd FileType html,xhtml,xml,xslt
683    \ call <SID>FileType_xml()
684
685  " Misc.
686  autocmd FileType lua,sh,tex
687    \ call <SID>SetShortIndent()
688
689  autocmd FileType *
690    \ call <SID>FileType_any()
691
692  autocmd ColorScheme *
693    \   call <SID>ExtendHighlight('Pmenu', 'Normal', 'cterm=underline')
694    \ | call <SID>ExtendHighlight('PmenuSel', 'Search', 'cterm=underline')
695    \ | call <SID>ExtendHighlight('PmenuSbar', 'Normal', 'cterm=reverse')
696    \ | call <SID>ExtendHighlight('PmenuThumb', 'Search', '')
697  doautocmd ColorScheme because-colorscheme-has-been-set-above.
698
699    " I consider that these buffers have another filetype=netrw.
700  autocmd BufReadPost {dav,file,ftp,http,rcp,rsync,scp,sftp}://*
701    \ setlocal bufhidden=hide
702augroup END
703
704
705function! s:SetShortIndent()
706  setlocal expandtab softtabstop=2 shiftwidth=2
707endfunction
708
709
710
711
712" All  "{{{2
713
714function! s:FileType_any()
715  " To use my global mappings for section jumping,
716  " remove buffer local mappings for them.
717  silent! vunmap <buffer>  ]]
718  silent! vunmap <buffer>  ][
719  silent! vunmap <buffer>  []
720  silent! vunmap <buffer>  [[
721  silent! ounmap <buffer>  ]]
722  silent! ounmap <buffer>  ][
723  silent! ounmap <buffer>  []
724  silent! ounmap <buffer>  [[
725endfunction
726
727
728
729
730" Dosini (.ini)  "{{{2
731
732function! s:FileType_dosini()
733  nnoremap <buffer> <silent> ]]  :<C-u>call <SID>JumpSectionN('/^\[')<Return>
734  nnoremap <buffer> <silent> ][  :<C-u>call <SID>JumpSectionN('/\n\[\@=')<CR>
735  nnoremap <buffer> <silent> [[  :<C-u>call <SID>JumpSectionN('?^\[')<Return>
736  nnoremap <buffer> <silent> []  :<C-u>call <SID>JumpSectionN('?\n\[\@=')<CR>
737endfunction
738
739
740
741
742" sh  "{{{2
743
744let g:is_bash = 1
745
746
747
748
749" Vim  "{{{2
750
751function! s:FileType_vim()
752  call <SID>SetShortIndent()
753  let vim_indent_cont = &shiftwidth
754endfunction
755
756
757
758
759" XML/SGML and other applications  "{{{2
760
761function! s:FileType_xml()
762  call <SID>SetShortIndent()
763
764  " To deal with namespace prefixes and tag-name-including-hyphens.
765  setlocal iskeyword+=45  " hyphen (-)
766  setlocal iskeyword+=58  " colon (:)
767
768  " Support to input some parts of tags.
769  inoremap <buffer> <LT>?  </
770  imap     <buffer> ?<LT>  <LT>?
771  inoremap <buffer> ?>  />
772  imap     <buffer> >?  ?>
773
774  " Support to input some blocks.
775  inoremap <buffer> <LT>!C  <LT>![CDATA[]]><Left><Left><Left>
776  inoremap <buffer> <LT>#  <LT>!----><Left><Left><Left><C-r>=
777                         \   <SID>FileType_xml_comment_dispatch()
778                         \ <Return>
779
780  " Complete proper end-tags.
781  " In the following description, {|} means the cursor position.
782
783    " Insert the end tag after the cursor.
784    " Before: <code{|}
785    " After:  <code>{|}</code>
786  inoremap <buffer> <LT><LT>  ><LT>/<C-x><C-o><C-r>=
787                           \    <SID>KeysToStopInsertModeCompletion()
788                           \  <Return><C-o>F<LT>
789
790    " Wrap the cursor with the tag.
791    " Before: <code{|}
792    " After:  <code>
793    "           {|}
794    "         </code>
795  inoremap <buffer> >>  ><Return>X<Return><LT>/<C-x><C-o><C-r>=
796                     \    <SID>KeysToStopInsertModeCompletion()
797                     \  <Return><C-o><Up><BS>
798endfunction
799
800
801function! s:FileType_xml_comment_dispatch()
802  let c = nr2char(getchar())
803  return get(s:FileType_xml_comment_data, c, c)
804endfunction
805let s:FileType_xml_comment_data = {
806  \   "\<Space>": "\<Space>\<Space>\<Left>",
807  \   "\<Return>": "\<Return>X\<Return>\<Up>\<End>\<BS>",
808  \   '_': '',
809  \   '-': '',
810  \   '{': '{{{',
811  \   '}': '}}}',
812  \ }
813
814
815
816
817
818
819
820
821" MISC.  "{{{1
822
823" Plugin: cygclip
824
825" Because plugins will be loaded after ~/.vimrc.
826autocmd MyAutoCmd VimEnter *
827      \   if exists('g:loaded_cygclip')
828      \ |  call Cygclip_DefaultKeymappings()
829      \ | endif
830
831
832
833
834" Plugin: surround
835
836" The default mapping ys for <Plug>Ysurround is not consistent with
837" the default mappings of vi -- y is for yank.
838nmap s  <Plug>Ysurround
839
840
841
842
843" Plugin: vcscommand
844
845let g:VCSCommandDeleteOnHide = 1
846
847nmap <Leader>cR  <Plug>VCSDelete
848
849
850
851
852" Plugin: xml_autons
853
854let g:AutoXMLns_Dict = {}
855let g:AutoXMLns_Dict['http://www.w3.org/2000/svg'] = 'svg11'
856
857
858
859
860set secure
861
862" __END__
863" vim: foldmethod=marker
Note: See TracBrowser for help on using the browser.