Skip to content

Commit

Permalink
Make Vim look good
Browse files Browse the repository at this point in the history
Overview

> For this step, it's best if you have iTerm2 on OS X or mobaXterm on
> Windows. If you're using Linux, I'll leave it up to you to choose a
> sensible terminal emulator.
>
> This step is also really long. Here's a TL;DR:

1. Change your terminal's preferences to use Solarized
2. Install a patched font
3. Make the appropriate changes to your vimrc
4. Uncomment the line with `g:airline_powerline_fonts`

In addition, depending on your machine, you may want to see the
Troubleshooting section at the end.

------------------------------------------------------------------------

Solarized

To make Vim look good, you can install extra color schemes. For the
purposes of this demo, I've chosen two: Solarized (the most widely used
color scheme) and Molokai (a port of the Textmate/Sublime color scheme).
Feel free to pick one by changing the

    colorscheme solarized

line to something else.

Solarized is a special kind of color scheme. For it to work properly,
you need to make changes in two places:

- Your ~/.vimrc
- Your terminal emulator's preferences (like iTerm2, MobaXterm, etc.)

For macOS, I recommend using iTerm2, and for Windows, I recommend
MobaXterm. If you're using one of these terminals, you already have
Solarized installed; you just need to select it from your preferences.
Otherwise, install a Solarized theme for your terminal emulator:

    http://ethanschoonover.com/solarized

If you can't figure out how to do this for your terminal, just uncomment
the line that says

    let g:solarized_termcolors=256

Note that Solarized is one of many great colorschemes; feel free to
explore and find one you love!

------------------------------------------------------------------------

Patched Fonts

We're also installing a plugin called vim-airline that makes Vim look
pretty awesome. It adds tons of information to your Vim and adds style
too. It works best if you have what's called a "patched font". There are
a number of patched fonts that you can install, but the one I recommend
is

    https://github.com/abertsch/Menlo-for-Powerline

Once you've downloaded all the .ttf files, change your default font in
your terminal emulator's preferences.

If you do manage to install a patched font, you can tell vim-airline to
use them by uncommenting the line that reads

    let g:airline_powerline_fonts = 1

------------------------------------------------------------------------

Troubleshooting

If you make all the changes here and nothing seems to be working, check
that you have this line in your ~/.bashrc:

    export TERM="xterm-256color"

> Update (2016-11-12):
>
> Betewen when I first gave this talk and now Windows announced the
> Windows Subsystem for Linux. I've heard that it is actually very good.
> Unfortunately, I've never used it and so I can't attest to how well it
> works or what instructions prescribed here need to be adjusted.

Setting up Solarized and vim-airline is basically impossible on PuTTY.
Instead, you should go download mobaXterm, which is an SSH client that
lets you a) comes pre-installed with Solarized colors and b) lets you
choose a patched font:

    http://mobaxterm.mobatek.net/

For detailed installation instructions and a sneak peak at some of it's
more powerful features, see here

    http://blog.jez.io/2014/09/28/setting-up-mobaxterm-for-ssh-on-windows/

And while once upon a time I managed to get a patched font working with
MobaXterm, I haven't managed to get it to work since. Your mileage may
vary.
  • Loading branch information
jez committed Nov 12, 2016
1 parent dcc0c8d commit a1f4055
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions vimrc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ call vundle#begin()

Plugin 'VundleVim/Vundle.vim'

" ----- Making Vim look good ------------------------------------------
Plugin 'altercation/vim-colors-solarized'
Plugin 'tomasr/molokai'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'

call vundle#end()

filetype plugin indent on
Expand All @@ -23,3 +29,37 @@ set hlsearch
syntax on

set mouse=a

" ----- Plugin-Specific Settings --------------------------------------

" ----- altercation/vim-colors-solarized settings -----
" Toggle this to "light" for light colorscheme
set background=dark

" Uncomment the next line if your terminal is not configured for solarized
"let g:solarized_termcolors=256

" Set the colorscheme
colorscheme solarized


" ----- bling/vim-airline settings -----
" Always show statusbar
set laststatus=2

" Fancy arrow symbols, requires a patched font
" To install a patched font, run over to
" https://github.com/abertsch/Menlo-for-Powerline
" download all the .ttf files, double-click on them and click "Install"
" Finally, uncomment the next line
"let g:airline_powerline_fonts = 1

" Show PASTE if in paste mode
let g:airline_detect_paste=1

" Show airline for tabs too
let g:airline#extensions#tabline#enabled = 1

" Use the solarized theme for the Airline status bar
let g:airline_theme='solarized'

4 comments on commit a1f4055

@jez
Copy link
Owner Author

@jez jez commented on a1f4055 Nov 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jez
Copy link
Owner Author

@jez jez commented on a1f4055 Nov 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the colors don't show up correctly, check the output of this command:

echo $TERM

If it doesn't contain xterm-256color, add this line to the end of your ~/.bashrc:

export TERM="xterm-256color"

@cmnzs
Copy link

@cmnzs cmnzs commented on a1f4055 Mar 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI if someone else runs into issues getting the powerline fonts to work in iTerm2:

users need to set both the Regular font and the Non-ASCII Font in "iTerm > Preferences > Text" to use a patched font (per this issue: powerline/fonts#44).

@jchanke
Copy link

@jchanke jchanke commented on a1f4055 May 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case this helps anyone: for this to work, I needed to run

:PluginInstall

every time I added a new Plugin.

Please sign in to comment.