Parts of a “minimal” vimrc

What makes a minimal vimrc?

My opinion of a “minimal” vimrc might be different from yours, but for me, it means

  1. Not using external plugins
  2. < ~100 lines
  3. Reducing vi related pain-points

So here’s what I do:

Source default settings

While this may not be necessary most of the time, it is still worth it to check that it has been sourced IME. It is a small fine to pay for ensuring you have the defaults you deserve.

These are some thoughts about my personal experience with learning a new programming environment like shell scripting (but this applies to almost any new environment). This is mainly based off mistakes and pitfalls I’ve fallen into in the past, so this post will be pretty cathartic, but perhaps it could be help someone out there.

5 Tips

  1. Don’t try to memorize every command, every API, every function, etc. Learn enough to become functional in the environment. Build something and move on.
  2. Think twice about what you’re trying to accomplish before considering tools.
  3. Have a structured process for getting help and use it frequently.
  4. Realize that commands/interfaces have different design goals and that’s OK!
  5. Know when a command/library/framework doesn’t mesh with the problem you’re trying to solve.

Let me elaborate on these points a little bit.

I recently learned about a project called spicetify that allows you to customize the theme of your Spotify client and I thought I would share.

Installing it is a few commands on all platforms and people have already made tons of themes and extensions.

Example

This is what my Spotify looks like with the “Spicy” theme:

theme_pic

Configuration

Customizations are stored in a config file located at:

  • Windows: %USERPROFILE%\.spicetify\config.ini
  • Linux: ~/.config/spicetify/config.ini
  • MacOS: ~/spicetify_data/config.ini

Themes

To get themes, you can clone the community themes repo and copy them to these directories

I’ve been trying to get used to PowerShell for a little while now and while it is difficult to adjust coming from other shells, there are some modules I have installed that make it much less of a pain.

Modules are really core to what makes PowerShell extensible and you can read more about them here but they work similar to other OOP languages and just like other interpreted scripting languages, loading too many modules will slow down performance.

Windows Package Managers

Using Linux has spoiled me when it comes to easily installing software. The fact that there is a default package manager for every distro can be taken for granted sometimes. There are lots of open source, community driven package managers for proprietary systems as well.

Mac users boast homebrew, as their de facto package manager, but what about Windows? Well I’ll tell you – Windows has had a few package managers over the years.

Chrome

  1. Open chrome and go type chrome://flags in the address bar.

  2. Search for “video decode”

  3. Change “Hardware-accelerated video decode” from “Disabled” to “Enabled”

chrome_scrnshot

Another way to enable these flag features is creating a config file called ~/.config/chrome-flags.conf for chrome or ~/.config/chromium-flags.conf for chromium.

For example here is mine:

~ $ cat ~/.config/chromium-flags.conf
--ignore-gpu-blocklist
--disable-gpu-driver-workarounds
--enable-gpu-rasterization
--enable-accelerated-video-decode

Firefox

  1. Open Firefox and type about:config in the address bar.

  2. Click “Accept the Risk and Continue” (don’t worry the risk here is very minimal)

Chromium_Icon

The Chromium Development Documentation Project [1] / "The Chromium Authors" as per the open source development agreement, CC BY 2.5, via Wikimedia Commons

Exposition

These days browsers can store a lot of user data on your local computer if you let them. They also urge you to create an account and login so that your browsing data + tons of other data can be synced to a server.

Path

Denis Zastanceanu, CC BY-SA 4.0, via Wikimedia Commons

Shell

Getting the current working directory

The environment variable $PWD and the command pwd are essentially synonymous. pwd has flags for dealing with symlinks.

Absolute (canonical) path

  • realpath - Turns relative paths into absolute paths
  • readlink -f - Originally meant to read symlinks. The -f flag means give “cannonical” path.

Elements of a directory

  • dirname - Strips the rightmost part from a given directory.
  • basename - Strips all base directories, leaving the last (rightmost) part of a path/file

NOTE: These commands do not check if a file/directory actually exists, they just manipulate path strings. Also, be careful when dealing with symbolic links and read the man page to get the desired behavior.

Getting the location of commands in Unix

Unix Shells

AFAIK, there are four ways to find out where a command is in your path.

Shell Builtins

  • command -v (POSIX shell way)

    • Shows the command that would be run by your shell (without actually running it)
  • type [-afptP] (bash builtin way)

    • Essentially the same function as command, but with more options

Both command and type can output the location of any executable, script, alias, or shell builtin in your $PATH and your shell environment.

Init Systems

The initial process that runs on a Unix/Linux system is responsible for forking the rest of the processes that are needed in order to “boot” the system. This is the core function of an init-system. It is effectively the first process where execution is handed off from the kernel to “userspace”, where processes get PIDs, cpu time and network/memory/disk access via calls to the kernel or kernel modules (drivers).