Macos Vim Color



My terminal emulator and shell setup for macOS, Linux, and Windows. AKA 'Ultimate Terminal Setup'

2020 update note: Follow me on Patreon to get updates when I build this into more of a video tutorial, which some have wanted me to call 'Shell Mastery' 😂

Terminal Emulator

The GUI that emulates a text terminal, and runs a shell

Syntax and Color scheme (MacOS terminal) question. Hi everyone, I'm really new to all of this, just started meddling with Vim because I find it really interesting. DinVim is a vim for Mac OS that supports syntax coloring out of the box. I advise you to install Neovim instead of the classic Vim. Neovim is a fork of Vim, developed in order to improve Vim. On macOS, just install it with Brew: brew install neovim Then, you can access it with the nvim command line. Or, you can create and add an alias to your.bashrc or.zshrc: alias vim='/usr/local/bin/nvim' 2. Install Vim-plug. 这里使用的配色方案是Solarized,Solarized 是目前最完整的 Terminal/Editor/IDE 配色项目,几乎覆盖所有主流操作系统(Mac OS X, Linux, Windows)、编辑器和 IDE(Vim, Emacs, Xcode, TextMate, NetBeans, Visual Studio 等),终端(iTerm2, Terminal.app, Putty 等)。.

  • macOS: iTerm2
  • Linux: Tilix
  • Windows 10: Windows Terminal
  • Windows 7/8: cmder

Shell and Prompt

Z shell (zsh) is my favorite. Here's how to make it awesome

Macos Vim Color
  • macOS: Now the default in 10.15+ at /bin/zsh or manually install a newer version with brew install zsh to /usr/local/bin/zsh. Default is fine in 99% of cases
  • Linux: If which zsh shows nothing, then install with apt/yum/apk. Next, change your login shell with chsh -s $(which zsh)
  • Windows 10: I recommend WSL/WSL2 with Ubuntu and zsh installed there, rather than a zsh.exe alternative
  • Zsh 'Configuration Manager':Oh-My-Zsh adds a bunch of bonus features and plugins to your shell. Check their GitHub wiki for more info and how to customize
  • Oh-My-Zsh has themes, which mostly affect the prompt features like git branch, current directory, etc. but also has colors you can tweak (see below)
  • Here's my custom Zsh prompt theme with 🐳 and 'presentation mode' option

Colors

I like having matching true-color themes in all my shell apps

  • GruvBox is my default for everything. I'm now using the community fork which is better maintained. It supports light and dark modes, as well as various contrast options. The contrib repo has the theme for different app formats, including iTerm2, SpaceVim, Tilix, and tmux.
  • True Color enabled in iTerm2, Zsh, and Vim. Also check the Gruvbox notes on true color
  • Assuming you're using Oh-My-Zsh above, you can replace the default theme in .zshrc env ZSH_THEME with this Gruvbox colored one, or just tweak the colors of the full theme list. This really only affects the prompt, not the terminal colors, which are controlled by your terminal emulator
  • INSANE Wild Cherry theme. I love this, but is it a daily theme? Not sure

Shell Editor

I prefer neovim (fork of vim), but any vim will do

  • Neovim (install info), which you run as nvim once installed
  • Plugin Manager:SpaceVim makes good feature-rich defaults (works with both vim/nvim). I love it and it's the only way I vim

Fonts

Some fonts are designed for shells and programming. I only use those

  • Nerd Fonts takes those popular programming fonts and adds extra glyphs and icons for better support in shell tools
  • I prefer using Homebrew to install those fonts on macOS and Linux. You can always just download one or all of them from Nerd Fonts and usually just dbl-clicking a font file in macOS or Windows will install it
  • One of my favorite fonts: Sauce Code Pro Font from Nerd Fonts which gives me Vim + Powerline + icons. That's all you need, but if you're curious: It's based off another mod to support this font with Powerline in VIM, which itself is based off the original Adobe Source Code Pro open source font. Whew, what a rabbit hole 😵
  • Italics enabled in iTerm/Vim. It makes comments easier to visualize I think

Other Essentials

Mac os vim colors
  • Tmux for shell session management (most of this stuff works in Tmux)
  • Oh-My-Tmux for much better default Tmux setup. It's great out-of-the-box
  • Mosh for better SSH that auto-reconnects and uses UDP for slow/laggy/lossy
  • SilverSearcher (ag from cli) for better shell code search
  • bat for color cat output of code and markdown (syntax highlighting)

Mac OS X ships with the vim editor, which supports syntax highlighting. By default, however, syntax highlighting is not turned on. Fortunately it is not hard to enable it.

Settings for vim are controlled by two files, one controlling settings globally and the other controlling settings for the user. /usr/share/vim/vimrc is the file that will control the global settings. changes made to this file will affect all users of the machine. On a new build of 10.9, here is what the file contains :

The file for controlling vim settings for the user is ~/.vimrc By default, this file does not exist. To turn on syntax highlighting, we can simply create a text file by that name and add this line :

vim will now use syntax highlighting the next time a file is opened. But what if you don’t care for the default color scheme? We can set the color scheme by adding a second line to the .vimrc file like so :

Macos

Mac Os Vim Colors

My favorite color scheme is desert, I find it works nice with my preferred Terminal color scheme (Homebrew). To see what color schemes ship with Mac OS, look at /usr/share/vim/vim73/colors The .vim files in this directory are the color schemes. Just try different ones by changing the .vimrc file and find the one you like best.