From a1f4055e9bb723c7b4607e4ecb12a068996988d5 Mon Sep 17 00:00:00 2001 From: Jacob Zimmerman Date: Wed, 25 Feb 2015 03:20:46 -0500 Subject: [PATCH] Make Vim look good 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. --- vimrc.vim | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/vimrc.vim b/vimrc.vim index 86b1f39..50ed2f1 100644 --- a/vimrc.vim +++ b/vimrc.vim @@ -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 @@ -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' +