Created
September 29, 2017 08:11
-
-
Save akiya64/f79e66aea8d106febe81a636fba93a5b to your computer and use it in GitHub Desktop.
.vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filetype off | |
"backup保存先 | |
set backupdir=~/.vim/tmp | |
"backup保存先 | |
set undodir=~/.vim/tmp | |
if has('win64') | |
set runtimepath^=~/.vim/ | |
endif | |
set cursorline | |
augroup AdditionalHighlights | |
autocmd! | |
" Traiing spaces | |
if &filetype ==!'vimfiler' | |
autocmd ColorScheme * highlight link TrailingSpaces Error | |
autocmd Syntax * syntax match TrailingSpaces containedin=ALL /\s\+$/ | |
endif | |
" Zenkaku space | |
autocmd ColorScheme * highlight link ZenkakuSpace Error | |
autocmd Syntax * syntax match ZenkakuSpace containedin=ALL / / | |
augroup END | |
"タブ、行末、改行の可視設定 | |
set listchars=tab:>\ ,trail:-,extends:>,precedes:< | |
"タブの設定 | |
set tabstop=4 | |
set shiftwidth=4 | |
set softtabstop=4 | |
set expandtab | |
set autoindent | |
set smartindent | |
"ファイルタイプ別の設定 | |
autocmd BufEnter *.php :set syn=wordpress | |
" VimShowHlGroup: Show highlight group name under a cursor | |
command! VimShowHlGroup echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') | |
" adding to vim-airline's statusline | |
let g:webdevicons_enable_airline_statusline = 1 | |
"プラグイン設定 パッケージ管理はPlug | |
call plug#begin('~/.vim/plugged') | |
Plug 'Shougo/unite.vim' | |
Plug 'h1mesuke/unite-outline' | |
Plug 'itchyny/lightline.vim' | |
Plug 'Shougo/vimfiler' | |
Plug 'deris/vim-gothrough-jk' | |
"git | |
Plug 'tpope/vim-fugitive' | |
"シンタックスハイライト | |
Plug 'mattn/emmet-vim' | |
Plug 'hail2u/vim-css3-syntax' | |
Plug 'othree/html5.vim' | |
Plug 'scrooloose/syntastic' | |
"変更箇所の表示 | |
Plug 'mhinz/vim-signify' | |
"カラースキーム編集用 | |
Plug 'cocopon/colorswatch.vim' | |
Plug 'lilydjwg/colorizer' | |
"スニペットとか | |
Plug 'Shougo/neosnippet-snippets' | |
Plug 'Shougo/neocomplete.vim' | |
Plug 'Shougo/neosnippet.vim' | |
Plug 'Shougo/neocomplcache' | |
Plug 'Shougo/neocomplcache-rsense.vim' | |
Plug 'vim-ruby/vim-ruby' | |
"括弧とかEnd補完プラグイン | |
Plug 'cohama/lexima.vim' | |
Plug 'tpope/vim-endwise' | |
Plug 'Townk/vim-autoclose' | |
Plug 'kana/vim-smartchr' | |
"テキストオブジェクト 拡張 | |
Plug 'kana/vim-textobj-user' | |
Plug 'rhysd/vim-textobj-ruby' | |
"for MarkDown | |
Plug 'tpope/vim-markdown' | |
Plug 'kannokanno/previm' | |
Plug 'tyru/open-browser.vim' | |
"for Rails | |
Plug 'tpope/vim-rails' | |
Plug 'basyura/unite-rails' | |
"Ctags | |
Plug 'majutsushi/tagbar' | |
Plug 'vim-scripts/tagbar-phpctags' | |
Plug 'szw/vim-tags' | |
Plug 'majutsushi/tagbar' | |
"ネットワークアクセス | |
Plug 'mattn/webapi-vim' | |
call plug#end() | |
"VimFilerをデフォルトのファイラーとする | |
let g:vimfiler_as_default_explorer=1 | |
" 読み込んだプラグインも含め、ファイルタイプの検出、ファイルタイプ別プラグイン/インデントを有効化する | |
filetype plugin indent on | |
"マークダウン用ファイル設定 | |
autocmd BufRead,BufNewFile *.md set filetype=markdown | |
autocmd BufRead,BufNewFile *.md hi Constant guifg=#fffe89 | |
"キーアサイン | |
let mapleader = "\<Space>" | |
noremap <leader>fi :<C-u>VimFilerBufferDir -split -simple -winwidth=35 -no-quit<CR> | |
nnoremap <silent> [unite]a :<C-u>UniteBookmarkAdd<CR> | |
" neocomplcache | |
let g:neocomplcache_enable_at_startup = 1 | |
let g:neocomplcache_max_list = 20 | |
let g:neocomplcache_manual_completion_start_length = 3 | |
let g:neocomplcache_enable_ignore_case = 1 | |
let g:neocomplcache_enable_smart_case = 1 | |
"辞書ファイルの設定 | |
autocmd FileType php :set dictionary=~/.vim/dict/wordpress/*.dict | |
autocmd FileType ruby :set dictionary=~/.vim/dict/ruby.dict | |
"git用プラグインでブランチをステータスバーに表示 | |
set statusline+=%{exists('g:loaded_fugitive')?fugitive#statusline():''} | |
"lightlineプラグインの設定 長いので常に末尾とする | |
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() | |
try | |
if &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head') | |
return fugitive#head() | |
endif | |
catch | |
endtry | |
return '' | |
endfunction | |
function! LightLineFileformat() | |
return winwidth(0) > 70 ? &fileformat : '' | |
endfunction | |
function! LightLineFiletype() | |
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' | |
endfunction | |
function! LightLineFileencoding() | |
return winwidth(0) > 70 ? (strlen(&fenc) ? &fenc : &enc) : '' | |
endfunction | |
function! LightLineMode() | |
return winwidth(0) > 60 ? lightline#mode() : '' | |
endfunction | |
"lightline end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment