在使用NeoVim时,我遇到了:Gpush命令锁定编辑器的问题。有谁有解决这个问题的办法吗?
发布于 2018-02-18 14:53:47
我理解你的问题是,当你推送到github时,你需要从你的shell中手动输入用户名/密码。我不认为GPush在设计时就考虑到这一点。这可能解决了你的问题
:te git push您可能会在屏幕上看到一个终端窗口,要求输入用户名/密码。您需要输入i才能在终端上进入插入模式,这样就可以了。
发布于 2018-02-12 17:30:22
逃犯的推送将在nvim上同步工作。从逃犯帮助文件中
*fugitive-:Gpush*
:Gpush [args] Invoke git-push, load the results into the |quickfix|
list, and invoke |:cwindow| to reveal any errors.
|:Dispatch| is used if available for asynchronous
invocation.问题是nvim上没有分派函数。你可以跑
!git push &但这将阻止您看到命令的输出(这是不好的,因为:如果fit推送失败了怎么办?)
这是一个为我解决的逃犯GPush的替换函数,可能对你也有用(把它放在你的init.vim中)。它利用nvim的异步作业控制:h job-control,并在预览窗口:h preview-window中显示输出
function! s:shell_cmd_completed(...) dict
wincmd P
setlocal modifiable
call append(line('$'), self.shell)
call append(line('$'), '########################FINISHED########################')
call append(line('$'), self.pid)
call jobstop(self.pid)
normal! G
setlocal nomodifiable
wincmd p
endfunction
function! s:JobHandler(job_id, data, event) dict
let str = join(a:data)
wincmd P
call append(line('$'), str)
normal! G
wincmd p
endfunction
function! GitPush()
let s:shell_tmp_output = tempname()
execute 'pedit '.s:shell_tmp_output
wincmd P
wincmd J
setlocal modifiable
setlocal nobuflisted
nnoremap <buffer>q :bd<cr>
wincmd p
let s:callbacks = {
\ 'on_stdout': function('s:JobHandler'),
\ 'on_stderr': function('s:JobHandler'),
\ 'on_exit': function('s:shell_cmd_completed'),
\ 'shell': 'git push'
\ }
let pid = jobstart('git push', s:callbacks)
let s:callbacks.pid = pid
endfunction
command! GitPush call GitPush()https://stackoverflow.com/questions/48709262
复制相似问题