<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Eklavya's Blog - customize</title><link href="https://sharmaeklavya2.github.io/blog/" rel="alternate"/><link href="https://sharmaeklavya2.github.io/blog/feed/customize.atom.xml" rel="self"/><id>https://sharmaeklavya2.github.io/blog/</id><updated>2025-12-20T00:00:00+05:30</updated><entry><title>Dark Mode for Everything</title><link href="https://sharmaeklavya2.github.io/blog/dark-mode.html" rel="alternate"/><published>2025-12-20T00:00:00+05:30</published><updated>2025-12-20T00:00:00+05:30</updated><author><name/></author><id>tag:sharmaeklavya2.github.io,2025-12-20:/blog/dark-mode.html</id><summary type="html">&lt;p&gt;Tips and tricks on getting dark mode everywhere&lt;/p&gt;</summary><content type="html">&lt;p&gt;In the last decade, dark mode has become a staple feature of most operating systems,
and many apps and websites now adapt to it. Unfortunately, it's not ubiquitous enough.
If it's really dark around me, any website or app that's in light mode becomes unbearably bright,
and so, I set out to figure out how to enable dark mode for &lt;strong&gt;everything&lt;/strong&gt;.
This article documents my findings.&lt;/p&gt;
&lt;p&gt;Additionally, if I'm sitting out in the sun, dark mode can be a bit too dark, so I want light mode then.
This means I want to avoid hard-coding everything to always be in dark mode.&lt;/p&gt;
&lt;div class="toc"&gt;&lt;span class="toctitle"&gt;Table of Contents&lt;/span&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#the-basics"&gt;The Basics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#web"&gt;Web&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#writing-your-own-web-pages"&gt;Writing your own web pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#nginx-autoindex"&gt;Nginx autoindex&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#pdfs"&gt;PDFs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#terminal"&gt;Terminal&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h2 id="the-basics"&gt;The Basics&lt;a class="headerlink" href="#the-basics" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I'm assuming you know how to set/unset dark mode in your OS.
In macOS Tahoe, even after switching to dark mode, app icons are in light mode by default.
You can change that in Systems Settings &amp;gt; Appearance &amp;gt; Icon &amp;amp; widget style.&lt;/p&gt;
&lt;p&gt;I think you'd want to use a dark wallpaper, or if your OS supports it,
different wallpapers depending on the system theme.
In macOS, custom auto-switching wallpapers can be created using the &lt;a href="https://equinoxmac.com/"&gt;Equinox app&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="web"&gt;Web&lt;a class="headerlink" href="#web" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Many websites automatically switch to dark mode, but not all.
On desktop, I use the &lt;a href="https://darkreader.org/"&gt;Dark Reader&lt;/a&gt; browser extension.
It changes websites' colors to forcefully convert them to dark mode if needed.
I haven't tried Dark Reader on my phone yet.&lt;/p&gt;
&lt;h3 id="writing-your-own-web-pages"&gt;Writing your own web pages&lt;a class="headerlink" href="#writing-your-own-web-pages" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I have created many websites from scratch, and I have enabled dark mode for them all.
Doing this is usually quite simple. First, add the following in your HTML's &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;meta&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;color-scheme&amp;quot;&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;&amp;quot;light dark&amp;quot;&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is to tell the browser that we allow both light and dark color schemes on our web page.
Then things like scrollbars and checkboxes will be shown in the right color scheme.
If you haven't set the background and text color in CSS yourself,
the browser will pick values for them too based on the color scheme.&lt;/p&gt;
&lt;p&gt;If you write your own HTML, you're probably using your own CSS too.
Whenever you set a color for something (text, background, or borders) in CSS,
you'd need a way to specify colors for both the dark and light themes.
This can be easily done using the
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme"&gt;&lt;code&gt;prefers-color-scheme&lt;/code&gt;&lt;/a&gt; media feature and the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/var"&gt;&lt;code&gt;var&lt;/code&gt;&lt;/a&gt; CSS function.
In your CSS, start with a color scheme section, like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;--text-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;#202020&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;--bg-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;--link-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;#1a0dab&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="k"&gt;media&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;prefers-color-scheme&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;dark&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;--text-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;#c8c8c8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;--bg-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;#1b1e20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;--link-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;#8ab4f8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then use the colors like this:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;--text-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;--bg-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;--link-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Images can be more difficult to deal with.
If they are photographs, you can reduce their brightness using this CSS:
&lt;code&gt;filter: brightness(.8) contrast(1.2);&lt;/code&gt;.
If they are icons or diagrams, you can invert colors like this:
&lt;code&gt;filter: brightness(.85) invert(1) brightness(.75) hue-rotate(180deg);&lt;/code&gt;&lt;/p&gt;
&lt;h3 id="nginx-autoindex"&gt;Nginx autoindex&lt;a class="headerlink" href="#nginx-autoindex" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;If you're using &lt;a href="https://nginx.org/"&gt;nginx&lt;/a&gt; with &lt;code&gt;autoindex&lt;/code&gt;,
you may want the resulting index pages to be in dark mode too.
You can find the instructions
&lt;a href="https://sharmaeklavya2.github.io/blog/customize-macos.html#enable-nginx-autoindex"&gt;here&lt;/a&gt;.
These instructions are written for macOS;
you'd have to translate them for your OS.&lt;/p&gt;
&lt;h2 id="pdfs"&gt;PDFs&lt;a class="headerlink" href="#pdfs" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;PDF readers can often easily switch their UI (toolbars, etc.) to dark mode,
but switching the PDFs themselves to dark mode is, of course, not easy.&lt;/p&gt;
&lt;p&gt;Preview, the default PDF app in macOS, doesn't support changing the colors of the PDF,
but Adobe's Acrobat Reader does.
In Acrobat Reader, go to Preferences &amp;gt; Accessibility, and check 'Replace Document Colors'.
Select 'Custom Colors'. Then specify the colors for 'Page Background' and 'Document Text'
I recommend &lt;code&gt;#151718&lt;/code&gt; and &lt;code&gt;#bdbdbc&lt;/code&gt;, respectively.
Now you can switch between light and dark modes by simply
toggling the 'Replace Document Colors' checkbox.&lt;/p&gt;
&lt;p&gt;The above would have been a very satisfactory solution if Acrobat Reader was an otherwise good PDF reader.
Moreover, colored text is still not handled well in this solution.
I often read LaTeX-generated PDFs, where the colors of citations and links are specified using
&lt;code&gt;linkcolor&lt;/code&gt;, &lt;code&gt;citecolor&lt;/code&gt;, &lt;code&gt;urlcolor&lt;/code&gt; in &lt;code&gt;\hypersetup&lt;/code&gt;.
Most papers use dark or fully-saturated colors here, which are fine for light mode but not for dark mode.&lt;/p&gt;
&lt;p&gt;For PDFs that I write in LaTeX, I just generate them in dark mode.
See &lt;a href="https://github.com/sharmaeklavya2/tex-colorscheme/"&gt;&lt;code&gt;colorscheme.tex&lt;/code&gt;&lt;/a&gt;
for TeX macros I wrote for this and how to use them.&lt;/p&gt;
&lt;p&gt;ArXiv fortunately lets us download the TeX source of papers.
I can build those papers in dark mode by adding &lt;code&gt;\input{colorscheme.tex}&lt;/code&gt;
and changing the colors used in &lt;code&gt;\hypersetup&lt;/code&gt;.
I wrote a Python script to automate this:
&lt;a href="https://github.com/sharmaeklavya2/from-arxiv"&gt;&lt;code&gt;from-arxiv.py&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="terminal"&gt;Terminal&lt;a class="headerlink" href="#terminal" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I use &lt;a href="https://iterm2.com/"&gt;iTerm2&lt;/a&gt;, which automatically switches the terminal colors based on the system theme.
My &lt;code&gt;.vimrc&lt;/code&gt; tries to detect the system theme and set vim's &lt;code&gt;background&lt;/code&gt; accordingly.
See my &lt;a href="https://github.com/sharmaeklavya2"&gt;dotfiles&lt;/a&gt; for more info.&lt;/p&gt;</content><category term="customize"/></entry><entry><title>A Comprehensive Guide to Customizing your MacBook</title><link href="https://sharmaeklavya2.github.io/blog/customize-macos.html" rel="alternate"/><published>2019-07-12T00:00:00+05:30</published><updated>2025-12-15T00:00:00+05:30</updated><author><name/></author><id>tag:sharmaeklavya2.github.io,2019-07-12:/blog/customize-macos.html</id><summary type="html">&lt;p&gt;This post contains a list of all the things I did to customize my MacBook. Most instructions here are useful only for programmers and power users.&lt;/p&gt;</summary><content type="html">&lt;p&gt;I recently got a new laptop - a MacBook Air (M4 2025)!
I customized it so that it's easy for me to use.
Major changes include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Moving data from my old laptop to my new laptop.&lt;/li&gt;
&lt;li&gt;Installing and configuring software for basic necessities, programming, and writing content.&lt;/li&gt;
&lt;li&gt;Setting up a nice environment on my &lt;a href="https://en.wikipedia.org/wiki/Terminal_emulator"&gt;terminal&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As I made all these changes to my new laptop, I noted down the steps that I took for future reference.
I think they could be useful to others, so here they are, as a blog post.&lt;/p&gt;
&lt;p&gt;This post is written for macOS Tahoe.
You may have to modify some instructions if you're using a newer macOS.
If you're not using macOS, you can still get a similar working environment on Linux,
but you'll have to make major modifications to the instructions below.&lt;/p&gt;
&lt;p&gt;You can also refer to this &lt;a href="https://sharmaeklavya2.github.io/blog/img/macos-customize-graph.dot.svg"&gt;dependency graph&lt;/a&gt;
(&lt;a href="https://sharmaeklavya2.github.io/blog/img/macos-customize-graph.dot"&gt;source code&lt;/a&gt;).&lt;/p&gt;
&lt;div class="toc"&gt;&lt;span class="toctitle"&gt;Table of Contents&lt;/span&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#basic-setup"&gt;Basic setup&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#system-preferences"&gt;System Preferences&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#finder-preferences"&gt;Finder preferences&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#install-google-chrome-andor-firefox"&gt;Install Google Chrome and/or Firefox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#textedit-preferences"&gt;TextEdit preferences&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#terminal-and-shell"&gt;Terminal and Shell&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#terminal-preferences"&gt;Terminal preferences&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#installing-xcode-command-line-tools"&gt;Installing Xcode command-line tools&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#dotfiles"&gt;Dotfiles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#install-homebrew"&gt;Install Homebrew&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#install-tmux"&gt;Install tmux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#install-newer-bash"&gt;Install newer bash&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#set-up-cron"&gt;Set up cron&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#install-command-line-programs"&gt;Install command-line programs&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#mactex"&gt;MacTex&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#python-and-packages"&gt;Python and packages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#other-useful-programs"&gt;Other useful programs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#transfer-backed-up-data"&gt;Transfer backed-up data&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#reorganizing-data-and-backup"&gt;Reorganizing data and backup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#filesystem-issues"&gt;Filesystem issues&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#install-dropbox-and-use-symlinks"&gt;Install Dropbox and use symlinks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#clone-git-repositories"&gt;Clone git repositories&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#customize-vim"&gt;Customize Vim&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#install-newer-vim"&gt;Install newer Vim&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#detecting-dark-mode"&gt;Detecting dark mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#get-vim-plugins"&gt;Get Vim plugins&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#autocomplete-using-coc"&gt;Autocomplete using CoC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#compatibility-with-older-systems"&gt;Compatibility with Older Systems&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#install-nginx-and-serve-website-mirrors"&gt;Install Nginx and serve website mirrors&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#install-and-run-nginx"&gt;Install and run Nginx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#enable-nginx-autoindex"&gt;Enable nginx autoindex&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#serve-my-websites-with-nginx"&gt;Serve my websites with Nginx&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#security"&gt;Security&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h2 id="basic-setup"&gt;Basic setup&lt;a class="headerlink" href="#basic-setup" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Connect to a WiFi network&lt;/strong&gt;, since we'll be downloading a lot of stuff.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sign into iCloud&lt;/strong&gt;. Create an account if you don't have one.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Remove useless apps from dock&lt;/strong&gt;: right-click on the app in the dock, go to Options and click 'Remove from Dock'.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="system-preferences"&gt;System Preferences&lt;a class="headerlink" href="#system-preferences" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Click the Apple logo in the top-left corner of your screen and choose 'System Settings'.
Here you can customize most aspects of your operating system.
If you have the time, go through each of the items and choose the options which make sense to you.
These are the changes which I made:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;General &amp;gt; Software Update: update the OS.&lt;/li&gt;
&lt;li&gt;Appearance: Use dark theme.&lt;/li&gt;
&lt;li&gt;General &amp;gt; About: change 'Name'.&lt;/li&gt;
&lt;li&gt;General &amp;gt; Storage: empty trash automatically.&lt;/li&gt;
&lt;li&gt;General &amp;gt; Date and Time: select 24-hour time.&lt;/li&gt;
&lt;li&gt;General &amp;gt; Language and Region: customize language and units.&lt;/li&gt;
&lt;li&gt;General &amp;gt; Sharing:&lt;ul&gt;
&lt;li&gt;Update local hostname.&lt;/li&gt;
&lt;li&gt;Allow remote login via SSH.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Apple Intelligence and Siri: turn off.&lt;/li&gt;
&lt;li&gt;Privacy and Security: Turn off FileVault.&lt;/li&gt;
&lt;li&gt;Control Center:&lt;ul&gt;
&lt;li&gt;Pick things that should show up in menu bar.&lt;/li&gt;
&lt;li&gt;Show battery percentage.&lt;/li&gt;
&lt;li&gt;Clock options: show seconds and date.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Desktop and Dock:&lt;ul&gt;
&lt;li&gt;Position on screen: left.&lt;/li&gt;
&lt;li&gt;Uncheck 'show suggested and recent apps in Dock'.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Menu Bar: Set 'Automatically hide and show the menu bar' to 'Never'.
    (This way I can see battery level, internet connectivity, volume, time, etc. in full-screen windows.)&lt;/li&gt;
