快速浏览DiffOrig,然后切换回 [英] Taking a quick look at DiffOrig, then switching back
本文介绍了快速浏览DiffOrig,然后切换回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从文档中发现了一个很棒的命令:
I've discovered this great command from the documentation:
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
所以我想出了这一点:
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis | wincmd p
map <Leader>do :DiffOrig<cr>
map <leader>dc :q<cr>:diffoff!<cr>
问题是,当我遇到 \dc
,它将跳回到文件的开头,而不是我在发出 \do
之前离开文件的位置。
The problem is, when I se \dc
, it will jump back to the beginning of the file, not where I left it prior to issuing \do
. How to fix this?
请自己尝试一下,看看有什么问题以及如何解决。并告诉我如何解决它们:-)
Please try this yourself, see what the problems are and how to fix them. And tell me how to fix them too :-)
推荐答案
您可以尝试:
command DiffOrig let g:diffline = line('.') | vert new | set bt=nofile | r # | 0d_ | diffthis | :exe "norm! ".g:diffline."G" | wincmd p | diffthis | wincmd p
nnoremap <Leader>do :DiffOrig<cr>
nnoremap <leader>dc :q<cr>:diffoff<cr>:exe "norm! ".g:diffline."G"<cr>
这篇关于快速浏览DiffOrig,然后切换回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文