• * こまめなコミットがgitを便利に運用するコツ!ということでいつもどおりに git add -p

    c:\Users\xxxxxx\dotfiles> git add -p
    diff --git a/_vimrc b/_vimrc
    index 052197f..f6da577 100644
    --- a/_vimrc
    +++ b/_vimrc
    @@ -336,7 +336,44 @@ map ,tt <CR>:TweetVimSay<CR>
     " * flake8 {{{
     let g:flake8_ignore='E501,E221,E701,E203' " ignore line too long & multiple statements on one line
     " ------------------------ }}}
    +" * restart.vim {{{
    +command! RestartWithSession let g:restart_sessionoptions = 'blank,curdir,folds,help,localoptions,tabpages' | Restart
    +" ------------------------ }}}
     " * sources               "{{{
     source ~/.vim/vimrc_source/personal.vimrc
     " ------------------------ }}}
     
    +" * cursorline            "{{{
    +" via.http://d.hatena.ne.jp/thinca/20090530/1243615055
    +augroup vimrc-auto-cursorline
    +  autocmd!
    +  autocmd CursorMoved,CursorMovedI * call s:auto_cursorline('CursorMoved')
    +  autocmd CursorHold,CursorHoldI * call s:auto_cursorline('CursorHold')
    +  autocmd WinEnter * call s:auto_cursorline('WinEnter')
    +  autocmd WinLeave * call s:auto_cursorline('WinLeave')
    +
    +  let s:cursorline_lock = 0
    +  function! s:auto_cursorline(event)
    +    if a:event ==# 'WinEnter'
    +      setlocal cursorline
    +      let s:cursorline_lock = 2
    +    elseif a:event ==# 'WinLeave'
    +      setlocal nocursorline
    +    elseif a:event ==# 'CursorMoved'
    +      if s:cursorline_lock
    +        if 1 < s:cursorline_lock
    +          let s:cursorline_lock = 1
    +        else
    +          setlocal nocursorline
    +          let s:cursorline_lock = 0
    +        endif
    +      endif
    +    elseif a:event ==# 'CursorHold'
    +      setlocal cursorline
    +      let s:cursorline_lock = 1
    +    endif
    +  endfunction
    +augroup END
    +highlight CursorLine term=reverse cterm=reverse guibg=green
    +" ------------------------ }}}
    +
  • これはちょっと大きすぎる!まずは restart.vimに関するとこだけコミットしたいという時、 s を入力

    こんな感じで分割されます

    Stage this hunk [y,n,q,a,d,/,K,g,s,e,?]? s
    Split into 2 hunks.
    @@ -336,7 +336,10 @@
     " * flake8 {{{
     let g:flake8_ignore='E501,E221,E701,E203' " ignore line too long & multiple statements on one line
     " ------------------------ }}}
    +" * restart.vim {{{
    +command! RestartWithSession let g:restart_sessionoptions = 'blank,curdir,folds,help,localoptions,tabpages' | Restart
    +" ------------------------ }}}
     " * sources               "{{{
     source ~/.vim/vimrc_source/personal.vimrc
     " ------------------------ }}}
    Stage this hunk [y,n,q,a,d,/,K,j,J,g,e,?]? y
  • @@ -339,4 +342,38 @@
     " * sources               "{{{
     source ~/.vim/vimrc_source/personal.vimrc
     " ------------------------ }}}
    +" * cursorline            "{{{
    +" via.http://d.hatena.ne.jp/thinca/20090530/1243615055
    +augroup vimrc-auto-cursorline
    +  autocmd!
    +  autocmd CursorMoved,CursorMovedI * call s:auto_cursorline('CursorMoved')
    +  autocmd CursorHold,CursorHoldI * call s:auto_cursorline('CursorHold')
    +  autocmd WinEnter * call s:auto_cursorline('WinEnter')
    +  autocmd WinLeave * call s:auto_cursorline('WinLeave')
    +
    +  let s:cursorline_lock = 0
    +  function! s:auto_cursorline(event)
    +    if a:event ==# 'WinEnter'
    +      setlocal cursorline
    +      let s:cursorline_lock = 2
    +    elseif a:event ==# 'WinLeave'
    +      setlocal nocursorline
    +    elseif a:event ==# 'CursorMoved'
    +      if s:cursorline_lock
    +        if 1 < s:cursorline_lock
    +          let s:cursorline_lock = 1
    +        else
    +          setlocal nocursorline
    +          let s:cursorline_lock = 0
    +        endif
    +      endif
    +    elseif a:event ==# 'CursorHold'
    +      setlocal cursorline
    +      let s:cursorline_lock = 1
    +    endif
    +  endfunction
    +augroup END
    +highlight CursorLine term=reverse cterm=reverse guibg=green
    +" ------------------------ }}}
    +
    Stage this hunk [y,n,q,a,d,/,K,g,e,?]? n
    c:\Users\xxxxxx\dotfiles>git diff --cached
    diff --git a/_vimrc b/_vimrc
    index 052197f..55359be 100644
    --- a/_vimrc
    +++ b/_vimrc
    @@ -336,6 +336,9 @@ map ,tt <CR>:TweetVimSay<CR>
     " * flake8 {{{
     let g:flake8_ignore='E501,E221,E701,E203' " ignore line too long & multiple sta " ------------------------ }}}
    +" * restart.vim {{{
    +command! RestartWithSession let g:restart_sessionoptions = 'blank,curdir,folds,+" ------------------------ }}}
     " * sources               "{{{
     source ~/.vim/vimrc_source/personal.vimrc
     " ------------------------ }}}
Pocket

Comments are closed.