{"id":1123,"date":"2026-08-07T23:42:09","date_gmt":"2026-08-08T06:42:09","guid":{"rendered":"https:\/\/www.sandcomp.com\/blog\/?p=1123"},"modified":"2026-08-08T18:37:09","modified_gmt":"2026-08-09T01:37:09","slug":"gdoc-vim-en","status":"publish","type":"post","link":"https:\/\/www.sandcomp.com\/blog\/en\/2026\/08\/07\/gdoc-vim-en\/","title":{"rendered":"gdoc-vim: Editing Google Docs Directly in vim"},"content":{"rendered":"\n<div class=\"wp-block-jetpack-markdown\"><p>I like vim, and I like getting things done from the command line. Google Docs is also good at what it does \u2014 sharing, comments, revision history all come for free.<\/p>\n<p>Google Docs now supports Markdown import and export natively, which makes connecting the two a natural thing to do: the document stays in Docs, the editing happens in vim. So I wrote a small tool for it, <code>gdoc-vim<\/code>.<\/p>\n<h2>Installing<\/h2>\n<pre><code class=\"language-bash\">pipx install gdoc-vim\n<\/code><\/pre>\n<h2>Usage<\/h2>\n<p>To edit an existing document, paste the URL straight from your browser\u2019s address bar:<\/p>\n<pre><code class=\"language-bash\">gdoc-vim https:\/\/docs.google.com\/document\/d\/FILE_ID\/edit\n<\/code><\/pre>\n<p>It exports the document as Markdown and opens it in vim (or whatever <code>$EDITOR<\/code> points at). When you <code>:wq<\/code>, the content is converted back and written to <strong>the same document<\/strong> \u2014 same link, same sharing settings, revision history intact.<\/p>\n<p>You can also start a new document and go straight to writing:<\/p>\n<pre><code class=\"language-bash\">gdoc-vim -n &quot;Meeting notes&quot;\n<\/code><\/pre>\n<h2>Using a different editor<\/h2>\n<p>The name says vim, but any editor works \u2014 it honors <code>$EDITOR<\/code>:<\/p>\n<pre><code class=\"language-bash\">export EDITOR=emacs\n<\/code><\/pre>\n<p>For GUI editors, add whatever flag makes them block, e.g. <code>export EDITOR=&quot;code --wait&quot;<\/code>. Otherwise the command returns immediately and the tool sees an unchanged file.<\/p>\n<h2>Google authorization<\/h2>\n<p>The first run needs Google authorization set up: you create your own OAuth client in the Google Cloud Console. It takes about three minutes, once. The tool prints step-by-step instructions in the terminal the first time you run it.<\/p>\n<p>One thing worth knowing: a new OAuth client starts in \u201cTesting\u201d status, and in that state the tokens Google issues <strong>expire after 7 days<\/strong>, so you\u2019d have to re-authorize every week. Setting the publishing status to \u201cIn production\u201d in the Console fixes it, and that step requires no verification.<\/p>\n<h2>Links<\/h2>\n<ul>\n<li>GitHub: <a href=\"https:\/\/github.com\/gmajian\/gdoc-vim\">https:\/\/github.com\/gmajian\/gdoc-vim<\/a><\/li>\n<li>PyPI: <a href=\"https:\/\/pypi.org\/project\/gdoc-vim\/\">https:\/\/pypi.org\/project\/gdoc-vim\/<\/a><\/li>\n<\/ul>\n<p>Licensed under GPL-3.0. Questions or suggestions welcome in the comments below, or as an issue on GitHub.<\/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":[46],"tags":[],"class_list":["post-1123","post","type-post","status-publish","format-standard","hentry","category-tools"],"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\/1123","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=1123"}],"version-history":[{"count":3,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/posts\/1123\/revisions"}],"predecessor-version":[{"id":1130,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/posts\/1123\/revisions\/1130"}],"wp:attachment":[{"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/media?parent=1123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/categories?post=1123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sandcomp.com\/blog\/wp-json\/wp\/v2\/tags?post=1123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}