{"id":1121,"date":"2026-08-07T23:40:45","date_gmt":"2026-08-08T06:40:45","guid":{"rendered":"https:\/\/www.sandcomp.com\/blog\/?p=1121"},"modified":"2026-08-08T18:36:43","modified_gmt":"2026-08-09T01:36:43","slug":"gdoc-vim","status":"publish","type":"post","link":"https:\/\/www.sandcomp.com\/blog\/2026\/08\/07\/gdoc-vim\/","title":{"rendered":"gdoc-vim\uff1a\u7528 vim \u76f4\u63a5\u7f16\u8f91 Google Docs"},"content":{"rendered":"\n<div class=\"wp-block-jetpack-markdown\"><p>\u6211\u5f88\u559c\u6b22 vim\uff0c\u4e5f\u559c\u6b22\u5728\u547d\u4ee4\u884c\u91cc\u628a\u4e8b\u60c5\u505a\u5b8c\u3002Google Docs \u4e5f\u5f88\u597d\u7528\uff0c\u5171\u4eab\u3001\u8bc4\u8bba\u3001\u7248\u672c\u5386\u53f2\u90fd\u7701\u5fc3\u3002<\/p>\n<p>Google Docs \u73b0\u5728\u539f\u751f\u652f\u6301 Markdown \u7684\u5bfc\u5165\u548c\u5bfc\u51fa\uff0c\u628a\u4e24\u8005\u63a5\u8d77\u6765\u5c31\u5f88\u81ea\u7136\u4e86\uff1a\u6587\u6863\u8fd8\u653e\u5728 Docs \u4e0a\uff0c\u7f16\u8f91\u5728 vim \u91cc\u5b8c\u6210\u3002\u4e8e\u662f\u5199\u4e86\u8fd9\u4e2a\u5c0f\u5de5\u5177\uff0c<code>gdoc-vim<\/code>\u3002<\/p>\n<h2>\u5b89\u88c5<\/h2>\n<pre><code class=\"language-bash\">pipx install gdoc-vim\n<\/code><\/pre>\n<h2>\u7528\u6cd5<\/h2>\n<p>\u7f16\u8f91\u4e00\u4e2a\u5df2\u6709\u7684\u6587\u6863\uff0cURL \u76f4\u63a5\u4ece\u6d4f\u89c8\u5668\u5730\u5740\u680f\u590d\u5236\uff1a<\/p>\n<pre><code class=\"language-bash\">gdoc-vim https:\/\/docs.google.com\/document\/d\/FILE_ID\/edit\n<\/code><\/pre>\n<p>\u5b83\u4f1a\u628a\u6587\u6863\u5bfc\u51fa\u6210 Markdown\uff0c\u7528 vim \u6253\u5f00\uff08\u6216\u8005\u4f60\u7684 <code>$EDITOR<\/code>\uff09\u3002<code>:wq<\/code> \u4fdd\u5b58\u9000\u51fa\u540e\uff0c\u5185\u5bb9\u81ea\u52a8\u8f6c\u6362\u56de\u53bb\u5199\u5165<strong>\u540c\u4e00\u4e2a\u6587\u6863<\/strong>\u2014\u2014\u94fe\u63a5\u4e0d\u53d8\u3001\u5171\u4eab\u8bbe\u7f6e\u4e0d\u53d8\u3001\u4fee\u8ba2\u5386\u53f2\u7167\u5e38\u7d2f\u79ef\u3002<\/p>\n<p>\u65b0\u5efa\u6587\u6863\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5f00\u5199\uff1a<\/p>\n<pre><code class=\"language-bash\">gdoc-vim -n &quot;\u4f1a\u8bae\u8bb0\u5f55&quot;\n<\/code><\/pre>\n<h2>\u6362\u4e2a\u7f16\u8f91\u5668<\/h2>\n<p>\u540d\u5b57\u91cc\u867d\u7136\u5e26 vim\uff0c\u4f46\u7528\u4ec0\u4e48\u7f16\u8f91\u5668\u90fd\u884c\uff0c\u5b83\u8ba4 <code>$EDITOR<\/code>\uff1a<\/p>\n<pre><code class=\"language-bash\">export EDITOR=emacs\n<\/code><\/pre>\n<p>\u56fe\u5f62\u754c\u9762\u7684\u7f16\u8f91\u5668\u8981\u52a0\u4e0a\u7b49\u5f85\u53c2\u6570\uff0c\u6bd4\u5982 <code>export EDITOR=&quot;code --wait&quot;<\/code>\uff0c\u5426\u5219\u547d\u4ee4\u4e00\u542f\u52a8\u5c31\u8fd4\u56de\u4e86\uff0c\u5de5\u5177\u4f1a\u4ee5\u4e3a\u4f60\u6ca1\u505a\u4efb\u4f55\u4fee\u6539\u3002<\/p>\n<h2>Google \u6388\u6743<\/h2>\n<p>\u7b2c\u4e00\u6b21\u8fd0\u884c\u9700\u8981\u914d\u4e00\u4e0b Google \u7684\u6388\u6743\uff1a\u4f60\u8981\u5728 Google Cloud Console \u5efa\u4e00\u4e2a\u81ea\u5df1\u7684 OAuth \u5ba2\u6237\u7aef\uff0c\u5927\u6982\u4e09\u5206\u949f\uff0c\u505a\u4e00\u6b21\u5c31\u597d\u3002\u5de5\u5177\u7b2c\u4e00\u6b21\u8dd1\u7684\u65f6\u5019\u4f1a\u5728\u7ec8\u7aef\u6253\u5370\u5206\u6b65\u6307\u5f15\uff0c\u8ddf\u7740\u505a\u5c31\u884c\u3002<\/p>\n<p>\u6709\u4e00\u4e2a\u5730\u65b9\u503c\u5f97\u63d0\u9192\uff1a\u65b0\u5efa\u7684 OAuth \u5ba2\u6237\u7aef\u9ed8\u8ba4\u662f \u201cTesting\u201d \u72b6\u6001\uff0c\u8fd9\u4e2a\u72b6\u6001\u4e0b Google \u7b7e\u53d1\u7684 token <strong>7 \u5929\u5c31\u8fc7\u671f<\/strong>\uff0c\u5f97\u6bcf\u5468\u91cd\u65b0\u6388\u6743\u4e00\u6b21\u3002\u5728 Console \u91cc\u628a\u53d1\u5e03\u72b6\u6001\u6539\u6210 \u201cIn production\u201d \u5c31\u597d\u4e86\uff0c\u8fd9\u4e00\u6b65\u4e0d\u9700\u8981\u901a\u8fc7\u4efb\u4f55\u9a8c\u8bc1\u3002<\/p>\n<h2>\u94fe\u63a5<\/h2>\n<ul>\n<li>GitHub\uff1a<a href=\"https:\/\/github.com\/gmajian\/gdoc-vim\">https:\/\/github.com\/gmajian\/gdoc-vim<\/a><\/li>\n<li>PyPI\uff1a<a href=\"https:\/\/pypi.org\/project\/gdoc-vim\/\">https:\/\/pypi.org\/project\/gdoc-vim\/<\/a><\/li>\n<\/ul>\n<p>GPL-3.0 \u534f\u8bae\u3002\u6709\u95ee\u9898\u6216\u8005\u5efa\u8bae\uff0c\u6b22\u8fce\u5728\u4e0b\u9762\u7559\u8a00\uff0c\u6216\u8005\u53bb GitHub \u63d0 issue\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[12],"tags":[],"class_list":["post-1121","post","type-post","status-publish","format-standard","hentry","category-12"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/posts\/1121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/comments?post=1121"}],"version-history":[{"count":3,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/posts\/1121\/revisions"}],"predecessor-version":[{"id":1129,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/posts\/1121\/revisions\/1129"}],"wp:attachment":[{"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/media?parent=1121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/categories?post=1121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/tags?post=1121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}