&lt;li&gt;Display: Choose the larger size.&lt;/li&gt;
&lt;li&gt;Sound: select 'play feedback when volume is changed'.&lt;/li&gt;
&lt;li&gt;Lock screen:&lt;ul&gt;
&lt;li&gt;Customize screen lock and display off timings.&lt;/li&gt;
&lt;li&gt;Show 24-hour time.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;iCloud: turn off iCloud syncing for all items.&lt;/li&gt;
&lt;li&gt;Keyboard &amp;gt; Input Sources &amp;gt; Edit:&lt;ul&gt;
&lt;li&gt;Show input menu in menu bar.&lt;/li&gt;
&lt;li&gt;Add other languages that I can type in: Greek, Hindi, Telugu, Kannada.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="finder-preferences"&gt;Finder preferences&lt;a class="headerlink" href="#finder-preferences" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Finder is the file manager in macOS.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Finder preferences (&lt;code&gt;Cmd + ,&lt;/code&gt;):&lt;ul&gt;
&lt;li&gt;General: Show hard disk and connected servers on desktop.&lt;/li&gt;
&lt;li&gt;Tags: Don't show any.&lt;/li&gt;
&lt;li&gt;Sidebar: Select useful locations.&lt;/li&gt;
&lt;li&gt;Advanced:&lt;ul&gt;
&lt;li&gt;Show all filename extensions.&lt;/li&gt;
&lt;li&gt;Keep folders on top in windows.&lt;/li&gt;
&lt;li&gt;Search current folder when performing a search.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Open home directory in Finder and then press &lt;code&gt;Cmd + J&lt;/code&gt; to show view options.
    Select the options you like and press 'Use as Defaults'.&lt;/li&gt;
