2009年3月16日月曜日

VIMRCです。


 VimのStatuslineにカーソルの位置情報などを表示しようと思い試していたがうまく行かず。。
結論から言うと、私がインストールしていたパッケージはvim-tinyでフル機能のVimではなかったということでした。。で、改めてVimrcを晒してみます。
" .vimrc
" Clear any existing autocommands:
if has("autocmd")
" Restore cursor position
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

" Filetypes (au = autocmd)
au FileType helpfile set nonumber " no line numbers when viewing help
au FileType helpfile nnoremap <buffer><cr> <c-]> " Enter selects subject
au FileType helpfile nnoremap <buffer><bs> <c-T> " Backspace to go back

" When using mutt, text width=72
au FileType mail,tex set textwidth=72
au FileType cpp,c,java,sh,pl,php,asp set autoindent
au FileType cpp,c,java,sh,pl,php,asp set smartindent
au FileType cpp,c,java,sh,pl,php,asp set cindent
"au BufRead mutt*[0-9] set tw=72

" Automatically chmod +x Shell and Perl scripts
"au BufWritePost *.sh !chmod +x %
"au BufWritePost *.pl !chmod +x %

" File formats
au BufNewFile,BufRead *.pls set syntax=dosini
au BufNewFile,BufRead modprobe.conf set syntax=modconf
endif

" *** User Interface
" use indents of 4 spaces, and have them copied down lines:
set shiftwidth=4
set tabstop=4
set shiftround
set expandtab
set autoindent

" allways show status line
set ls=2

" Set for visible tab
"set listchars=tab:>-,extends:<,trail:-,eol:<
set listchars=tab:>-
set list

" The format of status line
"set statusline=%<%f\%m%r%h%w%y%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%4v\ %l/%L
set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
set laststatus=2

" No beep
" set vb t_vb=
set visualbell

" No auto NL
set formatoptions=q

" Show line number
set number

" have syntax highlighting in terminals which can display colours:
"if has('syntax') &amp;amp;amp;& (&t_Co > 2)
syntax on
"endif

" have fifty lines of command-line (etc) history:
set history=50

" display the current mode and partially-typed commands in the status line:
set showmode
set showcmd

" have the mouse enabled all the time:
"set mouse=a

" don't have files trying to override this .vimrc:
set nomodeline

" Set the type of background color
set background=dark

" *** Text Formatting -- Specific File Formats
" enable filetype detection:
"filetype on

" for C-like programming, have automatic indentation:
"autocmd FileType c,cpp,slang set cindent

" for actual Java C (not C++) programming where comments have explicit end
" characters, if starting a new line in the middle of a comment automatically
" insert the comment leader characters:
"autocmd FileType c,java set formatoptions+=ro smartindent noexpandtab tabstop=4

" for Perl programming, have things in braces indenting themselves:
"autocmd FileType perl set smartindent

" for CSS, also have things in braces indented:
"autocmd FileType css set smartindent

" for HTML, generally format text, but if a long line has been created leave it
" alone when editing:
"autocmd FileType html set formatoptions+=tl

" for both CSS and HTML, use genuine tab characters for indentation, to make
" files a few bytes smaller:
"autocmd FileType html,css set noexpandtab tabstop=4

" in makefiles, don't expand tabs to spaces, since actual tab characters are
" needed, and have indentation at 4 chars to be sure that all indents are tabs
" (despite the mappings later):
"autocmd FileType make set noexpandtab shiftwidth=4

" *** Search & Replace
" make searches case-insensitive, unless they contain upper-case letters:
set ignorecase
set smartcase
set hlsearch

" show the `best match so far' as search strings are typed:
set incsearch

0 件のコメント: