Changeset 1732

Show
Ignore:
Timestamp:
11/18/07 00:50:39 (6 years ago)
Author:
kana
Message:

dotfiles/vim/kana:
* Sync with my local repository (2007-10-18/2007-11-18).

Location:
dotfiles/vim/kana
Files:
5 added
4 removed
1 modified

Legend:

Unmodified
Added
Removed
  • dotfiles/vim/kana/dot.vimrc

    r517 r1732  
    119119elseif $ENV_ACCESS ==# 'linux' 
    120120  set termencoding=euc-jp 
    121 else  " 'colinux' 
     121elseif $ENV_ACCESS ==# 'colinux' 
    122122  set termencoding=utf-8 
     123else  " fallback 
     124  set termencoding=  " same as 'encoding' 
    123125endif 
    124126 
     
    156158set grepprg=internal 
    157159set incsearch 
     160set laststatus=2  " always show status lines. 
    158161set mouse= 
    159162set ruler 
     
    165168set titlestring=Vim:\ %f\ %h%r%m 
    166169set wildmenu 
    167  
    168170set viminfo=<50,'10,h,r/a,n~/.viminfo 
     171 
     172" default 'statusline' with 'fileencoding'. 
     173let &statusline = '' 
     174let &statusline .= '%<%f %h%m%r' 
     175let &statusline .= '%=' 
     176let &statusline .= '[%{&fileencoding == "" ? &encoding : &fileencoding}]' 
     177let &statusline .= '  %-14.(%l,%c%V%) %P' 
    169178 
    170179" To automatically detect the width and the height of the terminal, 
     
    582591 
    583592 
     593function! s:MoveWindowIntoNewTabPage() 
     594  let original_tabnr = tabpagenr() 
     595  let target_bufnr = bufnr('') 
     596 
     597  tabnew 
     598  let new_tabnr = tabpagenr() 
     599  execute target_bufnr 'buffer' 
     600 
     601  execute original_tabnr 'tabnext' 
     602  if 1 < winnr('$') 
     603    close 
     604  else 
     605    enew 
     606  endif 
     607 
     608  execute new_tabnr 'tabnext' 
     609endfunction 
     610 
     611 
    584612 
    585613 
     
    862890nnoremap [Space]J  :<C-u>call <SID>JoinHere(1)<Return> 
    863891nnoremap [Space]gJ  :<C-u>call <SID>JoinHere(0)<Return> 
    864   " unjoin 
     892  " unjoin  " BUGS: side effect - destroy the last inserted text (".). 
    865893nnoremap [Space]j  i<Return><Esc> 
    866894 
     
    885913 
    886914" Windows  "{{{2 
    887 " 
     915 
    888916" Synonyms for the default mappings, with single key strokes. 
    889917 
    890 nnoremap <Esc>h  <C-w>h 
    891 nnoremap <Esc>j  <C-w>j 
    892 nnoremap <Esc>k  <C-w>k 
    893 nnoremap <Esc>l  <C-w>l 
     918nnoremap <C-i>  <C-w>w 
     919" <Tab> = <C-i> 
     920nnoremap <Esc>i  <C-w>W 
     921nmap <S-Tab>  <Esc>i 
     922 
     923  " For other mappings (<Esc>{x} to <C-w>{x}). 
     924nmap <Esc> <C-w> 
     925 
     926 
     927" Others. 
    894928 
    895929nnoremap <Esc>H  :<C-u>call <SID>MoveWindowThenEqualizeIfNecessary('H')<Return> 
     
    898932nnoremap <Esc>L  :<C-u>call <SID>MoveWindowThenEqualizeIfNecessary('L')<Return> 
    899933 
    900 nnoremap <C-i>  <C-w>w 
    901 " <Tab> = <C-i> 
    902 nnoremap <Esc>i  <C-w>W 
    903 nmap <S-Tab>  <Esc>i 
     934  " This {lhs} overrides the default action (Move cursor to top-left window). 
     935  " But I rarely use its {lhs}s, so this mapping is not problematic. 
     936nnoremap <C-w><C-t>  :<C-u>call <SID>MoveWindowIntoNewTabPage()<Return> 
    904937 
    905938 
     
    951984 
    952985" Swap ` and ' -- I prefer ` to ' and ` is not easy to type. 
    953 noremap ' ` 
    954 noremap ` ' 
     986" <SID>jump-default and <SID>jump-another are the name for these actions 
     987" to use other places in this file. 
     988map '  <SID>jump-default 
     989map `  <SID>jump-another 
     990noremap <SID>jump-default  ` 
     991noremap <SID>jump-another  ' 
    955992 
    956993 
     
    9661003 
    9671004" Synonyms for <> and [], same as plugin surround. 
     1005onoremap aa  a> 
     1006onoremap ia  i> 
    9681007vnoremap aa  a> 
    9691008vnoremap ia  i> 
    9701009 
     1010onoremap ar  a] 
     1011onoremap ir  i] 
    9711012vnoremap ar  a] 
    9721013vnoremap ir  i] 
    9731014 
    9741015 
     1016" Delete the content of the current line (not the line itself). 
     1017" BUGS: not repeatable. 
     1018" BUGS: the default behavior is overridden, but it's still available via "x". 
     1019nnoremap dl  0d$ 
     1020 
     1021 
     1022" Like gv, but select the last changed text. 
     1023nnoremap gc  `[v`] 
     1024 
     1025 
     1026" Make I/A available in characterwise-visual and linewise-visual. 
     1027vnoremap I  <C-v>I 
     1028vnoremap A  <C-v>A 
     1029 
     1030 
     1031" Start Insert mode with [count] blank lines. 
     1032" (I prefer this behavior to the default behavior of [count]o/O 
     1033"  -- repeat the next insertion [count] times.) 
     1034nnoremap o  :<C-u>call <SID>StartInsertModeWithBlankLines('o')<Return> 
     1035nnoremap O  :<C-u>call <SID>StartInsertModeWithBlankLines('O')<Return> 
     1036 
     1037function! s:StartInsertModeWithBlankLines(command) 
     1038  " Do "[count]o<Esc>o" and so forth. 
     1039  " BUGS: In map-<expr>, v:count and v:count1 don't hold correct values. 
     1040  " FIXME: proper indenting in comments. 
     1041  " FIXME: not repeatable perfectly (repeat insertion without blank lines). 
     1042  let script = '' 
     1043  if v:count == v:count1  " is [count] specified? 
     1044    let script .= v:count . a:command . "\<Esc>" 
     1045    if a:command ==# 'O' 
     1046      " Adjust the cursor position. 
     1047      let script .= "\<Down>" . v:count . "\<Up>" 
     1048    endif 
     1049  endif 
     1050  let script .= a:command 
     1051  call feedkeys(script, 'n') 
     1052endfunction 
     1053 
     1054 
     1055" Search for the selected text. 
     1056vnoremap *  :<C-u>call <SID>SearchForTheSelectedText()<Return> 
     1057 
     1058  " FIXME: escape to search the selected text literaly. 
     1059function! s:SearchForTheSelectedText() 
     1060  let reg_u = @" 
     1061  let reg_0 = @0 
     1062 
     1063  normal! gvy 
     1064  let @/ = @0 
     1065  call histadd('/', @0) 
     1066  normal! n 
     1067 
     1068  let @0 = reg_0 
     1069  let @" = reg_u 
     1070endfunction 
     1071 
     1072 
    9751073 
    9761074 
     
    9801078 
    9811079" Filetypes  "{{{1 
    982 " All  "{{{2 
     1080" Any filetype   "{{{2 
    9831081 
    9841082autocmd MyAutoCmd FileType * 
    9851083  \ call <SID>FileType_any() 
    986  
    9871084function! s:FileType_any() 
    9881085  " To use my global mappings for section jumping, 
     
    9991096 
    10001097 
     1098" Fix 'fileencoding' to use 'encoding' 
     1099" if the buffer only contains 7-bit characters. 
     1100" Note that if the buffer is not 'modifiable', 
     1101" its 'fileencoding' cannot be changed, so that such buffers are skipped. 
     1102autocmd MyAutoCmd BufReadPost * 
     1103  \   if &modifiable && !search('[^\x00-\x7F]', 'cnw') 
     1104  \ |   setlocal fileencoding= 
     1105  \ | endif 
     1106 
     1107 
    10011108" although this is not a filetype settings. 
    10021109autocmd MyAutoCmd ColorScheme * 
     
    10101117 
    10111118 
     1119" css  "{{{2 
     1120 
     1121autocmd MyAutoCmd FileType css 
     1122  \ call <SID>SetShortIndent() 
     1123 
     1124 
     1125 
     1126 
    10121127" dosini (.ini)  "{{{2 
    10131128 
     
    10251140 
    10261141 
     1142" help  "{{{2 
     1143 
     1144autocmd MyAutoCmd FileType help 
     1145  \ call textobj#user#define('|[^|]*|', '', '', { 
     1146  \                            'move-to-next': '<buffer> gj', 
     1147  \                            'move-to-prev': '<buffer> gk', 
     1148  \                          }) 
     1149 
     1150 
     1151 
     1152 
    10271153" lua  "{{{2 
    10281154 
     
    10811207  call <SID>SetShortIndent() 
    10821208  let vim_indent_cont = &shiftwidth 
     1209 
     1210  iabbr <buffer> jf  function!()<Return> 
     1211                    \endfunction<Return> 
     1212                    \<Up><Up><End><Left><Left> 
     1213  iabbr <buffer> ji  if<Return> 
     1214                    \endif<Return> 
     1215                    \<Up><Up><End> 
     1216  iabbr <buffer> je  if<Return> 
     1217                    \else<Return> 
     1218                    \endif<Return> 
     1219                    \<Up><Up><Up><End> 
     1220  iabbr <buffer> jw  while<Return> 
     1221                    \endwhile<Return> 
     1222                    \<Up><Up><End> 
     1223 
     1224  " Fix the default syntax to properly highlight 
     1225  " autoload#function() and dictionary.function(). 
     1226  syntax clear vimFunc 
     1227  syntax match vimFunc 
     1228    \ "\%([sS]:\|<[sS][iI][dD]>\|\<\%(\I\i*[#.]\)\+\)\=\I\i*\ze\s*(" 
     1229    \ contains=vimFuncName,vimUserFunc,vimCommand,vimNotFunc,vimExecute 
     1230  syntax clear vimUserFunc 
     1231  syntax match vimUserFunc contained 
     1232    \ "\%([sS]:\|<[sS][iI][dD]>\|\<\%(\I\i*[#.]\)\+\)\i\+\|\<\u\i*\>\|\<if\>" 
     1233    \ contains=vimNotation,vimCommand 
    10831234endfunction 
    10841235 
     
    12211372 
    12221373 
    1223 " todatetime  "{{{2 
    1224  
    1225 autocmd MyAutoCmd User DelayedSettings 
    1226       \   if exists('g:loaded_todatetime') 
    1227       \ |   call TODateTime_DefaultKeymappings(1) 
    1228       \ | endif 
     1374" textobj-datetime  "{{{2 
     1375 
     1376silent! call textobj#datetime#default_mappings(1) 
    12291377 
    12301378