Skip to content

Commit

Permalink
Merge pull request #42 from jreybert/next
Browse files Browse the repository at this point in the history
1.4.3
  • Loading branch information
jreybert committed Nov 13, 2015
2 parents 19de192 + e1d637b commit 795e280
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ Following mappings are set locally, for magit buffer only, in normal mode.
* If not in commit section, set commit mode to "New commit" and show "Commit message" section with brand new commit message.
* If in commit section, commit the all staged changes in commit mode previously set.

##### :w<cr>
* If in commit section, commit the all staged changes in commit mode previously set.

##### CA
* If not in commit section, set commit mode to "Amend commit" and show "Commit message" section with previous commit message.
* If in commit section, commit the staged changes in commit mode previously set.
Expand Down
10 changes: 10 additions & 0 deletions autoload/magit/utils.vim
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,13 @@ endfunction
function! magit#utils#bufnr()
return s:bufnr
endfunction

function! magit#utils#start_profile(...)
let prof_file = ( a:0 == 1 ) ? a:1 : "/tmp/vimagit.log"
execute "profile start " . prof_file . " | profile pause"
profile! file */plugin/magit.vim
profile! file */autoload/magit/*
profile! file */common/magit_common.vim
profile! file */syntax/magit.vim
profile continue
endfunction
5 changes: 0 additions & 5 deletions doc/vimagit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,6 @@ Following mappings are set locally, for magit buffer only, in normal mode.
CC If not in commit section, set commit mode to "New commit" and show
"Commit message" section with brand new commit message.
If in commit section, commit the all staged changes in commit mode
previously set.

*vimagit-:w<CR>*
*vimagit-g:magit_commit_mapping_command*
:w<CR> If in commit section, commit the all staged changes in commit mode
previously set.

*vimagit-CA* *magit#commit_command('CA')*
Expand Down
18 changes: 14 additions & 4 deletions plugin/magit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ let g:magit_stage_hunk_mapping = get(g:, 'magit_stage_hunk_mapping',
let g:magit_stage_line_mapping = get(g:, 'magit_stage_line_mapping', 'L' )
let g:magit_mark_line_mapping = get(g:, 'magit_mark_line_mapping', 'M' )
let g:magit_discard_hunk_mapping = get(g:, 'magit_discard_hunk_mapping', 'DDD' )
let g:magit_commit_mapping_command = get(g:, 'magit_commit_mapping_command', 'w<cr>' )
let g:magit_commit_mapping = get(g:, 'magit_commit_mapping', 'CC' )
let g:magit_commit_amend_mapping = get(g:, 'magit_commit_amend_mapping', 'CA' )
let g:magit_commit_fixup_mapping = get(g:, 'magit_commit_fixup_mapping', 'CF' )
Expand Down Expand Up @@ -588,7 +587,7 @@ function! magit#show_magit(display, ...)
elseif ( a:display == 'h' )
new
elseif ( a:display == 'c' )
"nothing, use current buffer
enew
else
throw 'parameter_error'
endif
Expand Down Expand Up @@ -624,12 +623,11 @@ function! magit#show_magit(display, ...)
execute "nnoremap <buffer> <silent> " . g:magit_stage_hunk_mapping . " :call magit#stage_hunk(0)<cr>"
execute "nnoremap <buffer> <silent> " . g:magit_discard_hunk_mapping . " :call magit#stage_hunk(1)<cr>"
execute "nnoremap <buffer> <silent> " . g:magit_reload_mapping . " :call magit#update_buffer()<cr>"
execute "cnoremap <buffer> <silent> " . g:magit_commit_mapping_command." :call magit#commit_command('CC')<cr>"
execute "nnoremap <buffer> <silent> " . g:magit_commit_mapping . " :call magit#commit_command('CC')<cr>"
execute "nnoremap <buffer> <silent> " . g:magit_commit_amend_mapping . " :call magit#commit_command('CA')<cr>"
execute "nnoremap <buffer> <silent> " . g:magit_commit_fixup_mapping . " :call magit#commit_command('CF')<cr>"
execute "nnoremap <buffer> <silent> " . g:magit_ignore_mapping . " :call magit#ignore_file()<cr>"
execute "nnoremap <buffer> <silent> " . g:magit_close_mapping . " :close<cr>"
execute "nnoremap <buffer> <silent> " . g:magit_close_mapping . " :call magit#close_magit()<cr>"
execute "nnoremap <buffer> <silent> " . g:magit_toggle_help_mapping . " :call magit#toggle_help()<cr>"

execute "nnoremap <buffer> <silent> " . g:magit_stage_line_mapping . " :call magit#stage_vselect()<cr>"
Expand All @@ -654,6 +652,18 @@ function! magit#show_magit(display, ...)
execute "normal! gg"
endfunction

function! magit#close_magit()
try
close
catch /^Vim\%((\a\+)\)\=:E444/
try
edit #
catch /^Vim\%((\a\+)\)\=:E\%(194\|499\)/
quit
endtry
endtry
endfunction

function! s:mg_stage_closed_file(discard)
if ( getline(".") =~ g:magit_file_re )
let list = matchlist(getline("."), g:magit_file_re)
Expand Down

0 comments on commit 795e280

Please sign in to comment.