tanakaBoxの日記

2007-01-09はじめまして。

はじめまして。tanakaBoxです。流行OS自作やってます。

1月前くらいから、サクラエディタからVimに乗り換えました。もうVim無しでは生きていけない体になりつつあります。よろしくお願いします。

現在の_gvimrc(Win用)を乗っけておきます。

" _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;amp;/ge
	%s/ /\&nbsp;/ge
	%s/\t/\&nbsp;\&nbsp;\&nbsp;\&nbsp;/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と格闘中です。ムズイ・・・。

まだまだ修行が足りません。

改めてよろしくお願いしまっす!

RayshelonRayshelon 2011/07/09 18:50 Check that off the list of thigns I was confused about.

mmvywfmmvywf 2011/07/10 00:16 Y6MZii <a href="http://zkwgpvetjztr.com/">zkwgpvetjztr</a>

GatotGatot 2013/05/03 02:12 At last, someone comes up with the "right" asnewr!

qyhubvmqyqyhubvmqy 2013/05/05 13:41 GdjY5h , [url=http://liayrkgxkitf.com/]liayrkgxkitf[/url], [link=http://qppcoegmjenx.com/]qppcoegmjenx[/link], http://qouygcgtpihf.com/

znpaoszstznpaoszst 2013/05/06 01:45 7wyl9m <a href="http://wdposdumslwh.com/">wdposdumslwh</a>

inopwcinopwc 2013/05/08 11:48 ayA7Qr , [url=http://qeylrbobjpir.com/]qeylrbobjpir[/url], [link=http://qlaqrlzaxhul.com/]qlaqrlzaxhul[/link], http://iawfhemmmdtu.com/

StormStorm 2016/05/04 18:06 asc:onnnotise how you and your fellow morons always have to shout out for helpers and tag team me etc....while i still slay u all solo?shame!!!

TillyTilly 2016/05/06 11:00 The last pic surprised me!It clearly shows that the little <a href="http://yaawxmjew.com">min-icanards</a> are indeed moveable surfaces.Its a pity there is no overhead, plan view that will allow us to see clearly the parting line and hinges of the folding wings.

ゲスト



トラックバック - http://vim.g.hatena.ne.jp/tanakaBox/20070109