{"id":1790,"date":"2023-08-08T16:28:51","date_gmt":"2023-08-08T15:28:51","guid":{"rendered":"https:\/\/coding.moris.org\/?p=1790"},"modified":"2023-08-09T11:19:33","modified_gmt":"2023-08-09T10:19:33","slug":"batch-script-to-open-a-file-in-a-running-instance-of-gvim","status":"publish","type":"post","link":"https:\/\/priscimon.net\/coding\/2023\/08\/08\/batch-script-to-open-a-file-in-a-running-instance-of-gvim\/","title":{"rendered":"Batch script to open a file in a running instance of gVim"},"content":{"rendered":"\n<p>To open a file in a gVim (graphical Vim) instance that is already running, the following command is used.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C:\\&gt; gvim --remote-silent &lt;filename&gt;<\/code><\/pre>\n\n\n\n<p>To reduce the amount of typing needed, we can put the same command in a batch script file. We can also add a condition that starts a new instance of gVim or reuses an existing instance. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>REM gvimr.bat\n@echo off\ntasklist \/fi \"imagename eq gvim.exe\" 2>NUL | findstr \/i gvim\\.exe 2>NUL\nif \"%ERRORLEVEL%\" == \"1\" (\n    call gvim.bat --servername GVIMR %*\n) else (\n    if NOT \"%~1\" == \"\" (call gvim.bat --servername GVIMR --remote-silent %*)\n)\n<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>To open a file in a gVim (graphical Vim) instance that is already running, the following command is used. To reduce the amount of typing needed, we can put the same command in a batch script file. We can also add a condition that starts a new instance of gVim or reuses an existing instance.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"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":""},"categories":[1],"tags":[],"class_list":["post-1790","post","type-post","status-publish","format-standard","hentry","category-general"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3I4g9-sS","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/posts\/1790","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/comments?post=1790"}],"version-history":[{"count":4,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/posts\/1790\/revisions"}],"predecessor-version":[{"id":1794,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/posts\/1790\/revisions\/1794"}],"wp:attachment":[{"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/media?parent=1790"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/categories?post=1790"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/priscimon.net\/coding\/wp-json\/wp\/v2\/tags?post=1790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}