cygwin用設定ファイル

```sh:.bashrc
[[ "$-" != *i* ]] && return
if [ -n ${DISPLAY} ]; then
    export DISPLAY=localhost:0.0
fi
if [ ! -n "${TERM}" ]; then
    TERM=cygwin
fi
alias ls='ls -hBF --color=tty --group-directories-first'
alias la='ls -A'
alias ll='ls -lo'
alias lt='ll -rt'
alias sl='ls -hF --color=tty'
alias sls='ls -hFX --color=tty'
alias vi='vim'
alias open='cygstart .'

alias grep='grep -P --color'
alias w3m='w3m -t 4'
alias chmdo='chmod'
export PAGER='lv -Iu8 -Os'
export PATH="$PATH:$HOME/bin"
```

```sh:.bash_profile
if [ -f "${HOME}/.bashrc" ] ; then
  source "${HOME}/.bashrc"
fi
if [ -e /etc/bash.bashrc ] ; then
  source /etc/bash.bashrc
fi
if [ -e "${HOME}/.bashrc" ] ; then
  source "${HOME}/.bashrc"
fi
export TERM=vt100
#export LANG=ja_JP.SJIS
export LESSCHARSET=japanese-sjis
export SHELL=/bin/bash
export TMPDIR=/tmp
export TZ=JST-09
export MAKE_MODE=unix
export PS1="\[\e[0;33m\][\w]\n\[\e[0m\]\\$ "
export MANPATH=${MANPATH:-}:/usr/local/man
export PERL5LIB=~/perl5/lib/perl5;
```

```sh:.inputrc
# the following line is actually
# equivalent to "\C-?": delete-char
"\e[3~": delete-char
# VT
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# kvt
"\e[H": beginning-of-line
"\e[F": end-of-line
# rxvt and konsole (i.e. the KDE-app...)
"\e[7~": beginning-of-line
"\e[8~": end-of-line
# VT220
"\eOH": beginning-of-line
"\eOF": end-of-line
# Allow 8-bit input/output
#set meta-flag on
#set convert-meta off
#set input-meta on
#set output-meta on
```

```cygterm.cfg
TERM = C:\Path\to\putty\puttyjp.exe -load "cygterm" %s -P %d
TERM_TYPE = xterm
PORT_START = 20000
PORT_RANGE = 40
SHELL = /bin/bash --login -i
ENV_1 = MAKE_MODE=unix
ENV_2 = HOME=/home/XXX
```

puttyセッションの設定。

* ホスト名: 127.0.0.1
* ポート: 20000
* 接続タイプ: Telnet
* 端末->ローカルエコー: 強制的にオフ
* 端末->ローカルライン編集: 強制的にオフ
* キーボード->バックスペースキー: Control-H
* 変換->リモートの文字セット: UTF-8(CJK)
* 色->ANSI BLUE: 赤0 緑138 青240

```:.vimrc
if v:progname =~? "evim"
  finish
endif
set nocompatible

set backspace=indent,eol,start

if has("vms")
  set nobackup          " do not keep a backup file, use versions instead
else
  set backup            " keep a backup file
endif

set history=50          " keep 50 lines of command line history
set ruler               " show the cursor position all the time
set showcmd             " display incomplete commands
set incsearch           " do incremental searching

map Q gq

set mouse=a
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

if has("autocmd")
 filetype plugin indent on
 augroup vimrcEx
 au!
  autocmd FileType text setlocal textwidth=78

  autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif
  augroup END
else
  set autoindent
endif
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis
" 文字コードの自動認識
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
" □とか○の文字があってもカーソル位置がずれないようにする
if exists('&ambiwidth')
  set ambiwidth=double
endif

"set encoding=cp932
"set fileencoding=cp932
"文字コード"
set fileencoding=utf8
set encoding=utf8
augroup filetypedetect
  au! BufRead,BufNewFile *.src setfiletype cpp
augroup END

syntax on
"set list
"set listchars=eol:\ ,tab:>\ ,extends:<
set number
set tabstop=2
set shiftwidth=2
set noswapfile
set term=builtin_linux
set ttytype=builtin_linux
set backupdir=~/.vim/tmp
set hlsearch
colorscheme torte
```