{"id":38502,"date":"2023-01-22T21:36:20","date_gmt":"2023-01-22T13:36:20","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=38502"},"modified":"2023-01-22T21:36:37","modified_gmt":"2023-01-22T13:36:37","slug":"vim-plug-in-developers01","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/vim-plug-in-developers01.html","title":{"rendered":"\u5b9e\u7528\uff01\u5f00\u53d1\u8005\u7684 Vim \u63d2\u4ef6\uff08\u4e00\uff09"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u4f5c\u4e3a Vi \u7684\u5347\u7ea7\u7248\uff0cVim \u6beb\u65e0\u4e89\u8bae\u662f Linux \u4e2d\u6700\u53d7\u6b22\u8fce\u7684\u547d\u4ee4\u884c\u7f16\u8f91\u5668\u4e4b\u4e00\u3002\u9664\u4e86\u662f\u4e00\u4e2a\u591a\u529f\u80fd\u7f16\u8f91\u5668\u5916\uff0c\u4e16\u754c\u5404\u5730\u7684\u8f6f\u4ef6\u5f00\u53d1\u8005\u5c06 Vim \u5f53\u505a IDE(\u96c6\u6210\u5f00\u53d1\u73af\u5883Integrated Development Environment)\u6765\u4f7f\u7528\u3002\u4e8b\u5b9e\u4e0a\uff0c\u56e0\u4e3a Vim \u53ef\u4ee5\u901a\u8fc7\u63d2\u4ef6\u6765\u6269\u5c55\u5176\u81ea\u8eab\u529f\u80fd\u624d\u4f7f\u5f97\u5b83\u5982\u6b64\u529f\u80fd\u5f3a\u5927\u3002\u4e0d\u7528\u8bf4\uff0c\u80af\u5b9a\u6709\u90a3\u4e48\u51e0\u4e2a Vim \u63d2\u4ef6\u662f\u65e8\u5728\u63d0\u9ad8\u7528\u6237\u7684\u7f16\u7a0b\u4f53\u9a8c\u7684\u3002\u7279\u522b\u662f\u5bf9\u4e8e\u521a\u521a\u4f7f\u7528 Vim \u6216\u8005\u4f7f\u7528 Vim \u505a\u5f00\u53d1\u7684\u7684\u8f6f\u4ef6\u5f00\u53d1\u8005\u6765\u8bf4\uff0c\u6211\u4eec\u5c06\u5728\u672c\u6559\u7a0b\u4e2d\u8ba8\u8bba\u4e00\u4e9b\u975e\u5e38\u6709\u7528\u7684 Vim \u63d2\u4ef6\uff0c\u5177\u4f53\u8bf7\u770b\u4f8b\u793a\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u8bf7\u6ce8\u610f\uff1a\u672c\u6559\u7a0b\u4e2d\u5217\u4e3e\u7684\u6240\u6709\u4f8b\u793a\u3001\u547d\u4ee4\u548c\u8bf4\u660e\u90fd\u662f\u5728 Ubuntu 16.04 \u73af\u5883\u4e0b\u8fdb\u884c\u6d4b\u8bd5\u7684\uff0c\u5e76\u4e14\uff0c\u6211\u4eec\u4f7f\u7528\u7684 Vim \u7248\u672c\u662f 7.4\u3002<\/p>\n

\u63d2\u4ef6\u5b89\u88c5\u8bbe\u7f6e<\/strong><\/div>\n

\u8fd9\u662f\u4e3a\u65b0\u7528\u6237\u51c6\u5907\u7684\uff0c\u5047\u8bbe\u4ed6\u4eec\u4e0d\u77e5\u9053\u5982\u4f55\u5b89\u88c5 Vim \u63d2\u4ef6\u3002\u6240\u4ee5\uff0c\u9996\u5148\uff0c\u5c31\u662f\u7ed9\u51fa\u4e00\u4e9b\u5b8c\u6210\u5b89\u88c5\u8bbe\u7f6e\u7684\u6b65\u9aa4\u3002<\/p>\n

\u5728\u4f60\u7684\u5bb6\u76ee\u5f55\u4e0b\u521b\u5efa\".vim\"\u76ee\u5f55\uff0c\u5e76\u5728\u5176\u4e2d\u521b\u5efa\u5b50\u76ee\u5f55\"autoload\"\u548c\"bundle\"\u3002<\/p>\n

\u7136\u540e\u5728\"autoload\"\u653e\u7f6e\"pathogen.vim\"\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u53ef\u4ee5\u4ece\"https:\/\/raw.githubusercontent.com\/tpope\/vim-pathogen\/master\/autoload\/pathogen.vim\"\u6b64\u5904\u4e0b\u8f7d\u3002<\/p>\n

\u6700\u540e\u5728\u4f60\u7684\u5bb6\u76ee\u5f55\u521b\u5efa\".vimrc\"\u6587\u4ef6\uff0c\u5e76\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u3002<\/p>\n

1. call\u00a0pathogen#infect()<\/pre>\n

\"\"<\/p>\n

\u81f3\u6b64\uff0c\u4f60\u5df2\u5b8c\u6210\u4e86 Vim \u63d2\u4ef6\u5b89\u88c5\u7684\u51c6\u5907\u5de5\u4f5c\u3002<\/p>\n

\u6ce8\u610f\uff1a\u6211\u4eec\u5df2\u7ecf\u8ba8\u8bba\u4e86\u4f7f\u7528Pathogen\u7ba1\u7406Vim\u63d2\u4ef6\u3002\u5f53\u7136\u8fd8\u6709\u5176\u4ed6\u7684\u63d2\u4ef6\u7ba1\u7406\u5de5\u5177\u2014\u2014\u6b32\u4e86\u89e3\uff0c\u8bf7\u8bbf\u95ee:\"http:\/\/vi.stackexchange.com\/questions\/388\/what-is-the-difference-between-the-vim-plugin-managers\"\u3002<\/p>\n

\u73b0\u5728\u5df2\u7ecf\u5168\u90e8\u8bbe\u7f6e\u5b8c\u6bd5\uff0c\u5c31\u8ba9\u6211\u4eec\u6765\u8ba8\u8bba\u4e24\u4e2a\u597d\u7528\u7684 Vim \u63d2\u4ef6\u5427\u3002<\/p>\n

Vim \u6807\u7b7e\u4fa7\u8fb9\u680f(Tagbar)\u63d2\u4ef6<\/strong><\/div>\n

\u9996\u5148\u5c31\u662f\u6807\u7b7e\u4fa7\u8fb9\u680f(Tagbar)\u63d2\u4ef6\u3002\u8be5\u63d2\u4ef6\u80fd\u591f\u8ba9\u4f60\u6d4f\u89c8\u6e90\u6587\u4ef6\u5305\u542b\u7684\u6807\u7b7e\uff0c\u4ece\u800c\u63d0\u4f9b\u8be5\u6e90\u6587\u4ef6\u7684\u7ed3\u6784\u7b80\u89c8\u3002\u5176\u5b98\u7f51\u7684\u63d2\u4ef6\u8bf4\u660e\u662f\u8fd9\u6837\u8bf4\u7684\uff1a\u201c\u5b83\u901a\u8fc7\u521b\u5efa\u4fa7\u8fb9\u680f\uff0c\u7136\u540e\u4ee5\u4e00\u5b9a\u987a\u5e8f\u5c55\u793a\u4ece\u5f53\u524d\u6587\u4ef6\u4ee5 ctags \u63d0\u53d6\u7684\u6807\u7b7e\u6765\u5b8c\u6210\u8fd9\u4e00\u529f\u80fd\u3002\u8fd9\u610f\u5473\u7740\uff0c\u6bd4\u5982\uff0cC++ \u4e2d\u7684\u65b9\u6cd5\u5c06\u5c55\u793a\u5728\u5176\u81ea\u8eab\u6240\u5b9a\u4e49\u5728\u7684\u7c7b\u91cc\u8fb9\u3002\u201d<\/p>\n

\u542c\u8d77\u6765\u5f88\u9177\uff0c\u4e0d\u662f\u5417?\u8ba9\u6211\u4eec\u6765\u770b\u770b\u8be5\u600e\u4e48\u5b89\u88c5\u5b83\u3002<\/p>\n

\u6807\u7b7e\u4fa7\u8fb9\u680f(Tagbar)\u7684\u5b89\u88c5\u8fc7\u7a0b\u662f\u76f8\u5f53\u5bb9\u6613\u7684\u2014\u2014\u4f60\u53ea\u9700\u8981\u8fd0\u884c\u4e0b\u5217\u547d\u4ee4\uff1a<\/p>\n

\r\n1. cd\u00a0~\/.vim\/bundle\/\r\n2. \r\n3. git\u00a0clone\u00a0git:\/\/github.com\/majutsushi\/tagbar\r\n<\/pre>\n

\u5b89\u88c5\u5b8c\u4e4b\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e86\uff0c\u4f60\u53ef\u4ee5\u5728 Vim \u4e2d\u6253\u5f00\u4e00\u4e2a\".cpp\"\u6587\u4ef6\u6765\u6d4b\u8bd5\u5b83\uff1a\u8fdb\u5165\u547d\u4ee4\u6a21\u5f0f\uff0c\u7136\u540e\u8fd0\u884c\":TagbarOpen\"\u547d\u4ee4\u3002\u4ee5\u4e0b\u662f\u8fd0\u884c\":TagbarOpen\"\u547d\u4ee4\u4e4b\u540e\u51fa\u73b0\u4fa7\u8fb9\u680f(\u53f3\u4fa7) \u7684\u6548\u679c\u56fe\u3002<\/p>\n

\"\"<\/p>\n

\u4f7f\u7528\":TagbarClose\u53ef\u4ee5\u5173\u95ed\u4fa7\u8fb9\u680f\u3002\u503c\u5f97\u4e00\u63d0\u7684\u662f\uff0c\u53ef\u4ee5\u4f7f\u7528\":TagbarOpen fj\"\u547d\u4ee4\u6253\u5f00\u4fa7\u8fb9\u680f\u6765\u6253\u5f00\u5b83\u7684\u8df3\u8f6c(shift control)\u529f\u80fd\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u4f60\u53ef\u4ee5\u5f88\u65b9\u4fbf\u7684\u6d4f\u89c8\u5f53\u524d\u6587\u4ef6\u5305\u542b\u7684\u6807\u7b7e\u2014\u2014\u5728\u5bf9\u5e94\u7684\u6807\u7b7e\u4e0a\u6309\u4e0b Enter \u952e\uff0c\u7136\u540e\u5728\u5de6\u4fa7\u7684\u6e90\u4ee3\u7801\u7a97\u53e3\u8df3\u8f6c\u5230\u5bf9\u5e94\u7684\u4f4d\u7f6e\u3002
\n\"\"<\/p>\n

\u5047\u5982\u4f60\u60f3\u8981\u53cd\u590d\u5730\u5f00\u5173\u4fa7\u8fb9\u680f\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528 :TagbarToggle \u547d\u4ee4\uff0c\u800c\u4e0d\u7528\u4ea4\u66ff\u7684\u4f7f\u7528 :TagbarOpen \u548c:TagbarClose \u547d\u4ee4\u3002<\/p>\n<\/p>\n

\u5982\u679c\u4f60\u89c9\u5f97\u8f93\u5165\u8fd9\u4e9b\u547d\u4ee4\u5f88\u8d39\u65f6\u95f4\uff0c\u4f60\u53ef\u4ee5\u4e3a :TagbarToggle \u547d\u4ee4\u521b\u5efa\u5feb\u6377\u952e\u3002\u6bd4\u5982\uff0c\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u5230.vimrc \u6587\u4ef6\u4e2d\uff1a<\/p>\n

\r\nnmap\u00a0<F8>\u00a0:TagbarToggle<CR>\r\n<\/pre>\n

\u8fd9\u6837\uff0c\u4f60\u5c31\u53ef\u4ee5\u7528 F8 \u6765\u5207\u6362\u6807\u7b7e\u4fa7\u8fb9\u680f(Tagbar)\u4e86\u3002<\/p>\n

\u66f4\u8fdb\u4e00\u6b65\uff0c\u6709\u65f6\u5019\u4f60\u53ef\u80fd\u4f1a\u6ce8\u610f\u5230\u67d0\u4e2a\u6807\u7b7e\u524d\u8fb9\u6709\u4e00\u4e2a\"+\"\u3001\"-\"\u6216\u8005\"#\"\u7b26\u53f7\u3002\u6bd4\u5982\uff0c\u4ee5\u4e0b\u622a\u56fe(\u53d6\u81ea\u8be5\u63d2\u4ef6\u7684\u5b98\u7f51)\u5c55\u793a\u4e86\u4e00\u4e9b\u524d\u8fb9\u6709\"+\"\u53f7\u7684\u6807\u7b7e\u3002
\n\"\"\n<\/p>\n

\u8fd9\u4e9b\u7b26\u53f7\u57fa\u672c\u662f\u7528\u6765\u8868\u660e\u4e00\u4e2a\u7279\u5b9a\u6807\u7b7e\u7684\u53ef\u89c1\u6027\u4fe1\u606f\u3002\u7279\u522b\u662f + \u8868\u793a\u8be5\u7c7b\u662f public \u7684\uff0c\u800c - \u8868\u793a\u4e00\u4e2a private \u7c7b\u3002# \u5219\u662f\u8868\u793a\u4e00\u4e2a protected \u7c7b\u3002<\/p>\n

\u4ee5\u4e0b\u662f\u4f7f\u7528\u6807\u7b7e\u4fa7\u8fb9\u680f(Tagbar)\u7684\u4e00\u4e9b\u6ce8\u610f\u4e8b\u9879\uff1a<\/p>\n