VIM Fugitive
。这款插件可以实现你在 Vim 编辑器里直接完成 Git 操作,而无需退出 Vim 。https://github.com/tpope/vim-fugitive
cd ~/.vim/bundle
git clone https://github.com/tpope/vim-fugitive.git
vim -u NONE -c "helptags vim-fugitive/doc" -c q
1 package main
2
3 import "fmt"
4
5 func main() {
6 x := true
7 items := []string{"tv", "pc", "tablet"}
8
9 if x {
10 for _, i := range items {
11 fmt.Println(i)
12 }
13 }
14 }
1 # On branch master
2 # Your branch is up to date with 'origin/master'.
3 #
4 # Changes not staged for commit:
5 # (use "git add <file>..." to update what will be committed)
6 # (use "git checkout -- <file>..." to discard changes in working directory)
7 #
8 # modified: vim-5plugins/examples/test1.go
9 #
10 no changes added to commit (use "git add" and/or "git commit -a")
--------------------------------------------------------------------------------------------------------
1 package main
2
3 import "fmt"
4
_ 5 func main() {
6 items := []string{"tv", "pc", "tablet"}
7
~ 8 if len(items) > 0 {
9 for _, i := range items {
10 fmt.Println(i)
+ 11 fmt.Println("------")
12 }
13 }
14 }
_
表示在第 5 行与第 6 行之间有代码被删除,~
表示在第 8 行代码被修改过,+
表示 11 行新增了代码。e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 1 package main
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 2
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 3 import "fmt"
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 4
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│_ 5 func main() {
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 6 items := []string{"tv", "pc", "tablet"}
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 7
00000000 (Not Committed Yet 2019-6-7 18:55:00 -0500)│~ 8 if len(items) > 0 {
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 9 for _, i := range items {
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 10 fmt.Println(i)
00000000 (Not Committed Yet 2019-6-7 18:55:00 -0500)│+ 11 fmt.Println("------")
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 12 }
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 13 }
e9949066 (Alvin Yan 2019-6-7 18:17:19 -0500)│ 14 }
1 vim-5plugins: Updated test1.go example file
2 # Please enter the commit message for your changes. Lines starting
3 # with '#' will be ignored, and an empty message aborts the commit.
4 #
5 # On branch master
6 # Your branch is up to date with 'origin/master'.
7 #
8 # Changes to be committed:
9 # modified: vim-5plugins/examples/test1.go
10 #
[master c3bf80f] vim-5plugins: Updated test1.go example file
1 file changed, 2 insertions(+), 2 deletions(-)
Press ENTER or type command to continue
1 # On branch master
2 # Your branch is ahead of 'origin/master' by 1 commit.
3 # (use "git push" to publish your local commits)
4 #
5 nothing to commit, working tree clean
文章推荐
小程序推荐
文章声明
每天定时更新各种教程文章与线报福利!
SFS运维工具箱专注原创网络技术服务
禁止非法转载原创文章、如需转载请联系作者!否则后果自负!
本文章只提供参考学习!请勿用于商业用途!
“SFS运维工具箱”公众号诚邀广大技术人员
投稿投稿邮箱:sfstool@qq.com
转载商务合作邮箱:sfstool@qq.com
小编QQ:2841936347