Intro
One of the best things you can do to any Windows computer is install Cygwin and gvim - only then will it become sane and useful.
Windows: Installing Cygwin
Go to the Cygwin site and follow the installation instructions.
If your Windows admins are BOFH and have locked down your environment you may be lucky and the following may work.
- Create a folder called "C:\Program Files (noadmin)"
- Run Cygwin install from the DOS prompt: "setup.exe --no-admin"
- During the installation phase tell Cygwin to install the Windows program bits (i.e. the dlls and icons) into the above folder.
- Then when prompted store the Cygwin filesystem as "C:\cygwin"
Windows: Customising Cygwin
Cygwin will create your home directory the very first time you log in so click the Cygwin icon to get this chore out of the way.
mintty
I like to use mintty as my default shell so I create a shortcut on my desktop with the following target.
C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -Run a mintty shell and right click on the title bar and choose "Options", then set the following:
- Looks: (set your colours), Transparency=Medium, Check "Opaque when focussed", Cursor=Block, Check "Blinking"
- Text: (set your font), Check "Show bold as colour"
- Window: Columns=130, Rows=30, Scrollback lines=10000
- Terminal: Type=xterm, Check "Prompt about running processes on close"
NOTE: Choose a Window's font that is scaleable because mintty allows you to zoom in and out using the Ctrl + and Ctrl - keys. I prefer the look of Lucida Console 9pt.
Create a .minttyrc file in your home directory that looks like this:
BoldAsFont=no Columns=130 Rows=30 CursorType=block OpaqueWhenFocused=yes Transparency=medium BackgroundColour=19,68,79
Windows: Installing gvim
Go to the Cygwin site and follow the installation instructions.
If your Windows admins are BOFH and have locked down your environment you may be lucky and the following may work.
- Create a folder called "C:\Program Files (noadmin)"
- Run gvim install.
- During the installation phase tell gvim to install the Windows program bits into the above folder.
Windows: Customising gvim
In Windows gvim uses a file called _vimrc to customise its start up behaviour. The _vimrc file can be found in two locations.
- "C:\Program Files (noadmin)\vim\_vimrc"
- "C:\Documents and Settings\<username>\_vimrc"
I personally don't bother with the local _vimrc (probably for historical reasons) so I make a backup copy of the system _vimrc and make my customisations to it instead.
Use this reference to edit your _vimrc file as you like it, please don't use this file directly as the control characters inside it don't translate well on this web page.
"arthurguru's default GVIM .vimrc file. "Note with gvim win32: Ctrl-V is now paste and old behaiviour is now Ctrl-Q set nocompatible source $VIMRUNTIME/vimrc_example.vim source $VIMRUNTIME/mswin.vim behave mswin set diffexpr=MyDiff() function MyDiff() let opt = '-a --binary ' if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif let arg1 = v:fname_in if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif let arg2 = v:fname_new if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif let arg3 = v:fname_out if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif if &sh =~ '\<cmd' silent execute '!""C:\Program Files\Vim\vim64\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . '"' else silent execute '!C:\Program" Files\Vim\vim64\diff" ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 endif endfunction version 6.0 if &cp | set nocp | endif let s:cpo_save=&cpo set cpo&vim cnoremap <C-F4> ^V^C^V^Wc inoremap <C-F4> ^V^O^V^Wc cnoremap <C-Tab> ^V^C^V^Ww inoremap <C-Tab> ^V^O^V^Ww cmap <S-Insert> ^V^R+ map! <xHome> <Home> map! <xEnd> <End> map! <S-xF4> <S-F4> map! <S-xF3> <S-F3> map! <S-xF2> <S-F2> map! <S-xF1> <S-F1> map! <xF4> <F4> map! <xF3> <F3> map! <xF2> <F2> map! <xF1> <F1> imap <S-Insert> ^V^V imap <C-PageDown> ^V^OL^V^O$ imap <C-PageUp> ^V^OH noremap ^V^A gggH^V^OG vnoremap ^V^C "+y noremap ^V^Q ^V^V vnoremap ^V^S ^V^C:update^V^M nnoremap ^V^S :update^V^M onoremap ^V^S :update^V^M nmap ^V^V "+gP omap ^V^V "+gP vnoremap ^V^X "+x noremap ^V^Y ^V^R noremap ^V^Z u cnoremap ^V ^V^C:simalt ~^V^M inoremap ^V ^V^O:simalt ~^V^M map Q gq map q :q^M noremap <C-F4> ^V^Wc noremap <C-Tab> ^V^Ww vmap <S-Insert> ^V^V vnoremap <BS> d map <xHome> <Home> map <xEnd> <End> map <S-xF4> <S-F4> map <S-xF3> <S-F3> map <S-xF2> <S-F2> map <S-xF1> <S-F1> map <xF4> <F4> map <xF3> <F3> map <xF2> <F2> map <xF1> <F1> vmap <C-Del> "*d vnoremap <S-Del> "+x vnoremap <C-Insert> "+y nmap <S-Insert> "+gP omap <S-Insert> "+gP nmap <C-PageDown> L$ vmap <C-PageDown> L$ nmap <C-PageUp> H vmap <C-PageUp> H cnoremap ^V^A ^V^CgggH^V^OG inoremap ^V^A ^V^Ogg^V^OgH^V^OG inoremap ^V^S ^V^O:update^V cmap ^V^V ^V^R+ inoremap ^V^Y ^V^O^V^R inoremap ^V^Z ^V^Ou noremap ^V :simalt ~^V let &cpo=s:cpo_save unlet s:cpo_save set noautoindent set nocindent set nosmartindent set shiftwidth=2 set expandtab set tabstop=4 set showmode set background=dark set backspace=indent,eol,start set nobackup set diffexpr=MyDiff() set guifont=Courier_New:h9:cANSI set guioptions=gmrLt set helplang=En set history=50 set hlsearch set incsearch set keymodel=startsel,stopsel set ruler set selection=exclusive set selectmode=mouse,key set whichwrap=b,s,<,>,[,] colorscheme arthurThe above file has a reference to a colourscheme called "arthur", so now we need to create a file in the gvim system area called "C:\Program Files (noadmin)\Vim\Vim64\colors\arthur.vim.
NOTE: Use the same colour file as described in the puppet section below.
Windows: Customising gvim in Cygwin
Run a mintty shell and change to your home directory.
Create a .vimrc file in your home directory that looks like this:
map q :q^MNOTE: I have inserted a carriage return in after the :q so I can easily close and exit an unmodified file by just pressing the letter q.Create a file called .vifm/colorschemes in your home directory that looks like this:
# You can edit this file by hand. # The # character at the beginning of a line comments out the line. # Blank lines are ignored. # The Default color scheme is used for any directory that does not have # a specified scheme. A color scheme set for a base directory will also # be used for the sub directories. # The standard ncurses colors are: # Black = 0 # Red = 1 # Green = 2 # Yellow = 3 # Blue = 4 # Magenta = 5 # Cyan = 6 # White = 7 # COLORSCHEME=OneWordDescription # DIRECTORY=/Full/Path/To/Base/Directory # COLOR=Window_name=foreground_color_number=background_color_number COLORSCHEME=Default DIRECTORY=/ COLOR=MENU=white=black COLOR=BORDER=black=white COLOR=WIN=white=black COLOR=STATUS_BAR=white=black COLOR=CURR_LINE=white=blue COLOR=DIRECTORY=cyan=black COLOR=LINK=yellow=black COLOR=SOCKET=magenta=black COLOR=DEVICE=red=black COLOR=EXECUTABLE=green=black COLOR=SELECTED=magenta=black COLOR=CURRENT=blue=black
Unix: Customising gvim
As a systems administrator of many Unix/Linux systems, I prefer to be able to use the same colour scheme across all my systems so I use puppet to push out my gvim configurations to all Unix/Linux systems.
On your puppet server create a puppet/modules/vim/manifests/init.pp file that looks like this
###################################################### ## vim Master ###################################################### class vim { # Master class mainly exists to provide hierachy for sub classes. } ###################################################### ## /usr/share/vim/vimfiles/colors/arthur.vim ###################################################### class vim::colors inherits vim { # Handy for vimdiff sake when run as user root :colors arthur file { "/usr/share/vim/vimfiles/colors/arthur.vim": ensure => present, source => "puppet:///modules/vim/colors/arthur.vim", owner => "root", group => "root", mode => "0644" } }On your puppet server create a puppet/modules/vim/files/colors/arthur.vim file that looks like this
" Vim color file " cool help screens " :he group-name " :he highlight-groups " :he cterm-colors set background=dark if version > 580 " no guarantees for version 5.8 and below, but this makes it stop " complaining hi clear if exists("syntax_on") syntax reset endif endif let g:colors_name="arthur" hi Normal guifg=White guibg=#004050 " highlight groups hi Cursor guibg=khaki guifg=slategrey "hi CursorIM "hi Directory "hi DiffAdd "hi DiffChange "hi DiffDelete "hi DiffText "hi ErrorMsg hi VertSplit guibg=#c2bfa5 guifg=grey50 gui=none hi Folded guibg=grey30 guifg=gold hi FoldColumn guibg=grey30 guifg=tan hi IncSearch guifg=slategrey guibg=khaki "hi LineNr hi ModeMsg guifg=goldenrod hi MoreMsg guifg=SeaGreen hi NonText guifg=LightBlue guibg=grey30 hi Question guifg=springgreen hi Search guibg=peru guifg=wheat hi SpecialKey guifg=slategrey hi StatusLine guibg=#c2bfa5 guifg=black gui=none hi StatusLineNC guibg=#c2bfa5 guifg=grey50 gui=none hi Title guifg=tan hi Visual gui=none guifg=khaki guibg=olivedrab "hi VisualNOS hi WarningMsg guifg=salmon "hi WildMenu "hi Menu "hi Scrollbar "hi Tooltip " syntax highlighting groups hi Comment guifg=olivedrab hi Constant guifg=grey70 hi Identifier guifg=white hi Statement guifg=khaki hi PreProc guifg=navajowhite hi Type guifg=darkkhaki hi Special guifg=navajowhite "hi Underlined hi Ignore guifg=grey40 "hi Error hi Todo guifg=orangered guibg=yellow2 " color terminal definitions hi SpecialKey ctermfg=darkgreen hi NonText cterm=bold ctermfg=darkblue hi Directory ctermfg=cyan hi ErrorMsg cterm=bold ctermfg=7 ctermbg=1 hi IncSearch cterm=NONE ctermfg=white ctermbg=green hi Search cterm=NONE ctermfg=yellow ctermbg=darkred hi MoreMsg ctermfg=darkgreen hi ModeMsg cterm=NONE ctermfg=brown hi LineNr ctermfg=3 hi Question ctermfg=green hi StatusLine cterm=bold,reverse hi StatusLineNC cterm=reverse hi VertSplit cterm=reverse hi Title ctermfg=5 hi Visual cterm=reverse hi VisualNOS cterm=bold,underline hi WarningMsg ctermfg=1 hi WildMenu ctermfg=0 ctermbg=3 hi Folded ctermfg=darkgrey ctermbg=NONE hi FoldColumn ctermfg=darkgrey ctermbg=NONE hi DiffAdd ctermbg=4 hi DiffChange cterm=bold ctermfg=9 ctermbg=NONE hi DiffDelete cterm=bold ctermfg=4 ctermbg=8 hi DiffText cterm=bold ctermfg=7 ctermbg=1 hi Comment ctermfg=darkgreen hi Constant ctermfg=darkyellow hi Special ctermfg=5 hi Identifier ctermfg=darkyellow hi Statement ctermfg=darkcyan hi PreProc ctermfg=5 hi Type ctermfg=2 hi Underlined cterm=underline ctermfg=5 hi Ignore cterm=bold ctermfg=7 hi Ignore ctermfg=darkgrey hi Error cterm=bold ctermfg=7 ctermbg=1 "vim: sw=4