<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: deeeelin</title>
    <description>The latest articles on DEV Community by deeeelin (@deeeelin).</description>
    <link>https://dev.to/deeeelin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1043025%2Fc18da523-4336-4ead-b00c-ad46c88bcffd.png</url>
      <title>DEV Community: deeeelin</title>
      <link>https://dev.to/deeeelin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/deeeelin"/>
    <language>en</language>
    <item>
      <title>Let vim with external themes fill terminal window in Mac</title>
      <dc:creator>deeeelin</dc:creator>
      <pubDate>Sat, 11 Mar 2023 08:15:24 +0000</pubDate>
      <link>https://dev.to/deeeelin/let-vim-editor-with-external-colorschemes-fill-terminal-window-in-mac-3ml8</link>
      <guid>https://dev.to/deeeelin/let-vim-editor-with-external-colorschemes-fill-terminal-window-in-mac-3ml8</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Some mac users with external colorschemes installed in vim may occur this problem : "vim editor didn't fill the whole screen of terminal" (which creates the blue gap in the sample image after opening vim) , although it doesn't bother in the functional aspects, but it still looks a little annoying or imperfect. This article helps you solve this problem !&lt;/p&gt;

&lt;p&gt;Before opening vim : &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UVBrsQpK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/JDqcqO2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UVBrsQpK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/JDqcqO2.png" alt="Before opening vim" width="880" height="602"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After opening vim :&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ynvZxX0f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/zPvYw5U.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ynvZxX0f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/zPvYw5U.png" alt="After opening vim" width="880" height="603"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Foreword
&lt;/h3&gt;

&lt;p&gt;At first I tried to find a solution to let vim to fill the terminal, but it seems there are no direct way to make this happen ,so there is a alternative solution, "let terminal background color be same as vim editor when vim is open". I get inspried when looking at &lt;a href="https://superuser.com/questions/1188772/mac-command-to-change-the-background-color-in-a-terminal"&gt;here&lt;/a&gt;, so I wrote a bash script to make this happen, below is the code,make sure your computer can execute applescript and bash !&lt;/p&gt;
&lt;h3&gt;
  
  
  Let's start!
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Make a terminal config file with the same background color as vim 

&lt;ol&gt;
&lt;li&gt;You can use the builtin app "Digital Color Meter" in mac to get the rgb value of the vim background color.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mhCKBsiC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://help.apple.com/assets/61E87FFE1DFCFB222874A4D9/61E87FFE1DFCFB222874A4E0/zh_TW/73871c3e2be37a62a93b1f9ab437c23b.png" alt="image alt" width="400" height="400"&gt;
&lt;/li&gt;
&lt;li&gt;Then choose Terminal &amp;gt; Preferences , click Profiles, create a profile, then click Text.You can see the "Color and Effects section" under a subject "Background", change the color using the obtained rgb value.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HaRjwkTx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/80CAFZ8.png" alt="" width="880" height="638"&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;2.Copy the below code, remember to change &amp;lt;1&amp;gt; in the quote to step 1.2's terminal profile name, &amp;lt;2&amp;gt; as your vim editor path.&lt;/p&gt;

&lt;p&gt;3.Save the below code as a bash file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash


original=$(osascript -e 'tell application "Terminal" to return name of current settings of window 1')

osascript -e 'tell application "Terminal"

   set current settings of window 1 to settings set "&amp;lt;1&amp;gt;"

end tell'

&amp;lt;2&amp;gt; $@

osascript \
-e 'tell application "Terminal"' \
-e "set current settings of window 1 to settings set \"$original\"" \
-e 'end tell'

unset original

exit 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Additional step
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;For convenience, you can rename your bash file as "vim" using "mv" command in terminal (need to use "mv" command to forcely remove file extension in filename)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then put the file under a empty directory &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After placing your directory in a nice place,you can add the below line to ".bash_profile" or ".zprofile" (depends on which default shell you use ) , remember to change &amp;lt;1&amp;gt; to the path of the directory your bash file is.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  PATH="&amp;lt;1&amp;gt;:${PATH}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Now execute the bash script and see if it works !
&lt;/h2&gt;

&lt;p&gt;ps. If you gone through step 5, reopen your terminal, and you can just type "vim" to use vim editor with the problem solved now !&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CFIWvb3_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/jxBVI1D.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CFIWvb3_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.imgur.com/jxBVI1D.png" alt="problem solved" width="880" height="709"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Additional information
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Arguments : 

&lt;ul&gt;
&lt;li&gt;you can add arguments behind the name of bash file when entering command, these arguements will be thrown to vim in the exact same form.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;```
 &amp;lt;bash file path&amp;gt; test.txt
```
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the above command is equivalent to "edit text.txt by vim"&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://superuser.com/questions/1188772/mac-command-to-change-the-background-color-in-a-terminal"&gt;https://superuser.com/questions/1188772/mac-command-to-change-the-background-color-in-a-terminal&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>vim</category>
      <category>bash</category>
      <category>beginners</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
