All I want to do is. . .

. . .use the same vimrc for terminal and gui.

OS:
Tags:

If you like to use Vim in the Terminal and within various GUI's (Macosx and Linux), as I do, here are parts of my .vimrc file that help to make this happen.
Contributors: gcman105 Updated: 08/09/13

Dropbox is the glue

If you keep your .vimrc and .vim folder on Dropbox and then symlink into your home directory, you are able to use Vim on multiple computers.

Fonts and colors

The first snippet from my .vimrc file, shows howto test for the varoius environments.

"Set the color scheme.
set background=dark
if has("gui_running")    
  let base16colorspace=256
  colorscheme base16-tomorrow
  if has("gui_macvim")
    set guifont=Source\ Code\ Pro:h12
    set mouse=a
  else
    set guifont=Source\ Code\ Pro\ 10
    set mouse=c
  end
else
  colorscheme solarized
  set mouse=c
end

Use a .vimlocal on each computer

Store a file for each system in Dropbox and symlink .vimlocal to it.

On Dropbox I have:

  • .vimlocal_t430
  • .vimlocal_mm
  • .vimlocal_mackbook

Then symlink .vimlocal in your home folder to the appropriate one.

The snippet below is from the very bottom of my .vimrc file.

source $HOME/.vimlocal

Sample .vimlocal

I try to keep my .vimlocal file really small.

"Set the initial window size
set lines=43
set columns=189

Here is a Gist of gcman105's .vimrc file.

Raw: use-vimrc-in-terminal-and-gui.md


If you have suggestions, corrections, or content to contribute, fork us at our Github repo or open an issue.

Licensed under the CC-SA.