.vimrc,.gvimrc

.vimrc

" -------------------
" Color
" -------------------
syntax on

highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=white
match ZenkakuSpace / /

set ts=8 sw=8
set softtabstop=8
set expandtab
set shiftwidth=8

" -------------------
" Search
" -------------------
set ignorecase
set smartcase
set incsearch
set hlsearch

" -------------------
" Status line
" -------------------
set statusline=%F%m%r%h%w\%=\ [%v,%l/%L][%p%%]
set laststatus=2

" -------------------
" VimShell
" -------------------
"let g:netrw_liststyle=3

" vimproc
let g:vimproc_dll_path = $HOME."/.vim/autoload/proc.so"

nnoremap <silent> ,is :VimShell<CR>
" vimshell
"let g:VimShell_EnableInteractive = 1


" -------------------
" Filer
" -------------------
:au BufEnter * execute ":lcd " . expand("%:p:h")

" -------------------
" Tags
" -------------------
set tags+=~/.vim/sys_c_tags

" -------------------
" 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

" -------------------
" OMNI completion
" -------------------
filetype plugin indent on

function InsertTabWrapper()
    if pumvisible()
        return "\<c-n>"
    endif
    let col = col('.') - 1
    if !col || getline('.')[col - 1] !~ '\k\|<\|/'
        return "\<tab>"
    elseif exists('&omnifunc') && &omnifunc == ''
        return "\<c-n>"
    else
        return "\<c-x>\<c-o>"
    endif
endfunction
inoremap <tab> <c-r>=InsertTabWrapper()<cr>

" -------------------
" TwitVim
" -------------------
let twitvim_login = ":"
let twitvim_count = 20
:map ft     :RefreshTwitter
:map fft    :FriendsTwitter
:map ffft   :RepliesTwitter
:map fffft  :PosttoTwitter
:map ffffft :CPosttoTwitter
""base64 encode
"$ cat -n 'user:pass'|openssl base64
"let twitvim_login_b64 = "base64string"

" -------------------
" Encoding recognition
" -------------------
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 is support the 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 is support the 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
  " rebuilding 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
  " reduce of const value
  unlet s:enc_euc
  unlet s:enc_jis
endif
" if it do not include Japanese , fileencoding uses 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
" Automatic recognition of newlines
set fileformats=unix,dos,mac
" Even with a '□' or '○', so that the cursor position is slipping
if exists('&ambiwidth')
  set ambiwidth=double
endif