|
|
||
また.vimrc張っときます。
" basic {{{ set nocompatible syntax enable filetype plugin on filetype indent on " $VIM "let $VIM="/usr/share/vim" " shell set shell=zsh if has('gui_running') set noshelltemp " GUI + zshのときリダイレクトがおかしい " set shellredir=>& endif " backup let $TMP = $HOME . "/tmp/vim" set backupdir=$TMP set directory=$TMP " no intoro set shortmess+=I " fold if !exists($W3M_TTY) "set fdm=syntax "set fdm=marker set fmr={{{,}}} endif " scroll " set scroll=10 set scrolloff=2 " set scrolloff=999 " search set incsearch set nowrapscan set nohlsearch " history set history=50000 " warp set whichwrap=b,s,h,l,<,>,~,[,] " ~motion set tildeop " comment " indent set autoindent ts=8 sw=4 sts=4 et aug All au! au FileType * setl formatoptions-=ro au Filetype * setl cindent ts=8 sw=4 sts=4 et au Filetype * setl cinoptions=0:,(0 aug END aug ShellType au! au Filetype lisp,scheme setl cindent& ts=8 sw=2 sts=2 et au Filetype vim,ruby,zsh,sh setl ts=8 sw=2 sts=2 et aug END " let g:is_gauche = 1 aug MakeType au! au Filetype make setl ts=8 sw=8 sts=8 noet aug END " file set hidden " status line {{{ set showcmd set cmdheight=1 set laststatus=2 set wildmenu set statusline= set statusline+=[*%n]\ " バッファ番号 set statusline+=%f\ " ファイル名 set statusline+=%{'['.(&fenc!=''?&fenc:'?').'-'.&ff.']'} " 文字コード " set statusline+=%{'['.GetShortEncodingJP().'-'.&ff.']'} " 文字コード set statusline+=%y " ファイルタイプ set statusline+=%r " 読み取り専用フラグ set statusline+=%h " ヘルプバッファ set statusline+=%w " プレビューウィンドウ set statusline+=%m " バッファ状態[+]とか set statusline+=%= " 区切り "set statusline+=\ %{strftime('%c')} " 時間 set statusline+=%4l/%4L%4p%% " どこにいるか set statusline+=\ %3c " 列 set statusline+=\ %4B " 文字コード set statusline+=%< " 折り返しの指定 " }}} " }}} " colors & chars {{{ syntax on colorscheme desert256 if has('gui_running') set listchars=tab:>-,eol:< set list hi clear NonText hi NonText guifg=grey40 ctermfg=7 hi SpecialKey guifg=grey50 ctermfg=7 endif " zenkaku " only UTF-8 hi ZenkakuSpace cterm=underline guibg=grey50 match ZenkakuSpace / / " WhitespaceEOL " http://d.hatena.ne.jp/tasukuchan/20070816/1187246177 highlight WhitespaceEOL ctermbg=red guibg=red match WhitespaceEOL /\s\+$/ aug MyColor au! au WinEnter * match ZenkakuSpace / / au WinEnter * if &readonly == "noreadonly" | match WhitespaceEOL /\s\+$/ | endif aug END " }}} " GUI & mouse {{{ if has('gui_running') behave mswin " like a mswin mouse set clipboard=unnamed set guifont=Bitstream\ Vera\ Sans\ Mono\ 9 set toolbar= " no toolbar else set mouse+=a set ttymouse=xterm2 endif " Right Click Menu {{{ if has('gui_running') amenu PopUp.Search\ Forward * amenu PopUp.Search\ Backward # " vmenu については考え中。 " vmenu PopUp.Search\ Forward y/<C-R>"<CR> " vmenu PopUp.Search\ Backward y?<C-R>"<CR> endif " }}} " }}} " complete {{{ " set completeopt=menu,preview,longest set completeopt=menuone,preview set complete=.,w,b,u,t,i " default if has("autocmd") && exists("+omnifunc") aug Complete au! au FileType python setl omnifunc=pythoncomplete#Complete au FileType javascript setl omnifunc=javascriptcomplete#CompleteJS au FileType html setl omnifunc=htmlcomplete#CompleteTags au FileType css setl omnifunc=csscomplete#CompleteCSS au FileType xml setl omnifunc=xmlcomplete#CompleteTags au FileType php setl omnifunc=phpcomplete#CompletePHP au FileType c setl omnifunc=ccomplete#Complete au FileType ruby,eruby setl omnifunc=rubycomplete#Complete au FileType ruby,eruby comp ruby au FileType ruby,eruby setl dictionary=$HOME/.vim/dict/ruby.dict " au FileType ruby,eruby setl isk+=. au Filetype * \ if &omnifunc == "" | \ setlocal omnifunc=syntaxcomplete#Complete | \ endif aug END endif " ~/.vim/plugin/autocomplpop.vim " let g:AutoComplPop_PopupCmd = "<TAB>" " haskell au FileType haskell comp ghc let g:haddock_browser="/usr/bin/firefox" " ruby let g:rubycomplete_rails = 1 let g:rubycomplete_buffer_loading = 1 let g:rubycomplete_classes_in_global = 1 let g:rubycomplete_include_object = 1 let g:rubycomplete_include_objectspace = 1 " auto complite {{{ let g:AutoComplPop_CompleteOption = '.,w,b' " from http://lab.lowreal.net/trac/browser/config function! InsertTabWrapper() let col = col('.') - 1 if !col || getline('.')[col - 1] !~ '\k' return "\<TAB>" else if pumvisible() return "\<C-N>" else return "\<C-N>\<C-P>" end endif endfunction function! EnableAutoComplete() if mapcheck("a", 'i') == "" && exists('g:loaded_autocomplpop') AutoComplPopEnable end if mapcheck("\<TAB>", 'i') == "" inoremap <silent> <TAB> <c-r>=InsertTabWrapper()<cr> " inoremap <silent> <expr> <CR> pumvisible() ? "\<C-Y>\<CR>" : "\<CR>" endif endfunction function! DisableAutoComplete() if mapcheck("a", 'i') != "" AutoComplPopDisable endif if mapcheck("\<TAB>", 'i') != "" iunmap <TAB> " iunmap <CR> endif endfunction command! EnableAutoComplete call EnableAutoComplete() command! DisableAutoComplete call DisableAutoComplete() call EnableAutoComplete() " start " }}} " }}} " plugin {{{ " surround {{{ " file : ~/.vim/plugin/surround.vim " memo : nmap cs,ds,ys " }}} " snippets {{{ let g:snippetsEmu_key = "<S-Space>" " }}} " YankRing {{{ if has('viminfo') set vi^=! endif function! YRRunAfterMaps() nnoremap <silent> Y :<C-U>YRYankCount 'y$'<CR> endfunction " file : ~/.vim/plugin/yankring.vim " memo : p<C-y>,p<C-n> " let g:yankring_persist = 0 " let g:yankring_enabled = 0 " Disables the yankring " }}} " BufExplorer {{{ " file : ~/.vim/plugin/bufexplorer.vim " memo : <leader>be BufferExplorer " }}} " TagList {{{ let g:Tlist_Use_Right_Window = 1 let g:Tlist_Show_One_File = 1 if mapcheck("<F12>") unmap <F12> endif " }}} " MRU {{{ let g:MRU_Max_Entries = 1000 let g:MRU_Window_Height = 16 let g:MRU_Exclude_Files="^/tmp/.*\|^/var/tmp/.*" " let g:MRU_Use_Current_Window = 0 " let g:MRU_Auto_Close = 1 " }}} " FuzzyFinder {{{ nmap <Leader>fb :FuzzyFinderBuffer<CR> nmap <Leader>ff :FuzzyFinderFile<CR> nmap <Leader>fm :FuzzyFinderMruFile<CR> nmap <Leader>fc :FuzzyFinderMruCmd<CR> nmap <Leader>fv :FuzzyFinderFavFile<CR> nmap <Leader>fd :FuzzyFinderDir<CR> " }}} " LookupFile {{{ " nmap <silent> <C-S> :LUBufs ^.*<CR> let g:LookupFile_AlwaysAcceptFirst=1 let g:LookupFile_PreserveLastPattern=0 let g:LookupFile_AllowNewFiles=0 let g:LookupFile_TagExpr = '"./tags"' if !mapcheck("<A-Ì>") imap <silent> <A-S-L> <C-O><Plug>LookupFile nmap <silent> <A-S-L> <Plug>LookupFile endif " }}} " project {{{ " file : ~/.vim/plugin/project.vim let g:proj_flags = "ist" " }}} " NERD_commenter {{{ " usage: <Leader>c<space> " URL : http://www.vim.org/scripts/script.php?script_id=1218 " file : ~/.vim/plugin/NERD_commenter.vim let NERDSpaceDelims = 1 let NERDShutUp = 1 vmap <Leader>co $o^<C-V><Leader>cc<ESC> " }}} " autodate {{{ let autodate_format = ': %Y-%m-%d %H:%M:%S ' let autodate_keyword_pre = '\$Date' let autodate_keyword_post = '\$' " }}} " chengelog {{{ runtime ftplugin/changelog.vim " }}} " cscope {{{ if has("cscope") set csprg=/usr/bin/cscope set csto=0 set cst set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb endif " }}} " GDB {{{ if has("gdb") set previewheight=12 run macros/gdb_mappings.vim set asm=0 set gdbprg=gdb endif " }}} " Viki {{{ let g:vikiNameSuffix=".viki" let g:vikiOpenFileWith_html = "silent !firefox %{FILE}" autocmd! BufRead,BufNewFile *.viki setl filetype=viki let g:vikiAutoMarks = 0 " bugアリ " }}} " from cmdex.vim {{{ "command! -nargs=0 CdCurrent cd %:p:h " }}} " form CD.vim {{{ " URL http://nanasi.jp/articles/vim/cd_vim.html function! SetCd(set) aug CD au! if (a:set) au BufEnter * execute ":lcd " . expand("%:p:h") endif aug END endfunction command! EnableCd call SetCd(1) command! DisableCd call SetCd(0) call SetCd(1) " }}} "runtime! macros/editexisting.vim vmap <Leader>aa :Align<Space> nmap <silent> <Leader>p <plug>ToggleProject nmap <silent> <Leader>e :Explore<CR> nmap <silent> <Leader><Leader> :MRU<CR> nmap <silent> <Leader>h :noh<CR> nmap <silent> <Leader>sk :w<cr>:!konsole<CR> " nmap <silent> <Leader>sh :source ~/.vim/vimsh.vim<CR> nmap <silent> <Leader>] :Tlist<CR> nmap <Leader>gb :GrepBuffer<Space> nmap <Leader>gg :Grep<Space> " }}}
" etc {{{ " Scratch & SetSyn {{{ " memo : -> command! -nargs=0 -bar Scrach ... " See : h command-bar command! -nargs=1 SS Scratch | call SetSyn("<args>") "}}} " Inc file name {{{ " use my inc command command! -nargs=1 Inc exe "e " . Readirect("!inc " . "<args>")[0] | exe "normal <c-l>" function! Readirect(cmd) let tmp = expand("$TMP/tmp") . Rand(100000000) silent exe a:cmd . " > " . tmp let r = readfile(tmp) silent exe "!rm " . tmp return r endfunc " }}} " rand {{{ function! Rand(n) exe 'ruby VIM::command("return #{rand(' . a:n . ')}")' endfunc " }}} " Calc {{{ command! -nargs=+ Calc :ruby print <args> ruby include Math " }}} " save window position and window size {{{ let s:save_size = '~/.vim/savesize.vim' au GUIEnter * if filereadable(expand(s:save_size)) | execute 'source ' . s:save_size | endif function! SaveSizes() let x0 = getwinposx() let y0 = getwinposy() let x1 = &columns let y1 = &lines execute 'redir! > ' . s:save_size echo 'if exists(":winpos") == 2' echo "\t:winpos" x0 y0 echo "endif" echo "set columns=" . x1 echo "set lines=" . y1 redir END endfunction au VimLeave * if has("gui_running") | silent call SaveSizes() | endif " }}} " #!で始まるファイルを保存時に実行権限を付与する {{{ au BufWritePost * :call AddExecmod() function! AddExecmod() let line = getline(1) if strpart(line, 0, 2) == "#!" call system("chmod +x ". expand("%")) endif endfunction " }}} " auto ctags {{{ au FileWritePost,BufWritePost *.c :call AddCtags() function! AddCtags() call system("ctags -a ". expand("%")) endfunction " }}} " Brouser {{{ " url : http://www.vim.org/tips/tip.php?tip_id=306 " test : javascript:alert() function! Browser () let line0 = getline (".") let line = matchstr (line0, "http[^ ]*") if line == "" let line = matchstr (line0, "ftp[^ ]*") endif if line == "" let line = matchstr (line0, "file[^ ]*") endif "let line = escape (line, "#?&;|%") ":if line=="" " let line = "\"" . (expand("%:p")) . "\"" ":endif call system("firefox " . "\"" . line . "\"") endfunction " http://hoge.com/ nmap <Leader>w :call Browser ()<CR> " }}}
" auto QuickFix {{{ " url : http://vimwiki.net/?tips%2F66 " move MakeEasy " }}} " ruby {{{ "preview interpreter's output(Tip #1244) function! Ruby_eval_vsplit() range if &filetype == "ruby" let src = tempname() let dst = "RubyOutput" " put current buffer's content in a temp file silent execute ": " . a:firstline . "," . a:lastline . "w " . src " open the preview window silent execute ":pedit! " . dst " change to preview window wincmd P " set options setlocal buftype=nofile setlocal noswapfile setlocal syntax=none setlocal bufhidden=delete " replace current buffer with ruby's output silent execute ":%! ruby " . src " change back to the source buffer wincmd p endif endfunction "<F10>でバッファのRubyスクリプトを実行し、結果をプレビュー表示 vmap <silent> <F10> :call Ruby_eval_vsplit()<CR> nmap <silent> <F10> mzggVG<F10>`z map <silent> <S-F10> :pc<CR> " }}} au BufWritePost memo.txt helptags . " }}} " jp {{{ " 文字コードの自動認識 if &encoding !=# 'utf-8' set encoding=japan set fileencoding=japan endif if has('iconv') let s:enc_euc = 'euc-jp' let s:enc_jis = 'iso-2022-jp' " iconvがeucJP-msに対応しているかをチェック if iconv("\x87\x64\x87\x6a", 'cp932', 'eucjp-ms') ==# "\xad\xc5\xad\xcb" let s:enc_euc = 'eucjp-ms' let s:enc_jis = 'iso-2022-jp-3' " iconvがJISX0213に対応しているかをチェック elseif iconv("\x87\x64\x87\x6a", 'cp932', 'euc-jisx0213') ==# "\xad\xc5\xad\xcb" let s:enc_euc = 'euc-jisx0213' let s:enc_jis = 'iso-2022-jp-3' endif " fileencodingsを構築 if &encoding ==# 'utf-8' let s:fileencodings_default = &fileencodings let &fileencodings = s:enc_jis .','. s:enc_euc .',cp932' let &fileencodings = &fileencodings .','. s:fileencodings_default unlet s:fileencodings_default else let &fileencodings = &fileencodings .','. s:enc_jis set fileencodings+=utf-8,ucs-2le,ucs-2 if &encoding =~# '^\(euc-jp\|euc-jisx0213\|eucjp-ms\)$' set fileencodings+=cp932 set fileencodings-=euc-jp set fileencodings-=euc-jisx0213 set fileencodings-=eucjp-ms let &encoding = s:enc_euc let &fileencoding = s:enc_euc else let &fileencodings = &fileencodings .','. s:enc_euc endif endif " 定数を処分 unlet s:enc_euc unlet s:enc_jis endif " 日本語を含まない場合は fileencoding に encoding を使うようにする if has('autocmd') function! AU_ReCheck_FENC() if &fileencoding =~# 'iso-2022-jp' && search("[^\x01-\x7e]", 'n') == 0 let &fileencoding=&encoding endif endfunction autocmd BufReadPost * call AU_ReCheck_FENC() endif " 改行コードの自動認識 set fileformats=unix,dos,mac " □とか○の文字があってもカーソル位置がずれないようにする if exists('&ambiwidth') set ambiwidth=double endif " :IminsertOff/On " command! -nargs=0 IminsertOff inoremap <buffer> <silent> <ESC> <ESC>:set iminsert=0<CR> " command! -nargs=0 IminsertOn iunmap <buffer> <ESC> " runtime macros/editexisting.vim " }}}
imMapRhs
あれ?うまく貼れてなかった。
Peggy2011/07/11 02:24Im so glad that the internet allwos free info like this!
ciyqmse2011/07/11 17:37pEQ3wP <a href="http://lfttxogwufhn.com/">lfttxogwufhn</a>
klpowkesocx2011/07/11 22:21EsWWKi , [url=http://gvvjrdilmeoz.com/]gvvjrdilmeoz[/url], [link=http://uebwfkzyjsda.com/]uebwfkzyjsda[/link], http://pwlwenmlhpvg.com/
wxoldrgpqgj2011/07/13 17:563SKDJk <a href="http://guzkcheiqasl.com/">guzkcheiqasl</a>
pzqhmlpgc2011/07/14 00:00b56gA3 , [url=http://iazlbdcsdfod.com/]iazlbdcsdfod[/url], [link=http://ccybbkaschjc.com/]ccybbkaschjc[/link], http://jvuutyaohjxt.com/
はじめまして。tanakaBoxです。流行のOS自作やってます。
1月前くらいから、サクラエディタからVimに乗り換えました。もうVim無しでは生きていけない体になりつつあります。よろしくお願いします。
" _gvimrc " grep set grepprg=$VIM/search let $HOME = "d:/home" let $TMP = $HOME . "/tmp/vim" " backup set backupdir=$TMP set directory=$TMP " GUI set guioptions-=T set guioptions-=t " shortmess set shortmess+=I " scroll set scrolloff=999 " warp set whichwrap=b,s,h,l,<,>,~,[,] " color colorscheme desert " fold set fdm=marker set fcs=vert:I " :vsplit (i) " history set history=200 " match time set matchtime=2 set formatoptions-=ro " }}} " chars {{{ " set list set list set listchars=tab:>-,eol:< " tab highlight SpecialKey guifg=grey50 set ts=4 set sw=4 set sts=0 " eol highlight clear NonText highlight NonText guifg=grey40 " zenkaku highlight ZenkakuSpace cterm=underline guibg=grey30 match ZenkakuSpace / / " }}} " status line {{{ set statusline= set statusline+=[*%n]\ " バッファ番号 set statusline+=%f\ " ファイル名 set statusline+=%{'['.(&fenc!=''?&fenc:'?').'-'.&ff.']'} " 文字コード " set statusline+=%{'['.GetShortEncodingJP().'-'.&ff.']'} " 文字コード set statusline+=%m " バッファ状態[+]とか set statusline+=%r " 読み取り専用フラグ set statusline+=%h " ヘルプバッファ set statusline+=%w " プレビューウィンドウ set statusline+=%= " 区切り set statusline+=\ %{strftime('%c')} " 時間 set statusline+=%4l,%2c " 行、列 set statusline+=%3p%% " どこにいるか set statusline+=%< " 折り返しの指定 "}}} " swap shell {{{ function! SwitchShell() if &shell != "cmd" set shell=cmd set shellcmdflag=/c else set shell=shell.bat set shellcmdflag=-c end endfunction " }}} " save window position and window size {{{ let s:save_size = $HOME . "/vimfiles/savesize.vim" au GUIEnter * if filereadable(s:save_size) | execute 'source ' . s:save_size | endif function! SaveSizes() let x0 = getwinposx() let y0 = getwinposy() let x1 = &columns let y1 = &lines execute 'redir! > ' . s:save_size echo 'if exists(":winpos") == 2' echo "\t:winpos" x0 y0 echo "endif" echo "set columns=" . x1 echo "set lines=" . y1 redir END endfunction au VimLeave * if has("gui_running") | silent call SaveSizes() | endif " }}} " GetShortEncodingJP {{{ function! GetShortEncodingJP() if &encoding == 'cp932' return 'SJIS' elseif &encoding == 'euc-jisx0213' return 'EUC' elseif &encoding == 'iso-2022-jp-3' return 'JIS' elseif &encoding == 'utf-8' return 'UTF-8' else return &encoding endif endfunction " }}} " Mixi {{{ function! s:Mixi() %s/&/&amp;/ge %s/ /\ /ge %s/\t/\ \ \ \ /ge endfunction command! Mixi call s:Mixi() " }}} " plugin setting {{{ " surround set runtimepath+=~/vimfiles/surround runtime! plugin/surround.vim helptags ~/vimfiles/surround/doc " Explorer if mapcheck('<Leader>e') == "" map <silent> <unique> <Leader>e :Explore<CR> endif " BufExplorer set runtimepath+=~/vimfiles/bufexplorer runtime! plugin/bufexplorer.vim helptags ~/vimfiles/bufexplorer/doc if mapcheck('<Leader>b') == "" map <silent> <unique> <Leader>b :BufExplorer<CR> endif let g:Tlist_Ctags_Cmd = $VIM . "\ctags.exe" " TagList set runtimepath+=~/vimfiles/taglist runtime! plugin/taglist.vim helptags ~/vimfiles/taglist/doc let g:Tlist_Use_Right_Window = 1 let g:Tlist_Show_One_File = 1 if mapcheck('<Leader>t') == "" map <silent> <unique> <Leader>t :Tlist<CR> endif " Projects let g:proj_flags = 'isbcg' set runtimepath+=~/vimfiles/project runtime! plugin/project.vim helptags ~/vimfiles/project/doc if mapcheck('<Leader>p') == "" unmap <F12> nmap <silent> <Leader>p <Plug>ToggleProject endif " pukivim function! PukiVimLoad() set runtimepath+=~/vimfiles/pukivim runtime! plugin/pukiwiki.vim endfunction command! PukiVim call PukiVimLoad() | PukiVim " Chalice function! ChaliceLoad() set runtimepath+=~/vimfiles/chalice runtime! plugin/chalice.vim endfunction command! Chalice call ChaliceLoad() | Chalice " }}} " keybord mapping {{{ if exists("s:did_gvimrc") == 0 imap <silent> <unique> "" ""<Left> imap <silent> <unique> '' ''<Left> imap <silent> <unique> {} {}<Left> imap <silent> <unique> [] []<Left> imap <silent> <unique> () ()<Left> imap <silent> <unique> <> <><Left> endif let s:did_gvimrc = 1 " }}} " make setting {{{ function! s:M (makeArgs) let l:makeProgram = &makeprg let &makeprg = "m" exe "make " . a:makeArgs let &makeprg = l:makeProgram endfunction command! -nargs=* M call s:M(<q-args>) " }}} " fileencoding setting {{{ function! s:UTFUnix () if &modifiable == 1 if line('$') == 1 set fileformat=unix endif if &fileencoding == '' let line = line('.') let col = col('.') let saved_reg = @" silent normal ggyG if @" =~ "[^\x01-\x7e]" set fileencoding=cp932 else set fileencoding=utf-8 endif let @" = saved_reg call cursor(line, col) endif endif endfunc au BufReadPost * call s:UTFUnix() set fileencoding=utf-8 set fileformat=unix " }}} " vim: set fdm=marker:
VimScriptと格闘中です。ムズイ・・・。
まだまだ修行が足りません。
改めてよろしくお願いしまっす!
RayshelonCheck that off the list of thigns I was confused about.
mmvywfY6MZii <a href="http://zkwgpvetjztr.com/">zkwgpvetjztr</a>