如何使用vim作为"git log"编辑器? [英] How do I use vim as 'git log' editor?

查看:263
本文介绍了如何使用vim作为"git log"编辑器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行git log时,git log使用的编辑器到底是什么?

When I run git log, what exactly is the editor git log is using?

也:

  1. 反正我可以使用vim作为git log的默认编辑器吗?
  2. 如果我要搜索git日志,最好的方法是什么?现在,我正在执行以下操作:git log | grep bla.
  1. Is there anyway I can use vim as my default editor for git log?
  2. If I want to search against the git log, what's the best way? Now I'm doing something like: git log | grep bla.

推荐答案

默认情况下,git log命令将其输出通过管道传递到 pager ,而不是编辑器.在大多数系统上,此寻呼机通常为lessmore.您可以使用以下命令将默认的寻呼机更改为vim:

The git log command pipes it's output by default into a pager, not an editor. This pager is usually less or more on most systems. You can change the default pager to vim with the command:

git config --global core.pager 'vim -'

现在,您可以像往常一样使用vim功能和/进行搜索了.

Now you can search using vim functionality with / as usual.

这篇关于如何使用vim作为"git log"编辑器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