Changeset 1732
- Timestamp:
- 11/18/07 00:50:39 (6 years ago)
- Location:
- dotfiles/vim/kana
- Files:
-
- 5 added
- 4 removed
- 1 modified
-
dot.vim/autoload/textobj (added)
-
dot.vim/autoload/textobj/datetime.vim (added)
-
dot.vim/autoload/textobj/user.vim (added)
-
dot.vim/doc/textobj-datetime.txt (added)
-
dot.vim/doc/textobj-user.txt (added)
-
dot.vim/doc/todatetime.txt (deleted)
-
dot.vim/doc/touser.txt (deleted)
-
dot.vim/plugin/todatetime.vim (deleted)
-
dot.vim/plugin/touser.vim (deleted)
-
dot.vimrc (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dotfiles/vim/kana/dot.vimrc
r517 r1732 119 119 elseif $ENV_ACCESS ==# 'linux' 120 120 set termencoding=euc-jp 121 else "'colinux'121 elseif $ENV_ACCESS ==# 'colinux' 122 122 set termencoding=utf-8 123 else " fallback 124 set termencoding= " same as 'encoding' 123 125 endif 124 126 … … 156 158 set grepprg=internal 157 159 set incsearch 160 set laststatus=2 " always show status lines. 158 161 set mouse= 159 162 set ruler … … 165 168 set titlestring=Vim:\ %f\ %h%r%m 166 169 set wildmenu 167 168 170 set viminfo=<50,'10,h,r/a,n~/.viminfo 171 172 " default 'statusline' with 'fileencoding'. 173 let &statusline = '' 174 let &statusline .= '%<%f %h%m%r' 175 let &statusline .= '%=' 176 let &statusline .= '[%{&fileencoding == "" ? &encoding : &fileencoding}]' 177 let &statusline .= ' %-14.(%l,%c%V%) %P' 169 178 170 179 " To automatically detect the width and the height of the terminal, … … 582 591 583 592 593 function! 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' 609 endfunction 610 611 584 612 585 613 … … 862 890 nnoremap [Space]J :<C-u>call <SID>JoinHere(1)<Return> 863 891 nnoremap [Space]gJ :<C-u>call <SID>JoinHere(0)<Return> 864 " unjoin 892 " unjoin " BUGS: side effect - destroy the last inserted text (".). 865 893 nnoremap [Space]j i<Return><Esc> 866 894 … … 885 913 886 914 " Windows "{{{2 887 " 915 888 916 " Synonyms for the default mappings, with single key strokes. 889 917 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 918 nnoremap <C-i> <C-w>w 919 " <Tab> = <C-i> 920 nnoremap <Esc>i <C-w>W 921 nmap <S-Tab> <Esc>i 922 923 " For other mappings (<Esc>{x} to <C-w>{x}). 924 nmap <Esc> <C-w> 925 926 927 " Others. 894 928 895 929 nnoremap <Esc>H :<C-u>call <SID>MoveWindowThenEqualizeIfNecessary('H')<Return> … … 898 932 nnoremap <Esc>L :<C-u>call <SID>MoveWindowThenEqualizeIfNecessary('L')<Return> 899 933 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. 936 nnoremap <C-w><C-t> :<C-u>call <SID>MoveWindowIntoNewTabPage()<Return> 904 937 905 938 … … 951 984 952 985 " 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. 988 map ' <SID>jump-default 989 map ` <SID>jump-another 990 noremap <SID>jump-default ` 991 noremap <SID>jump-another ' 955 992 956 993 … … 966 1003 967 1004 " Synonyms for <> and [], same as plugin surround. 1005 onoremap aa a> 1006 onoremap ia i> 968 1007 vnoremap aa a> 969 1008 vnoremap ia i> 970 1009 1010 onoremap ar a] 1011 onoremap ir i] 971 1012 vnoremap ar a] 972 1013 vnoremap ir i] 973 1014 974 1015 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". 1019 nnoremap dl 0d$ 1020 1021 1022 " Like gv, but select the last changed text. 1023 nnoremap gc `[v`] 1024 1025 1026 " Make I/A available in characterwise-visual and linewise-visual. 1027 vnoremap I <C-v>I 1028 vnoremap 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.) 1034 nnoremap o :<C-u>call <SID>StartInsertModeWithBlankLines('o')<Return> 1035 nnoremap O :<C-u>call <SID>StartInsertModeWithBlankLines('O')<Return> 1036 1037 function! 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') 1052 endfunction 1053 1054 1055 " Search for the selected text. 1056 vnoremap * :<C-u>call <SID>SearchForTheSelectedText()<Return> 1057 1058 " FIXME: escape to search the selected text literaly. 1059 function! 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 1070 endfunction 1071 1072 975 1073 976 1074 … … 980 1078 981 1079 " Filetypes "{{{1 982 " A ll"{{{21080 " Any filetype "{{{2 983 1081 984 1082 autocmd MyAutoCmd FileType * 985 1083 \ call <SID>FileType_any() 986 987 1084 function! s:FileType_any() 988 1085 " To use my global mappings for section jumping, … … 999 1096 1000 1097 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. 1102 autocmd MyAutoCmd BufReadPost * 1103 \ if &modifiable && !search('[^\x00-\x7F]', 'cnw') 1104 \ | setlocal fileencoding= 1105 \ | endif 1106 1107 1001 1108 " although this is not a filetype settings. 1002 1109 autocmd MyAutoCmd ColorScheme * … … 1010 1117 1011 1118 1119 " css "{{{2 1120 1121 autocmd MyAutoCmd FileType css 1122 \ call <SID>SetShortIndent() 1123 1124 1125 1126 1012 1127 " dosini (.ini) "{{{2 1013 1128 … … 1025 1140 1026 1141 1142 " help "{{{2 1143 1144 autocmd 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 1027 1153 " lua "{{{2 1028 1154 … … 1081 1207 call <SID>SetShortIndent() 1082 1208 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 1083 1234 endfunction 1084 1235 … … 1221 1372 1222 1373 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 1376 silent! call textobj#datetime#default_mappings(1) 1229 1377 1230 1378
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)