为Nvim添加了nvim-cmp
插件栈… 之前一直没有动手, 只单独安装了几个无复杂依赖的插件, 这次直接一口气从nvim-cmp
补全插件, LSP相关, 代码块补全, 模糊查找等全部搞好了..
其实际上高度耦合… 代码块补全以及LSP最终必须全部集成到nvim-cmp
中, 而且还更新了代码块补全为luasnip这个lua编写的补全前端(?不确定), 丢弃了原本的utlisnip, 因而还把所有自定义的代码块全部用luasnip的语法重写了..同时, 修改了插件管理器为lazy.nvim, 重构了我的nvim的所有配置文件的目录树结构..
还记得最开始只是希望把github官方提供的copilot升级为别人进一步封装好的copilot.lua版本.. 结果一口气涉及到了这么多相关的插件…
相关的配置文件在: dotfiles/config/.config/nvim at master · rqdmap/dotfiles
总览
使用Graphviz Dot画的图, 一种是fdp( <Force-directed graph drawing - Wikipedia>)的排版引擎:
另一种就是Dot原本的层次化的画图引擎:
感觉都差强人意, 而且修改.dot文件本身有点过于劳顿了, 后续考虑开发一款生成dot文件的简单脚本程序..
对应的Dot文件代码以及指令如下:
bash
1dot -Tpng -o plugin-fdp.png plugin.dot [-K fdp]
markdown不能渲染dot文件, 搓..
graphviz
1digraph G{
2 /* Config */
3
4 // rankdir=LR;
5 node [fontsize=16,fontcolor=blue,style=filled,fillcolor=Wheat,shape=record];
6 overlap = false;
7 compound = false;
8 concentrate = true;
9
10 /* Nodes */
11 vim_snippet [label="{vim_snippet | snippet补全引擎}"];
12
13 luasnip [label="{luasnip}"]
14 cmp_luasnip [label="{cmp-luasnip | 为nvim-cmp提供source}"]
15
16
17 cmp_buffer [label="{cmp-buffer}"]
18 cmp_path [label="{cmp-path}"]
19 cmp_cmdline [label="{cmp-cmdline}"]
20
21 subgraph cluster_builtin{
22 label = "nvim-cmp-builtin-source";
23 graph[style=dashed];
24 cmp_buffer cmp_path cmp_cmdline
25 }
26
27 mason [label="{mason | LSP Server管理器}"]
28 mason_lspconfig [label="{mason-lspconfig | 连接Mason以及lspconfig}"]
29 lspconfig [label="{lspconfig | Nvim原生LSP的封装}"]
30 cmp_nvim_lsp [label="{cmp-nvim-lsp | 为nvim-cmp提供source}"]
31
32 subgraph cluster_lsp{
33 label = "LSP";
34 mason mason_lspconfig lspconfig
35 }
36
37 copilot [label="{copilot}"]
38 copilot_cmp [label="{copilot-cmp | 为nvim-cmp提供source}"]
39 lspkind_nvim [label="{lspkind.nvim | 添加图案}"]
40
41 nvim_cmp [label="{nvim-cmp | 代码补全}"]
42
43 lazy_nvim [label="{lazy.nvim | 插件管理器}"]
44
45
46 lualine [label="{lualine}"]
47 bufferline [label="{bufferline}"]
48 gruvbox_nvim [label="{gruvbox.nvim}"]
49 MatchTagAlways [label="{MatchTagAlways}"]
50 rasi_vim [label="{rasi.vim}"]
51 ron_vim [label="{ron.vim}"]
52 vim_css_color [label="{vim.css.color}"]
53
54 subgraph cluster_ui{
55 label = "UI";
56 lualine bufferline gruvbox_nvim MatchTagAlways rasi_vim ron_vim vim_css_color
57 }
58
59
60 fcitx_vim [label="{fcitx.vim}"]
61 vim_table_mode [label="{vim-table-mode}"]
62 Comment [label="{Comment}"]
63 subgraph cluster_edit{
64 label = "Edit"
65 fcitx_vim vim_table_mode Comment nvim_cmp
66 }
67
68
69 telescope [label="{telescope}"]
70 nvim_tree [label="{nvim-tree}"]
71 subgraph cluster_search{
72 label = "Search";
73 telescope nvim_tree symbols_outline
74 }
75
76
77 aw_watcher_vim [label="{aw-watcher-vim}"]
78 subgraph cluster_misc{
79 label = "MISC";
80 aw_watcher_vim
81 }
82
83 tagbar [label="{tagbar}"]
84 subgraph cluster_depracated{
85 label = "Depracated";
86 tagbar
87 }
88
89
90 nvim_treesitter [label="{nvim-treesitter}"]
91 subgraph cluster_todo{
92 label = "Todo";
93 nvim_treesitter
94 }
95
96
97 /* Edges */
98 vim_snippet -> luasnip
99 luasnip -> cmp_luasnip
100 cmp_luasnip -> nvim_cmp
101 cmp_buffer -> nvim_cmp
102 cmp_path -> nvim_cmp
103 cmp_cmdline -> nvim_cmp
104
105 mason -> lspconfig
106 mason_lspconfig -> lspconfig
107 lspconfig -> cmp_nvim_lsp
108
109 copilot -> copilot_cmp
110 copilot_cmp -> nvim_cmp
111
112 cmp_nvim_lsp -> nvim_cmp
113
114 lspkind_nvim -> nvim_cmp
115
116 lspconfig -> symbols_outline
117}
如何调试Vim插件?
-
vim -V[n] file_name
, 通过:tab h verbose
以及:tab h vbs
查看具体等级信息对应的内容 -
print调试大法好,
:redir > logfile
with:redir END