Map - to go up a directory
This commit is contained in:
parent
48daf7ae72
commit
9619055cfd
@ -235,6 +235,9 @@ o Jump to the revision under the cursor in a new split.
|
|||||||
*fugitive-O*
|
*fugitive-O*
|
||||||
O Jump to the revision under the cursor in a new tab.
|
O Jump to the revision under the cursor in a new tab.
|
||||||
|
|
||||||
|
*fugitive--*
|
||||||
|
- Go to the tree containing the current tree or blob.
|
||||||
|
|
||||||
*fugitive-~*
|
*fugitive-~*
|
||||||
~ Go to the current file in the [count]th first
|
~ Go to the current file in the [count]th first
|
||||||
ancestor.
|
ancestor.
|
||||||
|
@ -537,7 +537,31 @@ function! s:buffer_containing_commit() dict abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call s:add_methods('buffer',['getvar','setvar','getline','repo','type','spec','name','commit','path','rev','sha1','expand','containing_commit'])
|
function! s:buffer_up(...) dict abort
|
||||||
|
let rev = self.rev()
|
||||||
|
let c = a:0 ? a:1 : 1
|
||||||
|
while c
|
||||||
|
if rev =~# '^[/:]$'
|
||||||
|
let rev = 'HEAD'
|
||||||
|
elseif rev =~# '^:'
|
||||||
|
let rev = ':'
|
||||||
|
elseif rev =~# '^[^^~:]\+$'
|
||||||
|
let rev .= '^{}'
|
||||||
|
elseif rev =~# '^/\|:.*/'
|
||||||
|
let rev = s:sub(rev, '.*\zs/.*', '')
|
||||||
|
elseif rev =~# ':.'
|
||||||
|
let rev = matchstr(rev, '^[^:]*:')
|
||||||
|
elseif rev =~# ':$'
|
||||||
|
let rev = rev[0:-2]
|
||||||
|
else
|
||||||
|
return rev.'~'.c
|
||||||
|
endif
|
||||||
|
let c -= 1
|
||||||
|
endwhile
|
||||||
|
return rev
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call s:add_methods('buffer',['getvar','setvar','getline','repo','type','spec','name','commit','path','rev','sha1','expand','containing_commit','up'])
|
||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
" Git {{{1
|
" Git {{{1
|
||||||
@ -2149,6 +2173,7 @@ function! s:JumpInit() abort
|
|||||||
if !&modifiable
|
if !&modifiable
|
||||||
nnoremap <buffer> <silent> o :<C-U>exe <SID>GF("split")<CR>
|
nnoremap <buffer> <silent> o :<C-U>exe <SID>GF("split")<CR>
|
||||||
nnoremap <buffer> <silent> O :<C-U>exe <SID>GF("tabedit")<CR>
|
nnoremap <buffer> <silent> O :<C-U>exe <SID>GF("tabedit")<CR>
|
||||||
|
nnoremap <buffer> <silent> - :<C-U>exe <SID>Edit('edit',0,<SID>buffer().up(v:count1))<CR>
|
||||||
nnoremap <buffer> <silent> P :<C-U>exe <SID>Edit('edit',0,<SID>buffer().commit().'^'.v:count1.<SID>buffer().path(':'))<CR>
|
nnoremap <buffer> <silent> P :<C-U>exe <SID>Edit('edit',0,<SID>buffer().commit().'^'.v:count1.<SID>buffer().path(':'))<CR>
|
||||||
nnoremap <buffer> <silent> ~ :<C-U>exe <SID>Edit('edit',0,<SID>buffer().commit().'~'.v:count1.<SID>buffer().path(':'))<CR>
|
nnoremap <buffer> <silent> ~ :<C-U>exe <SID>Edit('edit',0,<SID>buffer().commit().'~'.v:count1.<SID>buffer().path(':'))<CR>
|
||||||
nnoremap <buffer> <silent> C :<C-U>exe <SID>Edit('edit',0,<SID>buffer().containing_commit())<CR>
|
nnoremap <buffer> <silent> C :<C-U>exe <SID>Edit('edit',0,<SID>buffer().containing_commit())<CR>
|
||||||
|
Loading…
Reference in New Issue
Block a user