Created
November 21, 2016 14:30
-
-
Save axtutuu/434f9c8da09b6f86e33e3482011234ab to your computer and use it in GitHub Desktop.
vimrc
This file contains 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 plugin indent off | |
if has('vim_starting') | |
set runtimepath+=~/.vim/bundle/neobundle.vim | |
call neobundle#begin(expand('~/.vim/bundle/')) | |
NeoBundleFetch 'Shougo/neobundle.vim' | |
" originalrepos on github | |
NeoBundle 'Shougo/neobundle.vim' | |
NeoBundle 'Shougo/vimproc' | |
NeoBundle 'VimClojure' | |
NeoBundle 'Shougo/vimshell' | |
NeoBundle 'Shougo/unite.vim' | |
NeoBundle 'Shougo/neocomplcache' | |
NeoBundle 'Shougo/neosnippet-snippets' | |
NeoBundle 'jpalardy/vim-slime' | |
NeoBundle 'scrooloose/syntastic' | |
NeoBundle 'tpope/vim-endwise' | |
NeoBundle 'tpope/vim-rails' | |
NeoBundle 'vim-scripts/ruby-matchit' | |
NeoBundle 'Shougo/neosnippet.vim' | |
NeoBundle 'Shougo/neocomplcache-rsense' | |
NeoBundle 'scrooloose/nerdtree' | |
NeoBundle 'slim-template/vim-slim' | |
NeoBundle 'kchmck/vim-coffee-script' | |
NeoBundle "neocomplete.vim" | |
NeoBundle 'itchyny/lightline.vim' | |
NeoBundle 'airblade/vim-gitgutter' | |
NeoBundle 'alpaca-tc/alpaca_powertabline' | |
NeoBundle 'Lokaltog/powerline-fontpatcher' | |
NeoBundle 'tpope/vim-fugitive' | |
NeoBundle 'open-browser.vim' | |
NeoBundle 'toyamarinyon/vim-swift' | |
NeoBundle 'tomtom/tcomment_vim' | |
NeoBundle 'nathanaelkane/vim-indent-guides' | |
NeoBundle 'bronson/vim-trailing-whitespace' | |
NeoBundle 'Lokaltog/vim-easymotion' | |
" color | |
NeoBundle 'nanotech/jellybeans.vim' | |
NeoBundle 'sjl/badwolf' | |
NeoBundle 'altercation/vim-colors-solarized' | |
" node.js support | |
NeoBundle 'digitaltoad/vim-jade' | |
NeoBundle 'wavded/vim-stylus' | |
NeoBundle 'pangloss/vim-javascript' | |
NeoBundle 'groenewege/vim-less' | |
NeoBundle 'wakatime/vim-wakatime' | |
NeoBundle 'marijnh/tern_for_vim' | |
NeoBundle 'junegunn/vim-easy-align' | |
""NeoBundle 'https://bitbucket.org/kovisoft/slimv' | |
NeoBundle 'derekwyatt/vim-scala' | |
call neobundle#end() | |
end | |
"------------------------------------------------ | |
" 移動 | |
"------------------------------------------------ | |
nmap <C-H> <C-W>h | |
nmap <C-J> <C-W>j | |
nmap <C-K> <C-W>k | |
nmap <C-L> <C-W>l | |
noremap <C-o> <esc> | |
noremap! <C-o> <esc> | |
"------------------------------------------------------------------------------ | |
"nerdtree | |
"------------------------------------------------------------------------------ | |
noremap <F1> :NERDTreeToggle<CR> | |
"------------------------------------------------------------------------------- | |
" カラー関連 Colors | |
"------------------------------------------------------------------------------- | |
set t_Co=256 | |
colorscheme jellybeans | |
syntax enable | |
" colorscheme molokai | |
" colorscheme badwolf | |
" colorscheme solarized | |
"autocmd VimEnter * :GuiColorScheme darkspectrum | |
" 補完候補の色づけ for vim7 | |
hi Pmenu ctermbg=255 ctermfg=0 guifg=#000000 guibg=#999999 | |
hi PmenuSel ctermbg=blue ctermfg=black | |
hi PmenuSel cterm=reverse ctermfg=33 ctermbg=222 gui=reverse guifg=#3399ff guibg=#f0e68c | |
hi PmenuSbar ctermbg=0 ctermfg=9 | |
hi PmenuSbar ctermbg=255 ctermfg=0 guifg=#000000 guibg=#FFFFFF | |
"------------------------------------------------------------------------------- | |
" インデント Indent | |
"------------------------------------------------------------------------------- | |
set autoindent " 自動でインデント | |
set smartindent " 新しい行を開始したときに、新しい行のインデントを現在行と同じ量にする。 | |
set cindent " Cプログラムファイルの自動インデントを始める | |
"set paste " ペースト時にautoindentを無効に(onにするとautocomplpop.vimが動かない) | |
" softtabstopはTabキー押し下げ時の挿入される空白の量,0の場合はtabstopと同じ,BSにも影響する | |
set tabstop=2 shiftwidth=2 softtabstop=0 | |
if has("autocmd") | |
"ファイルタイプの検索を有効にする | |
filetype plugin on | |
"そのファイルタイプにあわせたインデントを利用する | |
filetype indent on | |
autocmd FileType apache setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType css setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType diff setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType html setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType phtml setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType java setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType javascript setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType perl setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType php setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType python setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType ruby setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType sh setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType sql setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType vim setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType xhtml setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType xml setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType yaml setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType zsh setlocal sw=4 sts=4 ts=4 et | |
autocmd FileType typescript setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType slim setlocal sw=2 sts=2 ts=2 et | |
autocmd FileType jade setlocal sw=2 sts=2 ts=2 et | |
"-------------------------------------------------- | |
" Syntax Check or Execute | |
"-------------------------------------------------- | |
autocmd FileType python :map <C-e> <ESC>:!python %<CR> | |
autocmd FileType php :map <C-e> <ESC>:!php %<CR> | |
autocmd FileType php :map <C-n> <ESC>:!php -l %<CR> | |
autocmd FileType ruby :map <C-e> <ESC>:!ruby %<CR> | |
autocmd FileType typescript :map <C-e> <ESC>:!tsc -e %<CR> | |
endif | |
augroup SkeletonAu | |
autocmd! | |
autocmd BufNewFile *.php 0r $HOME/.vim/skel/php | |
autocmd BufNewFile *.rb 0r $HOME/.vim/skel/rb | |
autocmd BufNewFile *.scala 0r $HOME/.vim/skel/scala | |
augroup END | |
" 選択した範囲のインデントサイズを連続して変更する | |
vnoremap < <gv | |
vnoremap > >gv | |
"------------------------------------------------------------------------------- | |
" 基本設定 Basics | |
"------------------------------------------------------------------------------- | |
autocmd ColorScheme * highlight LineNr ctermfg=6 | |
set nocompatible " Vi互換をオフ | |
set scrolloff=5 " スクロール時の余白確保 | |
set textwidth=0 " | |
"一行に長い文章を書いていても自動折り返しをしない | |
set nobackup " バックアップ取らない | |
set autoread " 他で書き換えられたら自動で読み直す | |
set noswapfile " スワップファイル作らない | |
set hidden " 編集中でも他のファイルを開けるようにする | |
set backspace=indent,eol,start " バックスペースでなんでも消せるように | |
set formatoptions=lmoq " | |
"テキスト整形オプション,マルチバイト系を追加 | |
set formatoptions-=ro " 改行時のコメントアウト自動継続を無効化 | |
set vb t_vb= " ビープをならさない | |
set browsedir=buffer " Exploreの初期ディレクトリ | |
set whichwrap=b,s,h,l,<,>,[,] " カーソルを行頭、行末で止まらないようにする | |
set showcmd " コマンドをステータス行に表示 | |
set showmode " 現在のモードを表示 | |
set viminfo='50,<1000,s100,\"50 " viminfoファイルの設定 | |
set modelines=0 " モードラインは無効 | |
set modifiable | |
set write | |
let mapleader = "," " キーマップリーダー | |
"set clipboard=unnamed,autoselect " OSのクリップボードを使用する | |
set clipboard=unnamed " OSのクリップボードを使用する | |
set clipboard-=autoselect " 選択しただけではコピーされないように設定 | |
set grepprg=internal | |
set completeopt=menuone,longest " 説明がでる?のを消す | |
set noundofile "バックアップファイルを生成しない | |
" ターミナルでマウスを使用できるようにする | |
"set mouse=a | |
"set guioptions+=a | |
"set ttymouse=xterm2 | |
imap {} {}<Left> | |
imap [] []<Left> | |
imap () ()<Left> | |
imap "" ""<Left> | |
imap '' ''<Left> | |
imap <> <><Left> | |
imap %% %%<Left> | |
"------------------------------------------------------------------------------- | |
" 表示 Apperance | |
"------------------------------------------------------------------------------- | |
set shortmess+=I " 起動時のメッセージを消す | |
set showmatch " 括弧の対応をハイライト | |
set number " 行番号表示 | |
set list " 不可視文字表示 | |
set listchars=tab:>.,trail:_,extends:>,precedes:< " 不可視文字の表示形式 | |
set display=uhex " 印字不可能文字を16進数で表示 | |
" 全角スペースの表示 | |
highlight ZenkakuSpace cterm=underline ctermfg=lightblue guibg=darkgray | |
match ZenkakuSpace / / | |
" カーソル行をハイライト | |
set cursorline | |
" カレントウィンドウにのみ罫線を引く | |
augroup cch | |
autocmd! cch | |
autocmd WinLeave * set nocursorline | |
autocmd WinEnter,BufRead * set cursorline | |
augroup END | |
au BufRead,BufNewFile,BufReadPre *.jade set filetype=pug | |
highlight CursorLine guibg=#262626 " カーソル行のカラーを設定 | |
highlight NonText guifg=#666666 " NonTextのカラーを設定 | |
highlight Pmenu guibg=#666666 " ポップアップメニューのカラーを設定 | |
highlight PmenuSel guibg=#8cd0d3 guifg=#666666 | |
highlight PmenuSbar guibg=#333333 | |
" コマンド実行中は再描画しない | |
set lazyredraw | |
" 高速ターミナル接続を行う | |
set ttyfast | |
set splitbelow " 横分割したら新しいウィンドウは下に | |
set splitright " 縦分割したら新しいウィンドウは右に | |
"------------------------------------------------------------------------------- | |
" 検索設定 Search | |
"------------------------------------------------------------------------------- | |
set wrapscan " 最後まで検索したら先頭へ戻る | |
set ignorecase " 大文字小文字無視 | |
set smartcase " 検索文字列に大文字が含まれている場合は区別して検索する | |
set incsearch " インクリメンタルサーチ | |
set hlsearch " 検索文字をハイライト | |
"Escの2回押しでハイライト消去 | |
nnoremap <ESC><ESC> :nohlsearch<CR> | |
"選択した文字列を検索 | |
"vnoremap <silent> // y/<C-R>=escape(@", '\\/.*$^~[]')<CR><CR> | |
"選択した文字列を置換 | |
"vnoremap /r "xy;%s/<C-R>=escape(@x, '\\/.*$^~[]')<CR>//gc<Left><Left><Left> | |
"s*置換後文字列/g<Cr>でカーソル下のキーワードを置換 | |
"nnoremap <expr> s* ':%substitute/\<' . expand('<cword>') . '\>/' | |
"------------------------------------------------------------------------------- | |
" 編集関連 Edit | |
"------------------------------------------------------------------------------- | |
" insertモードを抜けるとIMEオフ | |
set noimdisable | |
set iminsert=0 imsearch=0 | |
set noimcmdline | |
inoremap <silent> <ESC> <ESC>:set iminsert=0<CR> | |
" Tabキーを空白に変換 | |
" あとで直す | |
set expandtab | |
"set noexpandtab | |
" コンマの後に自動的にスペースを挿入 | |
"inoremap , ,<Space> | |
" インサートモード中に<C-o>でyankした内容をputする | |
" inoremap <C-o> <ESC>:<C-U>YRPaste 'p'<CR>i | |
" 保存時に行末の空白を除去する | |
" あとで直す | |
"autocmd BufWritePre * :%s/\s\+$//ge | |
" 保存時にtabをスペースに変換する | |
" あとで直す | |
"autocmd BufWritePre * :%s/\t/ /ge | |
"------------------------------------------------------------------------------- | |
" エンコーディング関連 Encoding | |
"------------------------------------------------------------------------------- | |
" 文字コード認識はbanyan/recognize_charcode.vimへ | |
set fileformats=unix,dos,mac " 改行文字 | |
"autocmd FileType svn :set fileencoding=utf-8 | |
"autocmd FileType js :set fileencoding=utf-8 | |
"autocmd FileType css :set fileencoding=utf-8 | |
"autocmd FileType html :set fileencoding=utf-8 | |
"autocmd FileType xml :set fileencoding=utf-8 | |
"autocmd FileType java :set fileencoding=utf-8 | |
"autocmd FileType php :set fileencoding=utf-8 | |
"autocmd FileType python :set fileencoding=utf-8 | |
" ワイルドカードで表示するときに優先度を低くする拡張子 | |
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc | |
" 指定文字コードで強制的にファイルを開く | |
command! Cp932 edit ++enc=cp932 | |
command! Eucjp edit ++enc=euc-jp | |
command! Iso2022jp edit ++enc=iso-2022-jp | |
command! Utf8 edit ++enc=utf-8 | |
command! Jis Iso2022jp | |
command! Sjis Cp932 | |
"------------------------------------------------------------------------------- | |
" 補完・履歴 Complete | |
"------------------------------------------------------------------------------- | |
set wildmenu " コマンド補完を強化 | |
set wildchar=<tab> " コマンド補完を開始するキー | |
set wildmode=list:full " リスト表示,最長マッチ | |
set history=1000 " コマンド・検索パターンの履歴数 | |
set complete+=k " 補完に辞書ファイル追加 | |
"Tags関連 | |
"source ~/dotfiles/.vimrc.tags | |
" "------------------------------------------------------------------------------- | |
" " ステータスライン StatusLine | |
" "------------------------------------------------------------------------------- | |
" set laststatus=2 " 常にステータスラインを表示 | |
" | |
" "カーソルが何行目の何列目に置かれているかを表示する | |
" set ruler | |
"------------------------------------ | |
" Align | |
"------------------------------------ | |
let g:Align_xstrlen = 3 " 日本語環境で使用するための設定 | |
let g:DrChipTopLvlMenu = '' | |
"------------------------------------ | |
" Srcexp | |
"------------------------------------ | |
" [Srcexpl] tagsを利用したソースコード閲覧・移動補助機能 | |
let g:SrcExpl_UpdateTags = 1 " tagsをsrcexpl起動時に自動で作成(更新) | |
let g:SrcExpl_RefreshTime = 0 " 自動表示するまでの時間(0:off) | |
let g:SrcExpl_WinHeight = 9 " プレビューウインドウの高さ | |
let g:SrcExpl_RefreshMapKey = "<Space>" " 手動表示のMAP | |
let g:SrcExpl_GoBackMapKey = "<C-b>" " 戻る機能のMAP | |
let g:ref_phpmanual_path = $HOME.'/dot_files/manual/php/php-chunked-xhtml' | |
nmap ,rp :<C-u>Ref phpmanual<Space> | |
let $PATH = $PATH . ':'.$HOME.'/dot_files/manual/ruby/' | |
nmap ,rr :<C-u>Ref refe<Space> | |
let g:ref_use_vimproc = 0 | |
" マルチバイト記号の文字数判定がうまくいかないため設定 | |
" autocmd BufWinEnter * set ambiwidth=single | |
set ambiwidth=double | |
" ウィンドウサイズを強制的に変更 | |
if has('gui_running') | |
autocmd BufWinEnter * set lines=60 columns=200 | |
endif | |
"" Ev/Rvでvimrcの編集と反映 | |
command! Ev edit $MYVIMRC | |
" command! Rv source $MYVIMRC | |
" " ファイルタイプ判定をon | |
filetype plugin on | |
filetype plugin indent on " required! | |
filetype indent on | |
syntax on | |
"カーソル形状設定 | |
let &t_ti.="\e[1 q" | |
let &t_SI.="\e[5 q" | |
let &t_EI.="\e[1 q" | |
let &t_te.="\e[0 q" | |
"------------------------------------ | |
" ハイライト | |
"------------------------------------ | |
"Coffee Script | |
let g:neocomplcache_enable_insert_char_pre = 1 | |
"autocomplete | |
set omnifunc=phpcomplete#CompletePHP | |
"------------------------------------------------------------------------------- | |
" 入力補完 | |
"------------------------------------------------------------------------------- | |
set completeopt=menuone | |
for k in split("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_",'\zs') | |
exec "imap <expr> " . k . " pumvisible() ? '" . k . "' : '" . k . "\<C-X>\<C-P>\<C-N>'" | |
endfor | |
" "------------------------------------------------------------------------------- | |
" " タブの設定 | |
" "------------------------------------------------------------------------------- | |
" " Anywhere SID. | |
" function! s:SID_PREFIX() | |
" return matchstr(expand('<sfile>'), '<SNR>\d\+_\zeSID_PREFIX$') | |
" endfunction | |
" | |
" " Set tabline. | |
" function! s:my_tabline() "{{{ | |
" let s = '' | |
" for i in range(1, tabpagenr('$')) | |
" let bufnrs = tabpagebuflist(i) | |
" let bufnr = bufnrs[tabpagewinnr(i) - 1] " first window, first appears | |
" let no = i " display 0-origin tabpagenr. | |
" let mod = getbufvar(bufnr, '&modified') ? '!' : ' ' | |
" let title = fnamemodify(bufname(bufnr), ':t') | |
" let title = '[' . title . ']' | |
" let s .= '%'.i.'T' | |
" let s .= '%#' . (i == tabpagenr() ? 'TabLineSel' : 'TabLine') . '#' | |
" let s .= no . ':' . title | |
" let s .= mod | |
" let s .= '%#TabLineFill# ' | |
" endfor | |
" let s .= '%#TabLineFill#%T%=%#TabLine#' | |
" return s | |
" endfunction "}}} | |
" let &tabline = '%!'. s:SID_PREFIX() . 'my_tabline()' | |
" " set showtabline=2 " 常にタブラインを表示 | |
" | |
" " The prefix key. | |
" " nnoremap [Tag] <Nop> | |
" " nmap t [Tag] | |
" " " Tab jump | |
" " for n in range(1, 9) | |
" " execute 'nnoremap <silent> [Tag]'.n ':<C-u>tabnext'.n.'<CR>' | |
" " endfor | |
" " " t1 で1番左のタブ、t2 で1番左から2番目のタブにジャンプ | |
" " | |
" " map <silent> [Tag]c :tablast <bar> tabnew<CR> | |
" " " tc 新しいタブを一番右に作る | |
" " map <silent> [Tag]x :tabclose<CR> | |
" " " tx タブを閉じる | |
" " map <silent> [Tag]n :tabnext<CR> | |
" " " tn 次のタブ | |
" " map <silent> [Tag]p :tabprevious<CR> | |
" " tp 前のタブ | |
" | |
" "open browserの設定 | |
" let g:netrw_nogx = 1 | |
" nmap gx <Plug>(openbrowser-smart-search) | |
" vmap gx <Plug>(openbrowser-smart-search) | |
" | |
" " インデントの視覚化 おもたすぎ | |
" " let g:indent_guides_enable_on_vim_startup = 1 | |
" " let g:indent_guides_auto_colors=0 | |
" " autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=232 | |
" " autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=235 | |
" " autocmd QuickFixCmdPost *grep* cwindow | |
" | |
" let g:indent_guides_guide_size=1 | |
" | |
" " easymotion | |
let g:EasyMotion_keys='hjklasdfgyuiopqwertnmzxcvbHJKLASDFGYUIOPQWERTNMZXCVB' | |
let g:EasyMotion_leader_key=";" | |
let g:EasyMotion_grouping=1 | |
hi EasyMotionTarget ctermbg=none ctermfg=red | |
hi EasyMotionShade ctermbg=none ctermfg=blue | |
"------------------------------------------------------------------------------- | |
" Powerlineの設定 | |
"------------------------------------------------------------------------------- | |
" vim-gitgutter | |
" let g:gitgutter_sign_added = '✚' | |
" let g:gitgutter_sign_modified = '➜' | |
" let g:gitgutter_sign_removed = '✘' | |
" lightline.vim | |
" let g:lightline = { | |
" \ 'colorscheme': 'landscape', | |
" \ 'mode_map': {'c': 'NORMAL'}, | |
" \ 'active': { | |
" \ 'left': [ | |
" \ ['mode', 'paste'], | |
" \ ['fugitive', 'gitgutter', 'filename'], | |
" \ ], | |
" \ 'right': [ | |
" \ ['lineinfo', 'syntastic'], | |
" \ ['percent'], | |
" \ ['charcode', 'fileformat', 'fileencoding', 'filetype'], | |
" \ ] | |
" \ }, | |
" \ 'component_function': { | |
" \ 'modified': 'MyModified', | |
" \ 'readonly': 'MyReadonly', | |
" \ 'fugitive': 'MyFugitive', | |
" \ 'filename': 'MyFilename', | |
" \ 'fileformat': 'MyFileformat', | |
" \ 'filetype': 'MyFiletype', | |
" \ 'fileencoding': 'MyFileencoding', | |
" \ 'mode': 'MyMode', | |
" \ 'syntastic': 'SyntasticStatuslineFlag', | |
" \ 'charcode': 'MyCharCode', | |
" \ 'gitgutter': 'MyGitGutter', | |
" \ }, | |
" \ 'separator': {'left': '>', 'right': '<'}, | |
" \ 'subseparator': {'left': '>', 'right': '<'} | |
" \ } | |
" | |
" function! MyModified() | |
" return &ft =~ 'help\|vimfiler\|gundo' ? '' : &modified ? '+' : &modifiable ? '' : '-' | |
" endfunction | |
" | |
" function! MyReadonly() | |
" return &ft !~? 'help\|vimfiler\|gundo' && &ro ? '<' : '' | |
" endfunction | |
" | |
" function! MyFilename() | |
" return ('' != MyReadonly() ? MyReadonly() . ' ' : '') . | |
" \ (&ft == 'vimfiler' ? vimfiler#get_status_string() : | |
" \ &ft == 'unite' ? unite#get_status_string() : | |
" \ &ft == 'vimshell' ? substitute(b:vimshell.current_dir,expand('~'),'~','') : | |
" \ '' != expand('%:t') ? expand('%:t') : '[No Name]') . | |
" \ ('' != MyModified() ? ' ' . MyModified() : '') | |
" endfunction | |
" | |
" function! MyFugitive() | |
" try | |
" if &ft !~? 'vimfiler\|gundo' && exists('*fugitive#head') | |
" let _ = fugitive#head() | |
" return strlen(_) ? '<'._ : '' | |
" endif | |
" catch | |
" endtry | |
" return '' | |
" endfunction | |
" | |
" function! MyFileformat() | |
" return winwidth('.') > 70 ? &fileformat : '' | |
" endfunction | |
" | |
" function! MyFiletype() | |
" return winwidth('.') > 70 ? (strlen(&filetype) ? &filetype : 'no ft') : '' | |
" endfunction | |
" | |
" function! MyFileencoding() | |
" return winwidth('.') > 70 ? (strlen(&fenc) ? &fenc : &enc) : '' | |
" endfunction | |
" | |
" function! MyMode() | |
" return winwidth('.') > 60 ? lightline#mode() : '' | |
" endfunction | |
" | |
" function! MyGitGutter() | |
" if ! exists('*GitGutterGetHunkSummary') | |
" \ || ! get(g:, 'gitgutter_enabled', 0) | |
" \ || winwidth('.') <= 90 | |
" return '' | |
" endif | |
" let symbols = [ | |
" \ g:gitgutter_sign_added . ' ', | |
" \ g:gitgutter_sign_modified . ' ', | |
" \ g:gitgutter_sign_removed . ' ' | |
" \ ] | |
" let hunks = GitGutterGetHunkSummary() | |
" let ret = [] | |
" for i in [0, 1, 2] | |
" if hunks[i] > 0 | |
" call add(ret, symbols[i] . hunks[i]) | |
" endif | |
" endfor | |
" return join(ret, ' ') | |
" endfunction | |
" | |
" " https://github.com/Lokaltog/vim-powerline/blob/develop/autoload/Powerline/Functions.vim | |
" function! MyCharCode() | |
" if winwidth('.') <= 70 | |
" return '' | |
" endif | |
" | |
" " Get the output of :ascii | |
" redir => ascii | |
" silent! ascii | |
" redir END | |
" | |
" if match(ascii, 'NUL') != -1 | |
" return 'NUL' | |
" endif | |
" | |
" " Zero pad hex values | |
" let nrformat = '0x%02x' | |
" | |
" let encoding = (&fenc == '' ? &enc : &fenc) | |
" | |
" if encoding == 'utf-8' | |
" " Zero pad with 4 zeroes in unicode files | |
" let nrformat = '0x%04x' | |
" endif | |
" | |
" " Get the character and the numeric value from the return value of :ascii | |
" " This matches the two first pieces of the return value, e.g. | |
" " "<F> 70" => char: 'F', nr: '70' | |
" let [str, char, nr; rest] = matchlist(ascii, '\v\<(.{-1,})\>\s*([0-9]+)') | |
" | |
" " Format the numeric value | |
" let nr = printf(nrformat, nr) | |
" | |
" return "'". char ."' ". nr | |
" endfunction | |
" | |
" | |
" | |
" insert modeで開始 | |
let g:unite_enable_start_insert = 1 | |
" 大文字小文字を区別しない | |
let g:unite_enable_ignore_case = 1 | |
let g:unite_enable_smart_case = 1 | |
" grep検索 | |
nnoremap <silent> ,g :<C-u>Unite grep:. -buffer-name=search-buffer<CR> | |
" カーソル位置の単語をgrep検索 | |
nnoremap <silent> ,cg :<C-u>Unite grep:. -buffer-name=search-buffer<CR><C-R><C-W> | |
" grep検索結果の再呼出 | |
nnoremap <silent> ,r :<C-u>UniteResume search-buffer<CR> | |
" unite grep に ag(The Silver Searcher) を使う | |
if executable('ag') | |
let g:unite_source_grep_command = 'ag' | |
let g:unite_source_grep_default_opts = '--nogroup --nocolor --column' | |
let g:unite_source_grep_recursive_opt = '' | |
endif | |
" ---------------------------------------------------------------- | |
" junegunn/vim-easy-align | |
" ---------------------------------------------------------------- | |
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>) | |
vmap <Enter> <Plug>(EasyAlign) | |
" Start interactive EasyAlign for a motion/text object (e.g. gaip) | |
nmap ga <Plug>(EasyAlign) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment