本日の更新(2017/05/06)
おはいおございます。大寝坊orz
— Yohichi Date (@Yohichi_Date) 2017年5月6日
昨晩は中々眠れず25時半前の就寝。ゾルピデム*1を10mgとエバミール服用。
今朝は案の定大寝坊の10時半前起床orz
午後になってUbuntuマシンを持って外出。
昨日買った入門 Python 3を見ながらポチポチ触る。
久々にコードを書く*2と楽しい。
あとは長いこと懸案だったVimのパッケージ管理をNeoBundle.vimからdein.vimへ変更。一部仕様がわからなくてあまりスマートな書き方が出来ない部分があったけど、とりあえず動く状態にはなる。
以下(出来のよろしくない).vimrc
" ######################################## " Yohichi Date's vimrc " " update:2017/05/06 " ######################################## " unset vi compatible mode (set vim mode) if &compatible set nocompatible endif " Character Code & Line Feed Code set encoding=utf-8 " vim encoding setting scriptencoding utf-8 " Vim script file encoding setting set fileencodings=ucs-bom,iso-2022-jp-3,iso-2022-jp,eucjp-ms,euc-jisx0213,euc-jp,sjis,cp932,utf-8 " File encoding setting(reference: http://itcweb.cc.affrc.go.jp/affrit/faq/tips/vim-enc) set fileformats=unix,dos,mac " File line feed setting " ======================================== " dein.vim & plugin " reference: http://qiita.com/yoza/items/2f8bd33a18225754f346 " ======================================== " Shougo/dein.vim set runtimepath+=~/.vim/dein/repos/github.com/Shougo/dein.vim call dein#begin(expand('~/.vim/dein')) " Shougo/vimproc call dein#add('Shougo/vimproc.vim', {'build' : 'make'}) " Shougo/neocomplete & Shougo/neocomplcache if has('lua') call dein#add('Shougo/neocomplete') " neocomplete settings let g:acp_enableAtStartup = 0 " DISABLE Autocomplpop let g:neocomplete#enable_at_startup = 1 " USE neocomplete let g:neocomplete#enable_smart_case = 1 " USE smartcase let g:neocomplete#sources#syntax#min_keyword_length = 3 " SET minimum syntax keyword length let g:neocomplete#lock_buffer_name_pattern = '\*ku\*' " Define dictionary let g:neocomplete#sources#dictionary#dictionaries = { \ 'default' : '', \ 'vimshell' : $HOME.'.vimshell_hist', \ 'scheme' : $HOME.'/.gosh_completions' \ } " Define keyword if !exists('g:neocomplete#keyword_patterns') let g:neocomplete#keyword_patterns ={} endif " Plugin key-mappings inoremap <expr><C-g> neocomplete#undo_completion() inoremap <expr><C-l> neocomplete#complete_common_string() " Key-mappings " <CR>: close popup and save indent inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> function! s:my_cr_function() return neocomplete#close_popup() . "\<CR>" " For no inserting <CR> key " return pumvisible() ? neocomplete#close_popup() * "\<CR>" endfunction " <TAB>: completion inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" " <C-h>, <BS>: close popup and delete backword char inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>" inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>" inoremap <expr><C-y> neocomplete#close_popup() inoremap <expr><C-e> neocomplete#cancel_popup() " Close popup by <Space>. " inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>" " ENABLE omni completion autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS autocmd FileType python setlocal omnifunc=pythoncomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags " Enable heavy omni completion. if !exists('g:neocomplete#sources#omni#input_patterns') let g:neocomplete#sources#omni#imput_patterns = {} endif else call dein#add('Shougo/neocomplcache') " neocomplcache settings let g:acp_enableAtStartup = 0 " Disable AutoComplPop. let g:neocomplcache_enable_at_startup = 1 " Use neocomplcache. let g:neocomplcache_enable_smart_case = 1 " Use smartcase. let g:neocomplcache_min_syntax_length = 3 " Set minimum syntax keyword length. let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*' " Define dictionary. let g:neocomplcache_dictionary_filetype_lists = { \ 'default' : '' \ } " Plugin key-mappings. inoremap <expr><C-g> neocomplcache#undo_completion() inoremap <expr><C-l> neocomplcache#complete_common_string() " Recommended key-mappings. " <CR>: close popup and save indent. inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR> function! s:my_cr_function() return neocomplcache#smart_close_popup() . "\<CR>" endfunction " <TAB>: completion. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" " <C-h>, <BS>: close popup and delete backword char. inoremap <expr><C-h> neocomplcache#smart_close_popup()."\<C-h>" inoremap <expr><BS> neocomplcache#smart_close_popup()."\<C-h>" inoremap <expr><C-y> neocomplcache#close_popup() inoremap <expr><C-e> neocomplcache#cancel_popup() endif " Shougo/neosnippet call dein#add('Shougo/neosnippet') call dein#add('Shougo/neosnippet-snippets') " Shougo/unite.vim call dein#add('Shougo/unite.vim') " mattn/webapi-vim call dein#add('mattn/webapi-vim') "ctrlpvim/ctrlp.vim" call dein#add('ctrlpvim/ctrlp.vim') " thinca/vim-quickrun" call dein#add('thinca/vim-quickrun') " tomtom/tcomment_vim call dein#add('tomtom/tcomment_vim') " nathanaelkane/vim-indent-guides call dein#add('nathanaelkane/vim-indent-guides') " haya14busa/incsearch.vim call dein#add('haya14busa/incsearch.vim') " davidhalter/jedi-vim " reference: http://myenigma.hatenablog.com/entry/2015/12/28/091342 call dein#add('davidhalter/jedi-vim') " scrooloose/syntastic " reference: http://ton-up.net/technote/2013/11/26/vim-python-style-check-and-fix/ call dein#add('scrooloose/syntastic') let g:syntastic_python_checkers = ['pyflakes', 'pep8'] call dein#end() filetype plugin indent on " TO ENABLE the file type plugin / indent & detection of file type, including the plugin that has been read " ======================================== " Edit " ======================================== " Undo contine, before quit or reload Vim contine(7.3) if version >= 703 " Persistent undo & Save Undo Data set undofile "ENABLE Persistent undo(7.3) set undodir=~/.vimbackup "Save Undo Data(7.3) endif set clipboard+=unnamed " Share Clipboard from GUI Copy Text. set nrformats-=octal " DISABLE octal. <C-a> & <C-x> (incremental & decrement) is affected. set timeoutlen=3500 " Time to wait for the completion of the key code and mapped key sequence set hidden " It is NOT issued a warning when you open a new buffer from the buffer that does not save your edits set history=50 " The number of saved history set formatoptions+=mM " DO NOT enter a space when you connect the line of Japanese set virtualedit=block " ENABLE free cursor when Visual block mode set autoindent set backspace=start,eol,indent set whichwrap=b,s,[,],<,>,~ set mouse= set nowritebackup " DISABLE backup before UPDATE. set nobackup " DISABLE make backup files. And DELETE writebackup after success update. set noswapfile " DISABLE make swap files. set ambiwidth=double " To make sure 2bytes character. " ======================================== " KeyMap " ======================================== nmap <silent> <Tab> 15<Right> vmap <silent> <Tab> <C-o>15<Right> nmap <silent> <S-Tab> 15<Left> vmap <silent> <S-Tab> <C-o>15<Left> nmap <silent> <C-n> :update<CR>:bnext<CR> imap <silent> <C-n> <ESC>:update<CR>:bnext<CR> vmap <silent> <C-n> <ESC>:update<CR>:bnext<CR> cmap <silent> <C-n> <ESC>:update<CR>:bnext<CR> nnoremap Y y$ " ======================================== " Display " ======================================== set number " To display line number. """"""""""""""""""""""" " バックグラウンドが黒のときの色設定 """"""""""""""""""""""" highlight StatusLine ctermfg=black ctermbg=gray highlight CursorLine ctermfg=none ctermbg=darkgray cterm=none highlight MatchParen ctermfg=none ctermbg=darkgray highlight Comment ctermfg=DarkGreen ctermbg=NONE highlight Directory ctermfg=DarkGreen ctermbg=NONE set shortmess+=I " DISABLE splash(shortmessage) "エラー時の音とビジュアルベルの抑制(gvimは.gvimrcで設定) set noerrorbells set novisualbell set visualbell t_vb= "マクロ実行中などの画面再描画を行わない set lazyredraw "Windowsでディレクトリパスの区切り文字表示に / を使えるようにする set shellslash "括弧の対応表示時間 set showmatch matchtime=1 "タブを設定 set ts=4 sw=4 sts=4 "Cインデントの設定 set cinoptions+=:0 "タイトルを表示 set title "コマンドラインの高さ (gvimはgvimrcで指定) set cmdheight=2 set laststatus=2 "コマンドをステータス行に表示 set showcmd "画面最後の行をできる限り表示する set display=lastline "Tab、Space、行末の半角スペースを明示的に表示する set list set listchars=tab:>.,trail:_,extends:>,precedes:<,nbsp:% set display+=lastline """""""""""""""""""""""""""""" "ステータスラインに文字コードやBOM、16進表示等表示 "iconvが使用可能の場合、カーソル上の文字コードをエンコードに応じた表示にするFencB()を使用 "// TODO:reference書く """""""""""""""""""""""""""""" if has('iconv') set statusline=%<%F\ %m\ %r%h%w%{'['.(&fenc!=''?&fenc:&enc).(&bomb?':BOM':'').']['.&ff.']'}%=[0x%{FencB()}]\ (%v,%l)/%L%8P\_ else set statusline=%<%F\ %m\ %r%h%w%{'['.(&fenc!=''?&fenc:&enc).(&bomb?':BOM':'').']['.&ff.']'}%=\ (%v,%l)/%L%8P\_ endif function! FencB() let c = matchstr(getline('.'), '.', col('.') - 1) let c = iconv(c, &enc, &fenc) return s:Byte2hex(s:Str2byte(c)) endfunction function! s:Str2byte(str) return map(range(len(a:str)), 'char2nr(a:str[v:val])') endfunction function! s:Byte2hex(bytes) return join(map(copy(a:bytes), 'printf("%02X", v:val)'), '') endfunction set wildmenu wildmode=list:full " ハイライトを有効にする if &t_Co > 2 || has('gui_running') syntax on endif "色テーマ設定 "gvimの色テーマは.gvimrcで指定する syntax on let g:molokai_original = 1 let g:rehash256 = 1 set background=dark colorscheme molokai """""""""""""""""""""""""""""" "全角スペースを表示 " TODO: reference:書く """""""""""""""""""""""""""""" " デフォルトのZenkakuSpaceを定義 function! ZenkakuSpace() highlight ZenkakuSpace cterm=reverse ctermfg=darkMagenta gui=reverse guifg=darkMagenta endfunction if has('syntax') augroup ZenkakuSpace autocmd! " ZenkakuSpaceをカラーファイルで設定するなら次の行は削除 autocmd ColorScheme * call ZenkakuSpace() " 全角スペースのハイライト指定 autocmd VimEnter,WinEnter * match ZenkakuSpace / / augroup END call ZenkakuSpace() endif """""""""""""""""""""""""""""" "挿入モード時、ステータスラインの色を変更 "TODO:reference書く """""""""""""""""""""""""""""" let g:hi_insert = 'highlight StatusLine guifg=darkblue guibg=darkyellow gui=none ctermfg=blue ctermbg=yellow cterm=none' if has('syntax') augroup InsertHook autocmd! autocmd InsertEnter * call s:StatusLine('Enter') autocmd InsertLeave * call s:StatusLine('Leave') augroup END endif if has('unix') && !has('gui_running') " ESCでキー入力待ちになる対策 inoremap <silent> <ESC> <ESC> 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 silent exec s:slhlcmd redraw 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 " ======================================== " Search " ======================================== " 検索時にハイライトを解除する set nohlsearch "検索の時に大文字小文字を区別しない "ただし大文字小文字の両方が含まれている場合は大文字小文字を区別する set ignorecase set smartcase "検索時にファイルの最後まで行ったら最初に戻る set wrapscan "インクリメンタルサーチ set incsearch "検索文字の強調表示 set hlsearch "w,bの移動で認識する文字 set iskeyword=a-z,A-Z,48-57,_,.,-,> "vimgrep をデフォルトのgrepとする場合internal "set grepprg=internal " ======================================== " Plugin Settings " ======================================== " ---------------------------------------- " neosnippet " ---------------------------------------- " Plugin key-mappings. imap <C-k> <Plug>(neosnippet_expand_or_jump) smap <C-k> <Plug>(neosnippet_expand_or_jump) xmap <C-k> <Plug>(neosnippet_expand_target) " SuperTab like snippets behavior. imap <expr><TAB> neosnippet#expandable_or_jumpable() ? \ "\<Plug>(neosnippet_expand_or_jump)" \: pumvisible() ? "\<C-n>" : "\<TAB>" smap <expr><TAB> neosnippet#expandable_or_jumpable() ? \ "\<Plug>(neosnippet_expand_or_jump)" \: "\<TAB>" " For snippet_complete marker. if has('conceal') set conceallevel=2 concealcursor=i endif " ---------------------------------------- " unite " ---------------------------------------- " STARTING at INSERT MODE " let g:unite_enable_start_insert=1 " バッファ一覧 nnoremap <silent> ,ub :<C-u>Unite buffer<CR> " ファイル一覧 nnoremap <silent> ,uf :<C-u>UniteWithBufferDir -buffer-name=files file<CR> " レジスタ一覧 nnoremap <silent> ,ur :<C-u>Unite -buffer-name=register register<CR> " 最近使用したファイル一覧 nnoremap <silent> ,um :<C-u>Unite file_mru<CR> " 常用セット nnoremap <silent> ,uu :<C-u>Unite buffer file_mru<CR> " 全部乗せ nnoremap <silent> ,ua :<C-u>UniteWithBufferDir -buffer-name=files buffer file_mru bookmark file<CR> " ウィンドウを分割して開く au FileType unite nnoremap <silent> <buffer> <expr> <C-j> unite#do_action('split') au FileType unite inoremap <silent> <buffer> <expr> <C-j> unite#do_action('split') " ウィンドウを縦に分割して開く au FileType unite nnoremap <silent> <buffer> <expr> <C-l> unite#do_action('vsplit') au FileType unite inoremap <silent> <buffer> <expr> <C-l> unite#do_action('vsplit') " ESCキーを2回押すと終了する au FileType unite nnoremap <silent> <buffer> <ESC><ESC> q au FileType unite inoremap <silent> <buffer> <ESC><ESC> <ESC>q " ---------------------------------------- " ctrlp " ---------------------------------------- " Prefix: s nnoremap s <Nop> nnoremap sa :<C-u>CtrlP<Space> nnoremap sb :<C-u>CtrlPBuffer<CR> nnoremap sd :<C-u>CtrlPDir<CR> nnoremap sf :<C-u>CtrlP<CR> nnoremap sl :<C-u>CtrlPLine<CR> nnoremap sm :<C-u>CtrlPMRUFiles<CR> nnoremap sq :<C-u>CtrlPQuickfix<CR> nnoremap ss :<C-u>CtrlPMixed<CR> nnoremap st :<C-u>CtrlPTag<CR> let g:ctrlp_map = '<Nop>' " Guess vcs root dir let g:ctrlp_working_path_mode = 'ra' " Open new file in current window let g:ctrlp_open_new_file = 'r' " let g:ctrlp_extensions = ['tag', 'quickfix', 'dir', 'line', 'mixed'] let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:18' " ---------------------------------------- " vim-indent-guides " ---------------------------------------- let g:indent_guides_enable_on_vim_startup = 1 " ---------------------------------------- " incsearch.vim " ---------------------------------------- map / <Plug>(incsearch-forward) map ? <Plug>(incsearch-backward) map g/ <Plug>(incsearch-stay)
ちなみに電源コードは持っていかずバッテリのみ運用だったけども、実質2時間強フルにPCを使ってどうにかバッテリーが保ったので、まあ数年落ちウルトラブックとしては許容範囲かな。