mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 15:19:12 +08:00
fix(util): fix SPC f Y
key binding
This commit is contained in:
parent
be502f95d4
commit
d061ce7f46
@ -321,7 +321,9 @@ function! SpaceVim#layers#core#config() abort
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['b', 't'], 'exe "Defx -no-toggle " . fnameescape(expand("%:p:h"))', 'show-file-tree-at-buffer-dir', 1)
|
||||
endif
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'y'], 'call SpaceVim#util#CopyToClipboard()', 'show-and-copy-buffer-filename', 1)
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'Y'], 'call SpaceVim#util#CopyToClipboard(1)', 'show-and-copy-buffer-filename', 1)
|
||||
nnoremap <silent> <Plug>YankGitRemoteURL :call SpaceVim#util#CopyToClipboard(2)<Cr>
|
||||
vnoremap <silent> <Plug>YankGitRemoteURL :<C-u>call SpaceVim#util#CopyToClipboard(3)<Cr>
|
||||
call SpaceVim#mapping#space#def('nmap', ['f', 'Y'], '<Plug>YankGitRemoteURL', 'yank-remote-url', 0, 1)
|
||||
let g:_spacevim_mappings_space.f.v = {'name' : '+Vim/SpaceVim'}
|
||||
call SpaceVim#mapping#space#def('nnoremap', ['f', 'v', 'v'], 'let @+=g:spacevim_version | echo g:spacevim_version', 'display-and-copy-version', 1)
|
||||
let lnum = expand('<slnum>') + s:lnum - 1
|
||||
|
@ -140,11 +140,11 @@ fu! s:findDirInParent(what, where) abort " {{{2
|
||||
endf " }}}2
|
||||
fu! SpaceVim#util#CopyToClipboard(...) abort
|
||||
if a:0
|
||||
if executable('git') && executable('grep')
|
||||
if executable('git')
|
||||
let find_path = s:FILE.finddir('.git/', expand('%:p'), -1)
|
||||
let repo_home = s:FILE.unify_path(find_path, ':h:h')
|
||||
if repo_home !=# '' && isdirectory(repo_home)
|
||||
let [remote_name, branch] = split(split(systemlist('git -C '. repo_home. ' branch -vv | grep "^*"')[0],'')[3], '/')
|
||||
let [remote_name, branch] = split(split(filter(systemlist('git -C '. repo_home. ' branch -vv'), 'v:val =~# "^\*"')[0],'')[3], '/')
|
||||
let remotes = filter(systemlist('git -C '. repo_home. ' remote -v'),"match(v:val,'^' . remote_name[1:-2]) >= 0 && match(v:val,'fetch') > 0")
|
||||
if len(remotes) > 0
|
||||
let remote = remotes[0]
|
||||
@ -181,7 +181,7 @@ fu! SpaceVim#util#CopyToClipboard(...) abort
|
||||
echohl WarningMsg | echom 'This file is not in a git repo' | echohl None
|
||||
endif
|
||||
else
|
||||
echohl WarningMsg | echom 'You need to install git and grep!' | echohl None
|
||||
echohl WarningMsg | echom 'You need to install git!' | echohl None
|
||||
endif
|
||||
else
|
||||
try
|
||||
|
Loading…
x
Reference in New Issue
Block a user