Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My Dot Files
#!/bin/bash
#PS1="[\u@\h \W]\$ "
# very simple:
export PS1="[\u:\W]\$ "
# newline with full:
export PS1="\r\n[\D{%F} \t \u@\H job#\j/his#\!/com#\# \w]\r\n\$ "
# newline normal:
export PS1="\r\n[\D{%F} \t \u:\w]\r\n\$ "
# ヒストリ履歴の個数は99,999個まで上げておく。
export HISTSIZE=99999
# ファイルに保存する履歴の数も、同じ個数に上げておく。
export HISTFILESIZE=99999
# 時間も記録する。
export HISTTIMEFORMAT='%F %T '
# 全ての履歴を記録するため、重複排除設定などのHISTCONTROLをクリアする。
unset HISTCONTROL
# 履歴から無視するコマンドの例
export HISTIGNORE='ls:pwd:exit:history'
# 参考
# bash(1)
# https://nkmk.github.io/blog/shell-history/
# http://www.denet.ad.jp/technology/2013/05/vol1-history.html
alias ll='ls -lFG --color'
alias la='ls -aFG --color'
alias ls='ls -FG --color'
# no-color
#alias ll='ls -lFG'
#alias la='ls -aFG'
#alias ls='ls -FG'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias od='/usr/bin/od -Ax -tx1z -v'
alias hexdump='/usr/bin/hexdump -C -v'
alias xxd='/usr/bin/xxd -g 1'
export EDITOR=/usr/bin/vim
#export PAGER=/usr/bin/lv
# modern less:
alias less='/usr/bin/less -MN'
export LESSCHARSET=utf-8
export PAGER=/usr/bin/less
#alias la='ls -aF'
#alias ll='ls -ltr'
#alias ls='ls -hF --color=tty'
# Cygwin の mintty でも、2018年頃になると普通の --color 指定だけで問題ない状況。
alias ls='ls -FG --color'
alias ll='ls -ltrFG --color'
alias la='ls -aFG --color'
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
# for mintty scroll buffer clear
# see: http://www.glamenv-septzen.net/view/1113
alias cls='echo -ne "\ec\e[3J"'
# for "lv" pager UTF-8 "OOPS" message
# see: http://www.glamenv-septzen.net/view/1108
export TERM=cygwin
# 2018年ごろになれば、lvでなくless + LESSCHARSET=utf-8でほぼ問題ない状況。
# modern less:
alias less='/usr/bin/less -MN'
export LESSCHARSET=utf-8
#export PAGER=lv
export PAGER=less
# for mintty title string updates
# see: http://www.glamenv-septzen.net/view/1107
function settitle ()
{
t="[$@]@`hostname`"
# "\e]2;"までがウインドウタイトル変更開始の制御コード
# "\007"が変更終了・・・らしい、です。
echo -ne "\e]2;$t\007"
}
function cd()
{
builtin cd $@ && settitle $(cygpath -m `/usr/bin/pwd`)
}
function pwd()
{
settitle $(cygpath -m `/usr/bin/pwd`)
builtin pwd $@
}
# ヒストリ履歴の個数は99,999個まで上げておく。
export HISTSIZE=99999
# ファイルに保存する履歴の数も、同じ個数に上げておく。
export HISTFILESIZE=99999
# 時間も記録する。
export HISTTIMEFORMAT='%F %T '
# 全ての履歴を記録するため、重複排除設定などのHISTCONTROLをクリアする。
unset HISTCONTROL
# 履歴から無視するコマンドの例
export HISTIGNORE='ls:pwd:exit:history'
# 参考
# bash(1)
# https://nkmk.github.io/blog/shell-history/
# http://www.denet.ad.jp/technology/2013/05/vol1-history.html
# cygwinなら改行プロンプトでこのくらいがちょうど良さそう
export PS1="\r\n[\D{%F} \t \u:\w]\r\n\$ "
[user]
name = NNNN MMMMM
email = aaaaaa@aaaaaaa
[alias]
unstage = reset HEAD --
revert = checkout --
br = branch -ra -vv
# git branch -a はローカルで track されているもののみ。
# git branch -ra なら、trackしていないリモートのbranchも表示してくれる。
# -vv はtracking状態も表示してくれる。
ci = commit -a
co = checkout
stat = status
st = status
praise = blame
up = pull --rebase
url = config --get remote.origin.url
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
ranking = shortlog -s -n --no-merges
# git diff のマジックについてはググってください。
# see: http://d.hatena.ne.jp/murank/20110320/1300619118
# see: http://qiita.com/hide/items/17b970c485e803cbce08
# see: http://d.hatena.ne.jp/perlcodesample/20090708/1246679588
# see: http://chulip.org/entry/20121006/1349406906
d1 = diff HEAD~
d2 = diff HEAD~~
d3 = diff HEAD~~~
d4 = diff HEAD~~~~
d5 = diff HEAD~~~~~
d10 = diff HEAD~~~~~~~~~~
log-graph = log --graph --date=short --pretty=format:'%Cgreen%h %cd %Cblue%cn %Creset%s'
log-all = log --graph --all --color --pretty='%x09%h %cn%x09%s %Cred%d%Creset'
[core]
# Linux環境やWin環境行ったり来たりだと、改行の自動変換を無効化しておいたほうが良いかも?
# see: http://qiita.com/shuhei/items/2da839de8803cb335f86
# autocrlf = false で改行変換を完全にOFF,
# safecrlf = true にすると、改行コードが混在している場合は変換しないというオプション(らしい)
# autocrlf = input
autocrlf = false
safecrlf = true
quotepath = false
# 共通で使う .gitignore
excludesfile = C:\\Users\\xxxx\\yyyy\\gitignore_global.txt
# from http://stackoverflow.com/questions/2183900/how-do-i-prevent-git-diff-from-using-a-pager
# git config --global core.pager cat
#pager = cat
# pager 設定はお好みで。
pager = less -X
[color]
diff = auto
status = auto
branch = auto
interactive = auto
grep = auto
[push]
# see: http://dqn.sakusakutto.jp/2012/10/git_push.html
# Git 1.7.11未満
# default = current
# Git 1.7.11以降
default = simple
# NOTE 1 : "^[" : for VIM, type Ctrl-v, next ESC
# NOTE 2 : "^G" : for VIM, type Ctrl-v, next Ctrl-g
# erace by current bgcolor
defbce on
# set bell msg
bell_msg "^G"
# encoding settings
defkanji utf-8
defencoding utf-8
encoding utf-8 utf-8
# use light color for bold char
#attrcolor b ".I"
# use 256 color
term xterm-256color
# for putty resize problems : see http://d.hatena.ne.jp/ousttrue/20080511/1210494446
termcapinfo xterm-256color 'is=^[r^[m^[2J^[H^[?7h^[?1;4;6l'
defscrollback 10000
# for less, vim
altscreen on
escape ^Tt
vbell off
bell_msg "Bell in window %^G"
# auto dettach for terminal hungup
autodetach on
startup_message off
#logfile "$HOME/.screen/screen-%Y%m%d-%n.log"
#deflog on
caption always "%{= wb} %-w%{=bu dr}%n %t%{-}%+w %{=b wk} %-040=[%l] %Y/%m/%d %C:%s %A"
# see http://blog.remora.cx/2010/02/gnu-screen-2.html
#caption always "%{= wb} %-w%{=bu dr}%n %t%{-}%+w %= %{=b wk} [%l] %{=b wb}%y/%m/%d(%D) %{=b wm}%c"
#caption always "%{= Rk} %?%F%{b kr}%? %?%h%:%t (screen #%n)%? %{-}"
#hardstatus alwayslastline "%{= Gk} %-Lw%40L>%{b kg} %n %t %{-}%+Lw%-040=%{b km} %l %{.b} %Y/%m/%d %C:%s %A "
#sorendition "= Rk"
" vim: expandtab fenc=utf-8 ff=unix ft=vim ts=2 sw=2 sts=0
" about 'mode line', see: http://nanasi.jp/articles/howto/file/modeline.html
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'
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'
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
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
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
set nocompatible
set history=999
" show the cursor position all the time
set ruler
" display incomplete commands
set showcmd
" do incremental searching
set incsearch
" about tabstop, shiftwiddth, softtabstop, see:
" http://d.hatena.ne.jp/waku_52/20110325/1301039968
" http://peacepipe.toshiville.com/2006/05/vimrc-vim.html
set tabstop=4
set shiftwidth=4
set softtabstop=0
" dont replace TAB to spaces by default
"set expandtab
set backspace=2
set shortmess+=I
set visualbell
" display special chars
set listchars=tab:>-,extends:<,trail:-
"set listchars=eol:$,tab:>--
"set listchars=eol:$,tab:>-
" NOTICE : if enable this, TABs are NOT displayed. (anti-pattern)
"set grepprg=search\ $*
set number
set showmatch
set showmode
set complete+=k
let &titleold=expand("%:p:h")
set title
map Q gq
if has("autocmd")
" about FileType detection, see:
" $RUNTIME/filetype.vim
" http://blog.starbug1.com/archives/146
" http://blog.monoweb.info/blog/2010/06/19/
autocmd FileType text setlocal textwidth=78
autocmd FileType vim setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType c setlocal expandtab tabstop=4 shiftwidth=4
autocmd FileType perl setlocal expandtab tabstop=4 shiftwidth=4
autocmd FileType php setlocal expandtab tabstop=4 shiftwidth=4
autocmd FileType ruby setlocal expandtab tabstop=4 shiftwidth=4
autocmd FileType python setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType java setlocal expandtab tabstop=4 shiftwidth=4
autocmd FileType groovy setlocal expandtab tabstop=4 shiftwidth=4
autocmd FileType gsp setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType javascript setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType html setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType css setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType xml setlocal expandtab tabstop=2 shiftwidth=2
autocmd FileType yaml setlocal expandtab tabstop=2 shiftwidth=2
" autocmd FileType php setlocal dictionary+=~/.vim/php.dict
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
autocmd BufNewFile,BufRead *.gradle setlocal expandtab tabstop=4 shiftwidth=4
endif " has("autocmd")
set ignorecase
set smartcase
set wrapscan
syntax on
set list
set hlsearch
set laststatus=2
set statusline=%<%f\ %m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%=%l,%c%V%8P
map <F2> <ESC>:bp<CR>
map <F3> <ESC>:bn<CR>
map <F4> <ESC>:bw<CR>
nnoremap j gj
nnoremap k gk
map <kPlus> <C-W>+
map <kMinus> <C-W>-
"set tags+=~/tags/tags
"set tags+=~/.ctags/symfony
hi Comment ctermfg=lightred
hi Function ctermfg=cyan
" always set autoindenting on
set autoindent
" disable autochdir for VimFiler works.
"set autochdir
"set nocp
set nobackup
set backupcopy=yes
set fdm=marker
"see:
" http://qiita.com/items/019250dbca167985fe32
" http://blogaomu21.blog91.fc2.com/blog-entry-190.html
"set paste
" ... oops, 'set paste' disables 'set autoindent'!!
"colorscheme blue
"Classic Vundle/Bundle {{{
"filetype off
"set rtp+=~/.vim/vundle.git/
"call vundle#rc()
"" original repos on github
""Bundle '...'
"Bundle 'https://github.com/Shougo/unite.vim.git'
"Bundle 'https://github.com/Shougo/vimfiler.git'
"Bundle 'https://github.com/Shougo/vimproc.git'
"Bundle 'https://github.com/Shougo/vimshell.git'
"Bundle 'surround.vim'
"Bundle 'https://github.com/mattn/emmet-vim'
"Bundle 'JavaScript-syntax'
"Bundle "pangloss/vim-javascript"
"Bundle 'basyura/jslint.vim'
""sudo.vim :
""https://github.com/vim-scripts/sudo.vim
""http://nanasi.jp/articles/vim/sudo_vim.html
""http://nob-log.info/2012/04/04/sudo-vim/
"Bundle 'https://github.com/vim-scripts/sudo.vim.git'
"" -> 'vim sudo:/etc/xxxx' or ':e sudo:%'
"" vim-scripts repos
""Bundle '...vim'
"" non github repos
""Bundle 'git://git.....com/foo.git'
"filetype plugin indent on
"}}}
"NeoBundle {{{
filetype plugin indent off
" https://github.com/Shougo/neobundle.vim
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
" Refer to |:NeoBundle-examples|.
" Note: You don't set neobundle setting in .gvimrc!
NeoBundle 'Shougo/unite.vim'
NeoBundle 'Shougo/vimfiler'
NeoBundle 'tpope/vim-surround'
NeoBundle 'mattn/emmet-vim'
NeoBundle 'pangloss/vim-javascript'
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
"}}}
"vimfiler {{{
" open new tab
let g:vimfiler_edit_action = 'tabopen'
" disable netrw
let g:vimfiler_as_default_explorer = 1
let g:vimfiler_safe_mode_by_default = 0
" open directory for current buffer
nnoremap <silent> <Leader>fe :<C-u>VimFilerBufferDir -quit<CR>
" open direcotry (like IDE side bar control)
nnoremap <silent> <Leader>fi :<C-u>VimFilerBufferDir -split -simple -winwidth=35 -no-quit<CR>
augroup VimFiler
autocmd FileType vimfiler call s:vimfiler_my_settings()
augroup END
function! s:vimfiler_my_settings()
" customize keymappings
nunmap <buffer> j
nunmap <buffer> k
" unmap <buffer> t
" unmap <buffer> T
" nnoremap <buffer> zR <Plug>(vimfiler_expand_tree_recursive)
" nnoremap <buffer> zo <Plug>(vimfiler_expand_tree)
" nmap <buffer> q <Plug>(vimfiler_exit)
" nmap <buffer> Q <Plug>(vimfiler_hide)
endfunction
"}}}
"zencoding-vim {{{
let g:user_zen_settings = {
\ 'lang' : 'ja',
\ 'html' : {
\ 'filters' : 'html',
\ 'snippets' : {
\ 'jq' : "<script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js\"></script>\n<script>\n\\$(function() {\n\t|\n})()\n</script>",
\ 'cd' : "<![CDATA[|]]>",
\ },
\ },
\ 'php' : {
\ 'extends' : 'html',
\ 'filters' : 'html,c',
\ },
\ 'xml' : {
\ 'extends' : 'html',
\ },
\ 'haml' : {
\ 'extends' : 'html',
\ },
\ 'javascript' : {
\ 'snippets' : {
\ 'jq' : "\\$(function() {\n\t\\${cursor}\\${child}\n});",
\ 'jq:json' : "\\$.getJSON(\"${cursor}\", function(data) {\n\t\\${child}\n});",
\ 'jq:each' : "\\$.each(data, function(index, item) {\n\t\\${child}\n});",
\ 'fn' : "(function() {\n\t\\${cursor}\n})();",
\ 'tm' : "setTimeout(function() {\n\t\\${cursor}\n}, 100);",
\ },
\ 'use_pipe_for_cursor' : 0,
\ },
\}
"}}}
" jslint.vim
function! s:javascript_filetype_settings()
autocmd BufLeave <buffer> call jslint#clear()
autocmd BufWritePost <buffer> call jslint#check()
autocmd CursorMoved <buffer> call jslint#message()
endfunction
autocmd FileType javascript call s:javascript_filetype_settings()
@msakamoto-sf

This comment has been minimized.

Show comment
Hide comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment