vimrc

" Commo -------------------------------

set nocompatible " vim

" ----------------------------------

set t_Co=256

"colorscheme hybrid " カラースキームの設定

" -------- vim plugin lightline -----

"let g:lightline = {

"\ 'colorscheme':'wombat'

"\}

" ----------------------------------

let g:lightline = {

\ 'colorscheme': 'jellybeans',

\ 'mode_map': {'c': 'NORMAL'},

\ 'active': {

\ 'left': [ [ 'mode', 'paste' ], [ 'fugitive', 'filename' ] ]

\ },

\ 'component_function': {

\ 'modified': 'LightLineModified',

\ 'readonly': 'LightLineReadonly',

\ 'fugitive': 'LightLineFugitive',

\ 'filename': 'LightLineFilename',

\ 'fileformat': 'LightLineFileformat',

\ 'filetype': 'LightLineFiletype',

\ 'fileencoding': 'LightLineFileencoding',

\ 'mode': 'LightLineMode'

\ }

\ }

function! LightLineModified()

return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-'

endfunction

function! LightLineReadonly()

return &ft !~? 'help\|vimfiler\|gundo' && &readonly ? 'x' : ''

endfunction

function! LightLineFilename()

return ('' != LightLineReadonly() ? LightLineReadonly() . ' ' : '') .

\ (&ft == 'vimfiler' ? vimfiler#get_status_string() :

\ &ft == 'unite' ? unite#get_status_string() :

\ &ft == 'vimshell' ? vimshell#get_status_string() :

\ '' != expand('%:t') ? expand('%:t') : '[No Name]') .

\ ('' != LightLineModified() ? ' ' . LightLineModified() : '')

endfunction

function! LightLineFugitive()

if &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head')

return fugitive#head()

else

return ''

endif

endfunction

function! LightLineFileformat()

return winwidth(0) > 70 ? &fileformat : ''

endfunction

function! LightLineFiletype()

return winwidth(0) > 70 ? (&filetype !=# '' ? &filetype : 'no ft') : ''

endfunction

function! LightLineFileencoding()

return winwidth(0) > 70 ? (&fenc !=# '' ? &fenc : &enc) : ''

endfunction

function! LightLineMode()

return winwidth(0) > 60 ? lightline#mode() : ''

endfunction

" --------------------------------------

set background=dark" 背景色の傾向(カラースキームがそれに併せて色の明暗を変えてくれる)

" File ---------------------------------

set autoread " 更新時自動再読込み

set hidden " 編集中でも他のファイルを開けるようにする

set noswapfile " スワップファイルを作らない

set nobackup " バックアップを取らない

autocmd BufWritePre * :%s/\s\+$//ge " 保存時に行末の空白を除去する

syntax on " シンタックスカラーリングオン

" Indent -------------------------------

" tabstop: Tab文字を画面上で何文字分に展開するか

" shiftwidth: cindentやautoindent時に挿入されるインデントの幅

" softtabstop: Tabキー押し下げ時の挿入される空白の量,0の場合はtabstopと同じ,BSにも影響する

set tabstop=2 shiftwidth=2 softtabstop=0

set autoindent smartindent " 自動インデント,スマートインデント

" Assist imputting ---------------------

set backspace=indent,eol,start " バックスペースで特殊記号も削除可能に

set formatoptions=lmoq " 整形オプション,マルチバイト系を追加

set whichwrap=b,s,h,s,<,>,[,] " カーソルを行頭、行末で止まらないようにする

"set clipboard=unnamed,autoselect " バッファにクリップボードを利用する

" Complement Command -------------------

set wildmenu " コマンド補完を強化

set wildmode=list:full " リスト表示,最長マッチ

" Search -------------------------------

set wrapscan " 最後まで検索したら先頭へ戻る

set ignorecase " 大文字小文字無視

set smartcase " 大文字ではじめたら大文字小文字無視しない

set incsearch " インクリメンタルサーチ

set hlsearch " 検索文字をハイライト

" View ---------------------------------

set showmatch " 括弧の対応をハイライト

set showcmd " 入力中のコマンドを表示

set showmode " 現在のモードを表示

set number " 行番号表示

set nowrap " 画面幅で折り返さない

set list " 不可視文字表示

set listchars=tab:>\ " 不可視文字の表示方法

set notitle " タイトル書き換えない

set scrolloff=5 " 行送り

set display=uhex " 印字不可能文字を16進数で表示

hi ZenkakuSpace gui=underline guibg=DarkBlue cterm=underline ctermfg=LightBlue " 全角スペースの定義

match ZenkakuSpace / / " 全角スペースの色を変更

set cursorline " カーソル行をハイライト

augroup cch

autocmd! cch

autocmd WinLeave * set nocursorline

autocmd WinEnter,BufRead * set cursorline

augroup END

:hi clear CursorLine

:hi CursorLine gui=underline

hi CursorLine ctermbg=black guibg=black

" StatusLine ---------------------------

set laststatus=2 " ステータスラインを2行に

set statusline=%<%f\ #%n%m%r%h%w%{'['.(&fenc!=''?&fenc:&enc).']['.&ff.']'}%y%=%l,%c%V%8P

" Charset, Line ending -----------------

set termencoding=utf-8

set encoding=utf-8

set fileencodings=utf-8,cp932,euc-jp,iso-2022-jp

set ffs=unix,dos,mac " LF, CRLF, CR

if exists('&ambiwidth')

set ambiwidth=double " UTF-8の□や○でカーソル位置がずれないようにする

endif

" --------------------------------------

" my config

" --------------------------------------

" When insert mode, enable hjkl and enable go to home/end.

imap

imap

imap

imap

imap

imap

" When insert mode, change statusline.

let g:hi_insert = 'hi StatusLine gui=None guifg=Black guibg=Yellow cterm=None ctermfg=Black ctermbg=Yellow'

if has('syntax')

augroup InsertHook

autocmd!

autocmd InsertEnter * call s:StatusLine('Enter')

autocmd InsertLeave * call s:StatusLine('Leave')

augroup END

endif

let s:slhlcmd = ''

function! s:StatusLine(mode)

if a:mode == 'Enter'

silent! let s:slhlcmd = 'highlight ' . s:GetHighlight('StatusLine')

silent exec g:hi_insert

else

highlight clear StatusLine

ilent exec s:slhlcmd

endif

endfunction

function! s:GetHighlight(hi)

redir => hl

exec 'highlight '.a:hi

redir END

let hl = substitute(hl, '[\r\n]', '', 'g')

let hl = substitute(hl, 'xxx', '', '')

return hl

endfunction

" for Python ---------------------------

filetype plugin on

autocmd Filetype python setl autoindent

autocmd FileType python setl smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class

autocmd FileType python setl tabstop=4 shiftwidth=4 softtabstop=0

" Execute python script C-P

function! s:ExecPy()

exe "!" . &ft . " %"

:endfunction

command! Exec call ExecPy()

autocmd FileType python map :call ExecPy()

""----------

""dein.vim

""----------

if &compatible

set nocompatible

endif

set runtimepath^=~/.vim/dein/repos/github.com/Shougo/dein.vim

call dein#begin(expand('~/.vim/dein'))

call dein#add('Shougo/dein.vim')

call dein#add('itchyny/lightline.vim')

call dein#add('nathanaelkane/vim-indent-guides')

call dein#add('tomtom/tcomment_vim')

call dein#add('othree/html5.vim')

call dein#add('hail2u/vim-css3-syntax')

call dein#add('jelera/vim-javascript-syntax')

call dein#end()

filetyp plugin indent on

""-------------------

"" vim-indent-guides

""-------------------

" vimを立ち上げたときに、自動的にvim-indent-guidesをオンにする

"let g:indent_guides_enable_on_vim_startup = 1

""-----------------

"" tomtommet

""---------------

" Shift+Vで対象の範囲を選択し、Ctrl+-(コントロールキー+ハイフン)を2回押すだけで

" その範囲をまとめてコメントアウトしたり、コメントを外したりできます。

" コメントのON/OFFはCtrl+- のほか、gccでも実現できます

"

"" ----------

"" html5.vim

"" ----------

" HTML 5 tags

syn keyword htmlTagName contained article aside audio bb canvas command

syn keyword htmlTagName contained datalist details dialog embed figure

syn keyword htmlTagName contained header hgroup keygen mark meter nav output

syn keyword htmlTagName contained progress time ruby rt rp section time

syn keyword htmlTagName contained source figcaption

syn keyword htmlArg contained autofocus autocomplete placeholder min max

syn keyword htmlArg contained contenteditable contextmenu draggable hidden

syn keyword htmlArg contained itemprop list sandbox subject spellcheck

syn keyword htmlArg contained novalidate seamless pattern formtarget

syn keyword htmlArg contained formaction formenctype formmethod

syn keyword htmlArg contained sizes scoped async reversed sandbox srcdoc

syn keyword htmlArg contained hidden role

syn match htmlArg "\<\(aria-[\-a-zA-Z0-9_]\+\)=" contained

syn match htmlArg contained "\s*data-[-a-zA-Z0-9_]\+"

"" ---------------

"" vim-css3-syntax

"" ---------------

augroup VimCSS3Syntax

autocmd!

autocmd FileType css setlocal iskeyword+=-

augroup END

""----------------------

"" vim-javascript-syntax

""----------------------