加入收藏 | 设为首页 | 会员中心 | 我要投稿 湖南网 (https://www.hunanwang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 建站 > 正文

5个好用的开发者Vim插件

发布时间:2019-03-02 09:08:25 所属栏目:建站 来源:Ricardo Gerardi
导读:通过这 5 个插件扩展 Vim 成果来晋升你的编码服从。 我用 Vim 已经高出 20 年了,两年前我抉择把它作为我的主要文本编辑器。我用 Vim 来编写代码、设置文件、博客文章及其余恣意可以用纯文本表达的对象。Vim 有许多超等棒的成果,一旦你得当了它,你的事变

Vim Fugitive 是另一个将 Git 事变流集成到 Vim 中的超棒插件。它对 Git 做了一些封装,可以让你在 Vim 里直接执行 Git 呼吁并将功效集成在 Vim 界面里。这个插件有超多的特征,更多信息请会见它的 GitHub 项目页面。

这里有一个行使 Vim Fugitive 的基本 Git 事变流示例。假想我们已经对下面的 Go 代码做出修改,你可以用 :Gblame 挪用 git blame 来查察每行最后的提交信息:

  1. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    1 package main
  2. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    2
  3. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    3 import "fmt"
  4. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    4
  5. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│_   5 func main() {
  6. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    6     items := []string{"tv", "pc", "tablet"}
  7. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    7
  8. 00000000 (Not Committed Yet 2018-12-05 18:55:00 -0500)│~   8     if len(items) > 0 {
  9. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│    9         for _, i := range items {
  10. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   10             fmt.Println(i)
  11. 00000000 (Not Committed Yet 2018-12-05 18:55:00 -0500)│+  11             fmt.Println("------")
  12. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   12         }
  13. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   13     }
  14. e9949066 (Ricardo Gerardi   2018-12-05 18:17:19 -0500)│   14 }

可以看到第 8 行和第 11 行表现还未提交。用 :Gstatus 呼吁搜查客栈当前的状态:

  1.   1 # On branch master
  2.   2 # Your branch is up to date with 'origin/master'.
  3.   3 #
  4.   4 # Changes not staged for commit:
  5.   5 #   (use "git add <file>..." to update what will be committed)
  6.   6 #   (use "git checkout -- <file>..." to discard changes in working directory)
  7.   7 #
  8.   8 #       modified:   vim-5plugins/examples/test1.go
  9.   9 #
  10.  10 no changes added to commit (use "git add" and/or "git commit -a")
  11. --------------------------------------------------------------------------------------------------------
  12.     1 package main
  13.     2
  14.     3 import "fmt"
  15.     4
  16. _   5 func main() {
  17.     6     items := []string{"tv", "pc", "tablet"}
  18.     7
  19. ~   8     if len(items) > 0 {
  20.     9         for _, i := range items {
  21.    10             fmt.Println(i)
  22. +  11             fmt.Println("------")
  23.    12         }
  24.    13     }
  25.    14 }

(编辑:湖南网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读