Sumit
Sumit

Reputation: 2264

Commands specific to gvim

I am trying to clean my .vimrc by removing gui specific settings so that it works well with terminal (i.e., when I start vim over ssh . Is there a place to find a list of vim commands that I should move within if ('gui_running') endif block.

Upvotes: 0

Views: 169

Answers (2)

romainl
romainl

Reputation: 196456

No, only common sense will help you, there. If you want to clean up your ~/.vimrc it must mean that you have identified some problems, doesn't it?

In general only a few things are really GUI-specific:

  • guifont and related options,
  • a colorscheme that works only in a GUI,
  • removing the menu or scroll bars with guioptions,
  • any option starting with gui, actually,
  • mappings that work only in the GUI…

Read the documentation for every option you set.

But if that's really your ~/.vimrc it shouldn't be too hard because you know exactly what everything does, how and why, right?

As an example, this is what I have:

let os=substitute(system('uname'), '\n', '', '')

if has('gui_running')
  colorscheme sorcerer

  set guioptions-=T

  set lines=40
  set columns=140

  if os == 'Darwin'
    set guifont=Inconsolata-g:h13
    set fuoptions=maxvert,maxhorz
    set clipboard^=unnamed

  elseif os == 'Linux'
    set guifont=Inconsolata-g\ Medium\ 11
    set guioptions-=m
    set clipboard^=unnamedplus

  endif

else
  if &t_Co >= 256
    colorscheme sorcerer

  elseif &t_Co < 256
    colorscheme sorcerer_16

  endif

  if os == 'Darwin'
    set clipboard^=unnamed

  elseif os == 'Linux'
    set clipboard^=unnamedplus

  endif

  nnoremap <Esc>A <up>
  nnoremap <Esc>B <down>
  nnoremap <Esc>C <right>
  nnoremap <Esc>D <left>
  inoremap <Esc>A <up>
  inoremap <Esc>B <down>
  inoremap <Esc>C <right>
  inoremap <Esc>D <left>

endif

I don't use this ~/.vimrc on remote machines so the clipboard settings are safe for me but you might need to put it in a conditional if you intend to work via SSH.

Upvotes: 4

Todd Hainsworth
Todd Hainsworth

Reputation: 114

This might not be what you are looking for, but this should provide you with a starting point.

Vim GUI Documentation

Upvotes: 1

Related Questions