&lt;li&gt;Go to 'View' in Finder's menu bar:&lt;ul&gt;
&lt;li&gt;Show path bar.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Press &lt;code&gt;Cmd + Shift + .&lt;/code&gt; to enable viewing hidden files.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="install-google-chrome-andor-firefox"&gt;Install Google Chrome and/or Firefox&lt;a class="headerlink" href="#install-google-chrome-andor-firefox" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Sync profile to get bookmarks and extensions.&lt;/li&gt;
&lt;li&gt;Make it the default browser.&lt;/li&gt;
&lt;li&gt;Perhaps also look at Safari settings just in case.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="textedit-preferences"&gt;TextEdit preferences&lt;a class="headerlink" href="#textedit-preferences" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;TextEdit is the default plain-text and rich-text editor bundled with macOS.&lt;/p&gt;
&lt;p&gt;I usually use &lt;a href="https://en.wikipedia.org/wiki/Vim_(text_editor)"&gt;Vim&lt;/a&gt; for text editing.
Vim is far superior to TextEdit in terms of advanced functionality,
like customizability, syntax highlighting, find-and-replace, etc.
But having a lightweight GUI text editor can be handy.&lt;/p&gt;
&lt;p&gt;TextEdit preferences (&lt;code&gt;Cmd + ,&lt;/code&gt;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Format: plain text. This is needed to prevent new instances of TextEdit from opening a rich-text editor.&lt;/li&gt;
&lt;li&gt;Font: Menlo, size 16.&lt;/li&gt;
&lt;li&gt;Disable 'Correct spelling automatically'.&lt;/li&gt;
&lt;li&gt;Display HTML files as HTML code.&lt;/li&gt;
&lt;li&gt;Disable 'add .txt extension to plain text files'. This is needed if you have to edit extensionless files.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="terminal-and-shell"&gt;&lt;span style="background-color: rgba(255, 204, 0, 0.3)"/&gt;Terminal and Shell&lt;/span&gt;&lt;a class="headerlink" href="#terminal-and-shell" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;If you're an aspiring programmer or power user, you should get to know the command-line.
For this blog post, I'm going to assume that you know how to run commands from the shell and
you know the meaning of the following words:
terminal emulator, shell, prompt, home directory, current working directory.
In case you don't, here's a nice short tutorial by TreeHouse:
&lt;a href="https://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line"&gt;Introduction to the Mac OS X Command Line&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="terminal-preferences"&gt;Terminal preferences&lt;a class="headerlink" href="#terminal-preferences" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Terminal.app is the default terminal emulator on macOS.
But I recommend a better alternative, like &lt;a href="https://www.iterm2.com/features.html"&gt;iTerm2&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In iTerm2, I went to Settings &amp;gt; Profiles, and created a new profile and made it default
(so as to not modify the factory default).
In Colors, I chose 'Regular' as the Color Preset and unchecked 'use bright version of ANSI colors for bold text'.&lt;/p&gt;
&lt;p&gt;In iTerm2, you may want to configure &lt;kbd&gt;Option&lt;/kbd&gt; + arrow keys to move over words,
just like in Terminal.app. To do this, go to Settings &amp;gt; Profiles &amp;gt; Keys &amp;gt; Key Mappings,
and select 'Terminal.app Compatibility' as the preset.&lt;/p&gt;
&lt;p&gt;If you decide to stick to Terminal.app, that's also not a bad option.
In Terminal.app, you may want to deselect 'restore text when reopening windows'
in the 'Preferences &amp;gt; Profile &amp;gt; Window' tab in Terminal.app.&lt;/p&gt;
&lt;h3 id="installing-xcode-command-line-tools"&gt;Installing &lt;a href="http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/"&gt;Xcode command-line tools&lt;/a&gt;&lt;a class="headerlink" href="#installing-xcode-command-line-tools" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The 'Xcode command-line tools' consist of command-line applications that are
very common in Unix-like environments, like &lt;code&gt;git&lt;/code&gt;, &lt;code&gt;gcc&lt;/code&gt;, &lt;code&gt;make&lt;/code&gt;, &lt;code&gt;perl&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Run &lt;code&gt;xcode-select --install&lt;/code&gt; from a terminal.
A dialog box will pop up. Select install.
You should probably connect to a power source before doing this
because macOS is going to suggest you do so.&lt;/p&gt;
&lt;h3 id="dotfiles"&gt;Dotfiles&lt;a class="headerlink" href="#dotfiles" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Dotfiles colloquially refers to configuration files placed in the home directory.
These files' names start with a dot (&lt;code&gt;.&lt;/code&gt;).
Common examples are &lt;code&gt;.zshrc&lt;/code&gt;, &lt;code&gt;.vimrc&lt;/code&gt; and &lt;code&gt;.gitconfig&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I have put all my dotfiles in a GitHub repository at
&lt;a href="https://github.com/sharmaeklavya2/dotfiles"&gt;&lt;code&gt;sharmaeklavya2/dotfiles&lt;/code&gt;&lt;/a&gt;.
You can find detailed instructions for setting them up in the repository's readme.
Here is a brief version:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;git clone https://github.com/sharmaeklavya2/dotfiles.git
cd dotfiles
python3 scripts/make_links.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now either restart your terminal or run &lt;code&gt;source ~/.zshrc&lt;/code&gt;.
If you executed the above instructions correctly,
the first thing you'll notice is the improved, colorful prompt.&lt;/p&gt;
&lt;p&gt;Environment variables that I don't want version-controlled with my dotfiles go in &lt;code&gt;~/.env&lt;/code&gt;.
This file is sourced in &lt;code&gt;.zshrc&lt;/code&gt; and &lt;code&gt;.bashrc&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="install-homebrew"&gt;Install &lt;a href="https://brew.sh/"&gt;Homebrew&lt;/a&gt;&lt;a class="headerlink" href="#install-homebrew" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Homebrew (a.k.a. brew) is a package manager, which means it's like a terminal version of the App Store.
You can install programs (called packages by brew) by simply writing commands on the terminal:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;brew install name-of-package
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;See &lt;a href="https://brew.sh/"&gt;brew's website&lt;/a&gt; for installation instructions.&lt;/p&gt;
&lt;p&gt;Brew will check for updates every time you run it.
To prevent that from happening, add &lt;code&gt;export HOMEBREW_NO_AUTO_UPDATE=1&lt;/code&gt; to &lt;code&gt;~/.env&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="install-tmux"&gt;Install &lt;a href="https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/"&gt;tmux&lt;/a&gt;&lt;a class="headerlink" href="#install-tmux" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I usually need multiple shells to be open.
I can use iTerm's or Terminal.app's 'tabs' (&lt;code&gt;Cmd + T&lt;/code&gt;) to achieve this.
But I use tmux instead since it has more features.
Also, if you SSH to a server that has tmux installed,
you can open multiple shells on the server on a single SSH session.&lt;/p&gt;
&lt;p&gt;To install, run &lt;code&gt;brew install tmux&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="install-newer-bash"&gt;Install newer bash&lt;a class="headerlink" href="#install-newer-bash" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The version of &lt;code&gt;bash&lt;/code&gt; that ships with macOS is very old.
Run &lt;code&gt;brew install bash&lt;/code&gt; to install a newer version of bash.
This is helpful to check the compatibility of shell scripts between zsh and bash.
When working on remote computers, I may not have zsh available.&lt;/p&gt;
&lt;h3 id="set-up-cron"&gt;Set up cron&lt;a class="headerlink" href="#set-up-cron" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Cron"&gt;Cron&lt;/a&gt; is a service that allows us to
run a program (job) periodically, e.g., every two minutes.
The jobs and their frequencies are specified in a file called &lt;code&gt;crontab&lt;/code&gt;.
Run &lt;code&gt;crontab -e&lt;/code&gt; to edit your crontab in a terminal text editor.&lt;/p&gt;
&lt;p&gt;If your cron jobs fail, you'll get 'mail' in &lt;code&gt;/var/mail/$USER&lt;/code&gt;.
You can view it by simply opening &lt;code&gt;/var/mail/$USER&lt;/code&gt; in a text editor,
and you can delete the file's contents to empty your inbox.&lt;/p&gt;
&lt;p&gt;If your cron job requires reading files in protected directories,
you'll have to give &lt;code&gt;/usr/sbin/cron&lt;/code&gt; full-disk access.
See &lt;a href="https://apple.stackexchange.com/a/378558"&gt;https://apple.stackexchange.com/a/378558&lt;/a&gt; for details.&lt;/p&gt;
&lt;h2 id="install-command-line-programs"&gt;&lt;span style="background-color: rgba(0, 255, 102, 0.3)"&gt;Install command-line programs&lt;/span&gt;&lt;a class="headerlink" href="#install-command-line-programs" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="mactex"&gt;MacTex&lt;a class="headerlink" href="#mactex" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;MacTex is a suite of programs for typesetting documents using TeX and LaTeX.
LaTeX is a great system for writing professional-looking mathematical documents.&lt;/p&gt;
&lt;p&gt;You can install MacTex using a GUI installer, but I did it using &lt;code&gt;brew install --cask mactex&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="python-and-packages"&gt;Python and packages&lt;a class="headerlink" href="#python-and-packages" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;macOS comes pre-installed with Python 3 (and doesn't have Python 2 installed),
but it may not be the latest version.&lt;/p&gt;
&lt;p&gt;Run &lt;code&gt;brew install python3&lt;/code&gt;. That will install &lt;code&gt;python3&lt;/code&gt; and &lt;a href="https://pip.pypa.io/en/stable/"&gt;&lt;code&gt;pip3&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I use &lt;a href="https://docs.python.org/3/tutorial/venv.html"&gt;python virtual environments&lt;/a&gt;.
I use one big virtualenv where I install all commonly used packages,
and I sometimes create application-specific virtualenvs.&lt;/p&gt;
&lt;p&gt;Run &lt;code&gt;python3 -m venv /path/to/venv/&lt;/code&gt; to create a python3 virtualenv.&lt;/p&gt;
&lt;p&gt;Activate the virtualenv using &lt;code&gt;source /path/to/venv/bin/activate&lt;/code&gt;.
Now all python commands and applications you run will use this virtualenv.&lt;/p&gt;
&lt;p&gt;I usually install python packages only when required,
but some are useful enough that I installed them in the beginning:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;pip install requests jinja2 markdown pipdeptree flake8 grip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;These packages are useful for math and computation:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;pip install numpy scipy pandas matplotlib
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="other-useful-programs"&gt;Other useful programs&lt;a class="headerlink" href="#other-useful-programs" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Although git is provided by the Xcode command line tools,
a more recent version can be obtained using &lt;code&gt;brew install git&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;To be able to write and run Java programs, install &lt;code&gt;openjdk&lt;/code&gt;: &lt;code&gt;brew install openjdk&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Node.js and npm: &lt;code&gt;brew install node&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Other useful programs that can be &lt;code&gt;brew install&lt;/code&gt;ed:
&lt;a href="https://dandavison.github.io/delta/introduction.html"&gt;&lt;code&gt;delta&lt;/code&gt;&lt;/a&gt;,
&lt;a href="https://github.com/mookid/diffr/"&gt;&lt;code&gt;diffr&lt;/code&gt;&lt;/a&gt;,
&lt;a href="https://graphviz.org"&gt;&lt;code&gt;graphviz&lt;/code&gt;&lt;/a&gt;,
&lt;a href="https://ffmpeg.org"&gt;&lt;code&gt;ffmpeg&lt;/code&gt;&lt;/a&gt;,
&lt;a href="https://pandoc.org"&gt;&lt;code&gt;pandoc&lt;/code&gt;&lt;/a&gt;,
&lt;a href="https://linux.die.net/man/1/dos2unix"&gt;&lt;code&gt;dos2unix&lt;/code&gt;&lt;/a&gt;,
&lt;a href="https://en.wikipedia.org/wiki/Htop"&gt;&lt;code&gt;htop&lt;/code&gt;&lt;/a&gt;,
&lt;a href="https://github.com/hanslub42/rlwrap/"&gt;&lt;code&gt;rlwrap&lt;/code&gt;&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Install &lt;a href="https://github.com/yt-dlp/yt-dlp"&gt;&lt;code&gt;yt-dlp&lt;/code&gt;&lt;/a&gt; by first installing &lt;code&gt;node&lt;/code&gt;,
  and then running &lt;code&gt;pip install "yt-dlp[default,curl-cffi]" yt-dlp-ejs&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="transfer-backed-up-data"&gt;&lt;span style="background-color: rgba(0, 136, 255, 0.3)"&gt;Transfer backed-up data&lt;/span&gt;&lt;a class="headerlink" href="#transfer-backed-up-data" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="reorganizing-data-and-backup"&gt;Reorganizing data and backup&lt;a class="headerlink" href="#reorganizing-data-and-backup" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;There are many places where I store my files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;My laptop's SSD (which is small enough for all my files to not fit on it).&lt;/li&gt;
&lt;li&gt;My external hard disk.&lt;/li&gt;
&lt;li&gt;My &lt;a href="https://www.dropbox.com/"&gt;Dropbox&lt;/a&gt; account.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/sharmaeklavya2"&gt;My GitHub repositories&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;My Android phone.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Some of my files are stored on more than one of the above locations.
To keep the copies in sync and avoid losing changes,
I organized my stuff into folders based on the kind of content and access patterns
and demarcated which folders will be on which storage mediums.&lt;/p&gt;
&lt;p&gt;Fortunately, my content that changes frequently is lightweight (code, documents),
and heavier content (videos, music, books) changes less frequently,
so the former is either in git repositories or synced in real-time to Dropbox,
and I keep copies of the latter on my hard disk.&lt;/p&gt;
&lt;p&gt;If you use git, make sure to push all unpushed code on your old computer
to an online remote to avoid losing data.&lt;/p&gt;
&lt;h3 id="filesystem-issues"&gt;Filesystem issues&lt;a class="headerlink" href="#filesystem-issues" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;My external hard disk used to be NTFS-formatted.
macOS cannot write to NTFS drives; it can only read from them.
So I had two options:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Copy the data elsewhere, reformat the external disk to exFAT, and then copy data back to the hard disk.
    This is what I ended up doing.&lt;/li&gt;
&lt;li&gt;Install an NTFS driver: I don't like this option because:&lt;ol&gt;
&lt;li&gt;Installing NTFS drivers requires &lt;a href="https://support.apple.com/guide/mac-help/change-security-settings-startup-disk-a-mac-mchl768f7291/mac"&gt;reducing the system security level&lt;/a&gt; by booting into recovery mode.&lt;/li&gt;
&lt;li&gt;Open-source drivers are problematic (require mounting/unmounting via command-line)
    and closed-source drivers cost money (but some hard-disk manufacturers can get you free access to
    &lt;a href="https://www.paragon-software.com/home/ntfs-mac/"&gt;Paragon&lt;/a&gt; drivers if you're using their disk.)&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="install-dropbox-and-use-symlinks"&gt;Install Dropbox and use symlinks&lt;a class="headerlink" href="#install-dropbox-and-use-symlinks" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I installed &lt;a href="https://www.dropbox.com/install"&gt;Dropbox's desktop app&lt;/a&gt; on my new laptop.
This app creates a directory at &lt;code&gt;~/Dropbox&lt;/code&gt; and downloads all your online content into it.
Anything you put in this directory will get synced to your online account.&lt;/p&gt;
&lt;p&gt;In Preferences &amp;gt; Sync, I changed the default sync preference from 'online only' to 'available offline'.&lt;/p&gt;
&lt;p&gt;Apparently, &lt;a href="http://www.paulingraham.com/dropbox-and-symlinks.html"&gt;Dropbox doesn't allow external symlinks&lt;/a&gt;,
so instead of having files outside and their symlinks inside Dropbox,
I have files inside Dropbox and symlinks to them outside.&lt;/p&gt;
&lt;h3 id="clone-git-repositories"&gt;Clone git repositories&lt;a class="headerlink" href="#clone-git-repositories" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I have git repositories on github.com, gist.github.com, and overleaf.com.
For private repositories, and when I push to repositories, I need to provide credentials to the git remote.
It used to be easier many years ago, when the credentials were username and password.
But these days github and overleaf use tokens. You can either generate new tokens
(instructions for &lt;a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens"&gt;GitHub&lt;/a&gt; and &lt;a href="https://docs.overleaf.com/integrations-and-add-ons/git-integration-and-github-synchronization/git-integration/git-integration-authentication-tokens"&gt;Overleaf&lt;/a&gt;),
or if you have an older macbook already, you'll find your tokens in the 'Keychain Access' application.&lt;/p&gt;
&lt;h2 id="customize-vim"&gt;&lt;span style="background-color: rgba(255, 0, 0, 0.3)"&gt;Customize Vim&lt;/span&gt;&lt;a class="headerlink" href="#customize-vim" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="install-newer-vim"&gt;Install newer Vim&lt;a class="headerlink" href="#install-newer-vim" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Although macOS comes with &lt;code&gt;vim&lt;/code&gt; pre-installed, that version of Vim was compiled without some important features.
You can see which features are installed by running &lt;code&gt;vim --version&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Run &lt;code&gt;brew install vim&lt;/code&gt; to install a newer, better Vim.
Alternatively, you can install MacVim (&lt;code&gt;brew install macvim&lt;/code&gt;).
These will not replace the old vim; the old vim can still be accessed at &lt;code&gt;/usr/bin/vim&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="detecting-dark-mode"&gt;Detecting dark mode&lt;a class="headerlink" href="#detecting-dark-mode" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;My &lt;code&gt;.vimrc&lt;/code&gt; tries to detect whether the OS is using dark mode,
and then sets dark mode in vim (&lt;code&gt;set background=dark&lt;/code&gt;) accordingly.
To do this detection, it uses the
&lt;a href="https://github.com/albertosottile/darkdetect"&gt;&lt;code&gt;darkdetect&lt;/code&gt;&lt;/a&gt; python module.
If this module is not installed, &lt;code&gt;.vimrc&lt;/code&gt; falls back to using dark mode in vim.&lt;/p&gt;
&lt;p&gt;I have installed &lt;code&gt;darkdetect&lt;/code&gt; in a virtualenv,
and I activate it whenever I want detection to work in my &lt;code&gt;.vimrc&lt;/code&gt;.
Moreover, if you change the system's dark/light mode while vim is running,
you would have to either restart vim, or run &lt;code&gt;:call SetBackground()&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="get-vim-plugins"&gt;Get Vim plugins&lt;a class="headerlink" href="#get-vim-plugins" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Go to &lt;code&gt;~/.vim/pack/default/start&lt;/code&gt; (create this directory if it doesn't exist)
and clone the git repositories of the plugins you need.
You can see the list of plugins that I use at
&lt;a href="https://github.com/sharmaeklavya2/dotfiles/blob/master/vimpackages.txt"&gt;&lt;code&gt;vimpackages.txt&lt;/code&gt;&lt;/a&gt; in my dotfiles.
If you're using my dotfiles, you can run &lt;code&gt;./scripts/get_vim_packages.py&lt;/code&gt;.
This will download and install the vim plugins from &lt;code&gt;vimpackages.txt&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Most plugins will be ready to use as soon as you clone their repositories
(remember to restart vim for the plugins to be loaded).
The only exception in &lt;code&gt;vimpackages.txt&lt;/code&gt; is &lt;code&gt;coc.nvim&lt;/code&gt;, for which you must run&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;cd ~/.vim/pack/default/start/coc.nvim
npm ci
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="autocomplete-using-coc"&gt;Autocomplete using CoC&lt;a class="headerlink" href="#autocomplete-using-coc" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I use &lt;a href="github.com/neoclide/coc.nvim"&gt;&lt;code&gt;coc.nvim&lt;/code&gt;&lt;/a&gt; for code auto-completion.
You can view the key-mappings in &lt;code&gt;.vimrc&lt;/code&gt;.
&lt;code&gt;coc.nvim&lt;/code&gt; comes with basic auto-complete, but for intelligent language-specific auto-complete, we need to
&lt;a href="https://github.com/neoclide/coc.nvim/wiki/Using-coc-extensions#install-extensions"&gt;install extensions&lt;/a&gt;
for those languages. E.g., for typescript and python, we need the &lt;code&gt;tsserver&lt;/code&gt; and &lt;code&gt;pyright&lt;/code&gt; extensions,
which can be installed by running the following in vim:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;:CocInstall coc-tsserver coc-pyright
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;I'm using these extensions:
&lt;code&gt;coc-clangd&lt;/code&gt;, &lt;code&gt;coc-css&lt;/code&gt;, &lt;code&gt;coc-html&lt;/code&gt;, &lt;code&gt;coc-htmldjango&lt;/code&gt;, &lt;code&gt;coc-json&lt;/code&gt;, &lt;code&gt;coc-pyright&lt;/code&gt;, &lt;code&gt;coc-texlab&lt;/code&gt;, &lt;code&gt;coc-tsserver&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id="compatibility-with-older-systems"&gt;Compatibility with Older Systems&lt;a class="headerlink" href="#compatibility-with-older-systems" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I may want to use vim with my &lt;code&gt;.vimrc&lt;/code&gt; on other computers, where vim may have fewer features and no plugins.
Hence, I have used feature detection extensively in my &lt;code&gt;.vimrc&lt;/code&gt; using &lt;code&gt;has&lt;/code&gt; and &lt;code&gt;exists&lt;/code&gt;.
I tested my &lt;code&gt;.vimrc&lt;/code&gt; on &lt;code&gt;vim.tiny&lt;/code&gt; on Debian using &lt;a href="https://www.docker.com/"&gt;Docker&lt;/a&gt;.
Here are the steps for doing so.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install Docker: either &lt;a href="https://www.docker.com/get-started/"&gt;manually&lt;/a&gt;,
    or using &lt;code&gt;brew install --cask docker&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Run the docker GUI application and follow the setup instructions. This starts the docker service.&lt;/li&gt;
&lt;li&gt;In terminal, run &lt;code&gt;docker run -it -v ~/.vimrc:/root/.vimrc:ro debian:stable-slim bash&lt;/code&gt;. This&lt;ol&gt;
&lt;li&gt;Pulls the &lt;code&gt;docker:stable-slim&lt;/code&gt; image from &lt;a href="https://hub.docker.com"&gt;Docker Hub&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Starts a container with &lt;code&gt;~/.vimrc&lt;/code&gt; mounted to &lt;code&gt;/root/.vimrc&lt;/code&gt; in read-only mode (&lt;code&gt;ro&lt;/code&gt;).
    This ensures that any changes to &lt;code&gt;~/.vimrc&lt;/code&gt; show up in &lt;code&gt;/root/.vimrc&lt;/code&gt; on the container,
    but the container cannot modify the &lt;code&gt;~/.vimrc&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Runs &lt;code&gt;bash&lt;/code&gt; in an interactive TTY (&lt;code&gt;-it&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;Now a different command-line prompt will appear, since we're inside &lt;code&gt;bash&lt;/code&gt; in the container.&lt;/li&gt;
&lt;li&gt;We must now install &lt;code&gt;vim.tiny&lt;/code&gt;. To do so, run &lt;code&gt;apt update&lt;/code&gt; and then &lt;code&gt;apt install vim.tiny&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Now run &lt;code&gt;vim.tiny&lt;/code&gt; and see if any errors show up.
    You can run &lt;code&gt;vim.tiny --version&lt;/code&gt; to see what features are available.&lt;/li&gt;
&lt;/ol&gt;
&lt;!-- Fix locale errors by adding `export LC_ALL=en_US.UTF-8` to `~/.env`
([brew forum post](https://discourse.brew.sh/t/failed-to-set-locale-category-lc-numeric-to-en-ru/5092)). --&gt;

&lt;h2 id="install-nginx-and-serve-website-mirrors"&gt;&lt;span style="background-color: rgba(170, 0, 255, 0.3)"&gt;Install Nginx and serve website mirrors&lt;/span&gt;&lt;a class="headerlink" href="#install-nginx-and-serve-website-mirrors" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;I use &lt;a href="https://nginx.org/en/"&gt;Nginx&lt;/a&gt; to serve static content.
It's useful to access local websites that I downloaded or created.&lt;/p&gt;
&lt;h3 id="install-and-run-nginx"&gt;Install and run Nginx&lt;a class="headerlink" href="#install-and-run-nginx" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;brew install nginx
nginx
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now go to &lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt;. You should see a welcome page from Nginx.&lt;/p&gt;
&lt;h3 id="enable-nginx-autoindex"&gt;Enable nginx autoindex&lt;a class="headerlink" href="#enable-nginx-autoindex" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Go to &lt;code&gt;/opt/homebrew/etc/nginx/nginx.conf&lt;/code&gt; and
add &lt;code&gt;autoindex on;&lt;/code&gt; to '&lt;code&gt;http&lt;/code&gt; &amp;gt; &lt;code&gt;server&lt;/code&gt; &amp;gt; &lt;code&gt;location /&lt;/code&gt;'.
You may also wish to change the port from 8080 to something else by changing the &lt;code&gt;listen&lt;/code&gt; value.&lt;/p&gt;
&lt;p&gt;Then rename &lt;code&gt;/opt/homebrew/var/www/index.html&lt;/code&gt; to &lt;code&gt;/opt/homebrew/var/www/index.html~&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;After making these changes, run &lt;code&gt;nginx -s reload&lt;/code&gt; for the changes to take effect.&lt;/p&gt;
&lt;p&gt;Visit &lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt; again. Now instead of seeing the welcome page,
you should see the list of files in &lt;code&gt;/opt/homebrew/var/www&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Optionally, if you want the index page to look pretty, you can
use the &lt;a href="https://github.com/aperezdc/ngx-fancyindex"&gt;ngx-fancyindex&lt;/a&gt; module.
But it seemed a bit too difficult to configure.
So I use the following string-replacement hack to inject my own CSS:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Put &lt;code&gt;style.css&lt;/code&gt; at &lt;code&gt;/opt/homebrew/var/www/&lt;/code&gt;. You can put whatever CSS you want in &lt;code&gt;style.css&lt;/code&gt;.
    You can see my style file in &lt;a href="https://gist.github.com/sharmaeklavya2/e8808872c4acd462d6cccff4ffa994c9"&gt;this gist&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add this to '&lt;code&gt;http&lt;/code&gt; &amp;gt; &lt;code&gt;server&lt;/code&gt; &amp;gt; &lt;code&gt;location /&lt;/code&gt;' in &lt;code&gt;/opt/homebrew/etc/nginx/nginx.conf&lt;/code&gt;:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;    sub_filter &amp;#39;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Index of&amp;#39; &amp;#39;&amp;lt;head&amp;gt;
&amp;lt;meta name=&amp;quot;viewport&amp;quot; content=&amp;quot;width=device-width, initial-scale=1&amp;quot; /&amp;gt;
&amp;lt;meta name=&amp;quot;color-scheme&amp;quot; content=&amp;quot;light dark&amp;quot; /&amp;gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;/style.css&amp;quot; /&amp;gt;
&amp;lt;title&amp;gt;Index of&amp;#39;;
    sub_filter_once on;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id="serve-my-websites-with-nginx"&gt;Serve my websites with Nginx&lt;a class="headerlink" href="#serve-my-websites-with-nginx" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;I had backed up compressed archives of my websites to my external hard disk.
I copied the websites from there, uncompressed them, and placed them in &lt;code&gt;/opt/homebrew/var/www&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You can put symlinks in &lt;code&gt;/opt/homebrew/var/www&lt;/code&gt;, but &lt;code&gt;/opt/homebrew/var/www&lt;/code&gt; itself cannot be a symlink.&lt;/p&gt;
&lt;h3 id="security"&gt;Security&lt;a class="headerlink" href="#security" title="Permanent link"&gt;&amp;para;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Anyone on your network can see your files in &lt;code&gt;/opt/homebrew/var/www&lt;/code&gt;,
so you should be careful about what you put there to preserve your privacy.&lt;/p&gt;
&lt;p&gt;You can &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-nginx-on-ubuntu-14-04"&gt;set password authentication for Nginx&lt;/a&gt;,
but if someone is eavesdropping, they can
&lt;a href="https://en.wikipedia.org/wiki/Basic_access_authentication#Security"&gt;easily recover your password&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you want to prevent others on your network from accessing the http server,
you can restrict Nginx to work on &lt;code&gt;localhost&lt;/code&gt; only.
To do this, go to &lt;code&gt;/opt/homebrew/etc/nginx/nginx.conf&lt;/code&gt; and
change &lt;code&gt;listen 8080;&lt;/code&gt; to &lt;code&gt;listen localhost:8080;&lt;/code&gt;.
This is somewhat secure, but not secure against a talented attacker
(see &lt;a href="https://security.stackexchange.com/q/86773"&gt;https://security.stackexchange.com/q/86773&lt;/a&gt;).&lt;/p&gt;</content><category term="customize"/></entry></feed>