1 " Rev 103
  2 
  3 
  4 
  5 " ==============================
  6 " General Setup
  7 " ==============================
  8 
  9 " Disable compatibility with vi (must come first)
 10 set nocompatible
 11 
 12 " Restore screen contents when exiting Vim
 13 set restorescreen
 14 
 15 " Enable the mouse for all modes
 16 set mouse=a
 17 
 18 " Hide mouse while typing text
 19 set mousehide
 20 
 21 " Use all abbreviations in messages
 22 set shortmess=a
 23 
 24 " Preferably use Unix file format
 25 set fileformats=unix,dos
 26 
 27 " Display line numbers in front of each line
 28 set number
 29 
 30 " Never report changes
 31 set report=10000
 32 
 33 " Display commands in the bottom right corner as they are typed
 34 set showcmd
 35 
 36 " Size of the history
 37 set history=150
 38 
 39 " Use a higher timeout for mappings, so that keycodes will time out first
 40 set timeout ttimeoutlen=40 timeoutlen=45
 41 
 42 " Don't keep backups
 43 set nobackup
 44 set writebackup
 45 
 46 " Use <Tab> for command-line completion
 47 set wildchar=<Tab>
 48 
 49 " Display a list of matches when using command-line completion
 50 set wildmenu
 51 set wildmode=full
 52 set wildignore=*.o,*.obj,*.pyc,*.pyo,*.swp,.sconsign.dblite
 53 
 54 " Disable any kind of bell
 55 set t_vb=
 56 set noerrorbells
 57 set novisualbell
 58 
 59 " Smoother redraws
 60 set ttyfast
 61 
 62 " Do not redraw when running macros
 63 set lazyredraw
 64 
 65 " Title of the window
 66 set title
 67 set titlestring=%F\ %m
 68 
 69 
 70 
 71 " ==============================
 72 " Text edition
 73 " ==============================
 74 
 75 " Syntax highlighting
 76 syntax on
 77 
 78 " Don't cut lines
 79 set textwidth=0
 80 
 81 " Don't put two spaces after . ? ! when joining lines
 82 set nojoinspaces
 83 
 84 " Tab width
 85 set shiftwidth=4
 86 set softtabstop=4
 87 
 88 " Insert spaces insteads of tabs
 89 set expandtab
 90 
 91 " Allow the backspace key to delete anything in insert mode
 92 set backspace=indent,eol,start
 93 
 94 " Display trailing spaces using ~ characters and tabs with -> characters
 95 set listchars=tab:<-,trail:~
 96 
 97 " Don't break words
 98 set linebreak
 99 
100 " Display as many lines as possible
101 set display=lastline
102 
103 " Always keep 20 lines above and below the cursor if possible
104 set scrolloff=20
105 
106 " Virtual editing in block mode
107 set virtualedit=block
108 
109 
110 
111 " ==============================
112 " Searching/Replacing
113 " ==============================
114 
115 " Incremental search
116 set incsearch
117 
118 " Highlight search terms
119 set hlsearch
120 
121 " Ignore case when searching, but only if all letters are lowercase
122 set smartcase
123 set ignorecase
124 
125 " Wrap search when EOF is reached
126 set wrapscan
127 
128 " Always replace all occurrences on a line, not just the first one
129 set gdefault
130 
131 
132 
133 " ==============================
134 " Insert mode completion
135 " ==============================
136 
137 " Don't show possible completions that don't match the case of existing text
138 set infercase
139 
140 " Don't show more than 10 items in the popup menu
141 set pumheight=10
142 
143 " Where to look for possible completions
144 set complete=.,w,u,b,kspell
145 
146 " How to show and insert possible completions
147 set completeopt=menu,longest
148 
149 
150 
151 " ==============================
152 " Status line
153 " ==============================
154 
155 " Always display the status line
156 set laststatus=2
157 
158 " Show the current editing status
159 set showmode
160 
161 " Human readable file size
162 fu! StatuslineFilesize()
163     let filesize = line2byte(line("$") + 1) - 1
164 
165     if filesize < 0
166         return ""
167     elseif filesize < 1024
168         return " | " . filesize . " Bytes"
169     elseif filesize < 1024*1024
170         return " | " . (filesize / 1024) . " kB"
171     else
172         return " | " . (filesize / (1024*1024)) . " MB"
173     endif
174 endf
175 
176 
177 " Format string
178 set statusline=%t\ \|\ %L\ lines%{StatuslineFilesize()}\ %y%m%=L%-6l\ C%-2c
179 
180 
181 
182 " ==============================
183 " Tabs
184 " ==============================
185 
186 " Return the string used as the tabline
187 fu! TabLine()
188 
189     let tabline = ''
190 
191     for i in range(tabpagenr('$'))
192 
193         let currtabnr  = i + 1
194         let currbuflst = tabpagebuflist(currtabnr)
195 
196         " Set the correct highlighting for the current tab
197         let tabline .= ((currtabnr == tabpagenr()) ? '%#TabLineSel#' : '%#TabLine#')
198 
199         " Tab number (for mouse clicks)
200         let tabline .= '%' . (currtabnr) . 'T'
201 
202         " Filename of the current window (no path)
203         let filename = bufname(currbuflst[tabpagewinnr(currtabnr) - 1])
204 
205         if filename != ''
206             let filename = fnamemodify(filename, ':t')
207         else
208             let filename = '[No Name]'
209         endif
210 
211         " Check whether one of the buffers has been modified
212         let bufmodified = ''
213 
214         for bufnr in range(len(currbuflst))
215             if getbufvar(currbuflst[bufnr], "&mod") == 1
216                 let bufmodified = ' [+]'
217                 break
218             endif
219         endfor
220 
221         " Number of buffers
222         let nbbuf = tabpagewinnr(currtabnr, '$')
223 
224         if nbbuf == 1
225             let nbbuf = ''
226         else
227             let nbbuf = ':' . nbbuf
228         endif
229 
230         " Name of the tab
231         if currtabnr == tabpagenr()
232             let tabline .= filename . nbbuf . bufmodified . '%#TabLine#  '
233         else
234             let tabline .= filename . nbbuf . bufmodified . '  '
235         endif
236 
237     endfor
238 
239     return tabline . '%#TabLineFill#%T'
240 
241 endf
242 
243 
244 " Shift the current tab to the left (direction == 0) or to the right (direction != 0)
245 fu! ShiftTab(direction)
246     let tabpos = tabpagenr()
247 
248     if a:direction == 0
249         if tabpos == 1
250             exe 'tabm' . tabpagenr('$')
251         else
252             exe 'tabm' . (tabpos - 2)
253         endif
254     else
255         if tabpos == tabpagenr('$')
256             exe 'tabm ' . 0
257         else
258             exe 'tabm ' . tabpos
259         endif
260     endif
261 
262     return ''
263 endf
264 
265 
266 " Use a custom function to draw the tabline
267 set tabline=%!TabLine()
268 
269 " Shift the current tab to the left/right
270 inoremap <silent> <C-S-Left>  <C-r>=ShiftTab(0)<CR>
271 inoremap <silent> <C-S-Right> <C-r>=ShiftTab(1)<CR>
272 
273 noremap <silent> <C-S-Left>  :call ShiftTab(0)<CR>
274 noremap <silent> <C-S-Right> :call ShiftTab(1)<CR>
275 
276 " Ctrl-t creates a new tab and opens the file explorer
277 map  <silent> <C-t> :Texplore<CR>
278 imap <silent> <C-t> <Esc><C-t>
279 
280 
281 
282 " ==============================
283 " File explorer
284 " ==============================
285 
286 " Prevent some files/directories from being listed
287 let g:netrw_hide=1
288 let g:netrw_list_hide='^\./$,^CVS/$,\.o$,\.pyc$,\.pyo$,\.swp$,^\.svn/$,^\.bzr/$,^\.sconsign.dblite$'
289 
290 " Reuse the same window when opening a file
291 let g:netrw_browse_split=0
292 
293 " Always update directories' contents
294 let g:netrw_fastbrowse=0
295 
296 " Tree view
297 let g:netrw_liststyle=3
298 
299 " Highlight the current line
300 let g:netrw_cursorline=1
301 
302 
303 
304 " ==============================
305 " Some functions used later on
306 " ==============================
307 
308 " See :help restore-cursor
309 fu! RestoreCursorOnBufRead()
310     " Don't restore the cursor position for SVN commit logs
311     if line("'\"") > 0 && line("'\"") <= line("$") && bufname('%') != 'svn-commit.tmp'
312         exe "normal! g`\""
313     endif
314 endf
315 
316 " See :help restore-position
317 fu! SaveCurPos()
318     execute "normal msHmtgg"
319 endf
320 
321 
322 " See :help restore-position
323 fu! RestoreCurPos()
324     execute "normal 'tzt`s"
325 endf
326 
327 
328 " Reformat the file
329 fu! FormatFile()
330     call SaveCurPos()
331     execute "normal gg=G"
332     call RestoreCurPos()
333 endf
334 
335 
336 " Remove trailing spaces
337 fu! RemoveTrailingSpaces()
338     call SaveCurPos()
339     %s/\s\+$//e
340     call RestoreCurPos()
341 endf
342 
343 
344 " Remove trailing line feed characters
345 fu! Dos2Unix()
346     call SaveCurPos()
347     execute ":%s/\r$//g"
348     call RestoreCurPos()
349 endf
350 
351 
352 " Comment the latest visual selection when applicable
353 " If firstCol is 1, the comment is always put in the first column, no matter the indentation of the lines
354 fu! Comment(firstCol)
355     call SaveCurPos()
356     if &filetype == "python" || &filetype == "zsh" || &filetype == "sh" || &filetype == "gnuplot" || &filetype == "make" || &filetype == "cfg"
357         if a:firstCol == 1
358             execute ":'<,'>s/^/# /"
359         else
360             execute ":'<,'>s/\\(^\\s*\\)/\\1\# /"
361         endif
362     elseif &filetype == "cpp" || &filetype == "c" || &filetype == "nesc" || &filetype == "java" || &filetype == "php"
363         if a:firstCol == 1
364             execute ":'<,'>s@^@// @"
365         else
366             execute ":'<,'>s@\\(^\\s*\\)@\\1// @"
367         endif
368     elseif &filetype == "tex" || &filetype == "bib"
369         if a:firstCol == 1
370             execute ":'<,'>s/^/% /"
371         else
372             execute ":'<,'>s/\\(^\\s*\\)/\\1% /"
373         endif
374     elseif &filetype == "css" || &filetype == "javascript"
375         execute ":'<-1put='/*'"
376         execute ":'>put='*/'"
377     elseif &filetype == "xml" || &filetype == "html" || &filetype == "ant"
378         execute ":'<-1put='<!--'"
379         execute ":'>put='-->'"
380     elseif &filetype == "vim"
381         if a:firstCol == 1
382             execute ":'<,'>s/^/\" /"
383         else
384             execute ":'<,'>s/\\(^\\s*\\)/\\1\" /"
385         endif
386     endif
387     call RestoreCurPos()
388 endf
389 
390 
391 " Insert a tab or complete the current word
392 fu! CleverTab(mode)
393     if a:mode == 0 || strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
394         return "\<tab>"
395     elseif a:mode == 1
396         return "\<c-p>"
397     else
398         return "\<c-n>"
399     endif
400 endf
401 
402 
403 " Cycle between spell check off, on (English), and on (French)
404 fu! CycleSpellChecking()
405     if &spell == 0
406         setlocal spelllang=en
407         setlocal spell
408         echo "Spell check on (English)"
409     elseif &spelllang == "en"
410         setlocal spelllang=fr
411         echo "Spell check on (French)"
412     else
413         setlocal nospell
414         echo "Spell check off"
415     endif
416 endf
417 
418 
419 " Eat the next character, see :help abbreviations
420 fu! EatChar(pat)
421     let c = nr2char(getchar(0))
422     return (c =~ a:pat) ? '' : c
423 endf
424 
425 
426 
427 " ==============================
428 " Commands
429 " ==============================
430 
431 com! Dos2Unix  :call Dos2Unix()
432 com! Diff      vert new | set bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis
433 com! RcEdit    :e ~/.vimrc
434 com! RcReload  :so ~/.vimrc
435 com! RcTabEdit :tabnew ~/.vimrc
436 
437 
438 
439 " ==============================
440 " Global mappings
441 " ==============================
442 
443 " Move between screen lines instead of real lines
444 noremap <Up>   gk
445 noremap <Down> gj
446 noremap <Home> g<Home>
447 noremap <End>  g<End>
448 
449 inoremap <Up>   <C-o>gk
450 inoremap <Down> <C-o>gj
451 inoremap <Home> <C-o>g<Home>
452 inoremap <End>  <C-o>g<End>
453 
454 " Alt + Right/Left moves between sentences
455 noremap <A-Right> )
456 noremap <A-Left>  (
457 
458 inoremap <A-Right> <C-O>)
459 inoremap <A-Left>  <C-O>(
460 
461 " Prevent the cursor from moving when escaping from insert mode
462 " The second mapping forces Vim to wait during the full time out before applying the first one
463 " Otherwise, the first mapping prevents extended keycodes to work in a terminal
464 inoremap <Esc>      <Right><Esc>
465 inoremap <Esc><Esc> <Esc>
466 
467 " Make Y yanks from the cursor to the end of the line
468 map Y y$
469 
470 " Enter adds a line below the current one in command mode
471 map <silent> <CR> o<ESC>
472 
473 " Let space and backspace act the same as in insert mode
474 map <silent> <Space>     i<Space><Esc>
475 map <silent> <Backspace> X
476 
477 " In visual mode, enclose the selection with the given character
478 vnoremap <silent> ' s''<Esc>P
479 vnoremap <silent> " s""<Esc>P
480 vnoremap <silent> ( s()<Esc>P
481 vnoremap <silent> { s{}<Esc>P
482 vnoremap <silent> [ s[]<Esc>P
483 vnoremap <silent> * s**<Esc>P
484 
485 " <F2> cycles between all spell checking states
486 map  <silent> <F2> :call CycleSpellChecking()<CR>
487 imap <silent> <F2> <C-o><F2>
488 
489 " <F3> reformats the file
490 map  <silent> <F3> :call FormatFile()<CR>
491 imap <silent> <F3> <C-o><F3>
492 
493 " Ctrl-x clears highlight
494 map  <silent> <C-x> :noh<CR>
495 imap <silent> <C-x> <C-o><C-x>
496 
497 " Ctrl-a selects everything
498 map <C-a> ggVG
499 
500 " Completion and tabs
501 inoremap <silent> <tab>   <C-r>=CleverTab(2)<CR>
502 inoremap <silent> <S-Tab> <C-r>=CleverTab(1)<CR>
503 inoremap <silent> <C-Tab> <C-r>=CleverTab(0)<CR>
504 
505 " Comment the visual selection
506 vnoremap <silent> / <Esc>:call Comment(1)<CR>
507 
508 
509 
510 " ==============================
511 " Global abbreviations
512 " ==============================
513 
514 iab to=  TODO<C-O>V<Esc><C-R>=Comment(0)<CR><C-O>g_<Right>
515 iab fix= FIXME<C-O>V<Esc><C-R>=Comment(0)<CR><C-O>g_<Right>
516 
517 
518 
519 " ==============================
520 " File types
521 " ==============================
522 
523 filetype on
524 filetype indent on
525 
526 " Set the correct file type for some files
527 au BufRead,BufNewFile,BufFilePost *.nc        set filetype=nesc
528 au BufRead,BufNewFile,BufFilePost *.plt       set filetype=gnuplot
529 au BufRead,BufNewFile,BufFilePost sconstruct  set filetype=python
530 au BufRead,BufNewFile,BufFilePost *.cls,*.tex set filetype=tex
531 
532 " Define specific options for some file types
533 au FileType xml             call ModeXML()
534 au FileType css             call ModeCSS()
535 au FileType tex             call ModeLaTeX()
536 au FileType bib             call ModeBibTeX()
537 au FileType help            call ModeHelp()
538 au FileType python          call ModePython()
539 au FileType vim,changelog   setlocal textwidth=0
540 au FileType c,cpp,nesc,java call ModeJavaC()
541 
542 
543 
544 " ==============================
545 " XML mode
546 " ==============================
547 
548 fu! ModeXML()
549 
550     " Automatically close angle brackets
551     inoremap <buffer> <lt> <><Left>
552 
553 endf
554 
555 
556 
557 " ==============================
558 " CSS mode
559 " ==============================
560 
561 fu! ModeCSS()
562 
563     " Automatically insert closing brackets
564     inoremap <buffer> { {<CR>}<Up><CR>
565 
566 endf
567 
568 
569 
570 " ==============================
571 " LaTeX mode
572 " ==============================
573 
574 fu! ModeLaTeX()
575 
576     " Some abbreviations
577     iab <buffer> fig=    \begin{figure}<CR>\centering<CR><CR>\caption{}<CR>\label{fig:}<CR>\end{figure}<Up><Up><Up><C-R>=EatChar('\s')<CR>
578     iab <buffer> fig*=   \begin{figure*}<CR>\centering<CR><CR>\caption{}<CR>\label{fig:}<CR>\end{figure*}<Up><Up><Up><C-R>=EatChar('\s')<CR>
579     iab <buffer> subfig= \subfloat[]{\label{subfig:}\includegraphics[width=]{}}\hfil<C-O>6<Left><C-R>=EatChar('\s')<CR>
580     iab <buffer> tab=    \begin{table}<CR>\centering<CR>\caption{}<CR>\label{tab:}<CR><CR>\end{table}<Up><C-R>=EatChar('\s')<CR>
581     iab <buffer> item=   \begin{itemize}<CR>\item<CR>\end{itemize}<Up><End>
582     iab <buffer> enum=   \begin{enumerate}<CR>\item<CR>\end{enumerate}<Up><End>
583     iab <buffer> desc=   \begin{description}<CR>\item[]<CR>\end{description}<Up><End><Left><C-R>=EatChar('\s')<CR>
584     iab <buffer> sec=    \section{}<CR>\label{sec:}<Up><End><Left><C-R>=EatChar('\s')<CR>
585     iab <buffer> sub=    \subsection{}<CR>\label{subsec:}<Up><End><Left><C-R>=EatChar('\s')<CR>
586     iab <buffer> subsub= \subsubsection{}<CR>\label{subsubsec:}<Up><End><Left><C-R>=EatChar('\s')<CR>
587     iab <buffer> graph=  \includegraphics[]{}<Left><Left><Left><C-R>=EatChar('\s')<CR>
588     iab <buffer> center= \begin{center}<CR>\end{center}<Up><End><CR><C-R>=EatChar('\s')<CR>
589     iab <buffer> cite=   <BS>~\cite{}<Left><C-R>=EatChar('\s')<CR>
590     iab <buffer> eq=     \begin{equation}<CR><CR>\end{equation}<Up><C-R>=EatChar('\s')<CR>
591 
592     " Beamer document class
593     iab <buffer> col=  \begin{column}{}<CR>\end{column}<Up><End><Left><C-R>=EatChar('\s')<CR>
594     iab <buffer> cols= \begin{columns}<CR>\end{columns}<Up><End><CR><C-R>=EatChar('\s')<CR>
595 
596     " In visual mode, enclose the selection with the given character
597     vnoremap <buffer> <silent> $ s$$<Esc>P
598     vnoremap <buffer> <silent> ' s`'<Esc>P
599     vnoremap <buffer> <silent> " s``''<Esc><Left>P<Right>
600 
601     " F8 launches scons
602     map  <buffer> <silent> <F8> :up<CR>:!scons<CR>
603     imap <buffer> <silent> <F8> <C-O>:up<CR><C-O>:!scons<CR>
604 
605 endf
606 
607 
608 
609 " ==============================
610 " BibTeX mode
611 " ==============================
612 
613 fu! ModeBibTeX()
614 
615     " Some abbreviations
616     iab <buffer> str=  @STRING{ = ""}<C-O>5<left><C-R>=EatChar('\s')<CR>
617     iab <buffer> proc= @INPROCEEDINGS{,<CR>author    = {},<CR>title     = {},<CR>booktitle = ,<CR>year      = ,<CR>month     = ,<CR>}<C-O>6<Up><End><Left><C-R>=EatChar('\s')<CR>
618     iab <buffer> art=  @ARTICLE{,<CR>author  = {},<CR>title   = {},<CR>journal = ,<CR>volume  = ,<CR>number  = ,<CR>pages   = {--},<CR>year    = ,<CR>}<C-O>8<Up><End><Left><C-R>=EatChar('\s')<CR>
619     iab <buffer> tech= @TECHREPORT{,<CR>author      = {},<CR>title       = {},<CR>year        = ,<CR>institution = ,<CR>}<C-O>5<Up><End><Left><C-R>=EatChar('\s')<CR>
620     iab <buffer> phd=  @PHDTHESIS{,<CR>author = {},<CR>title  = {},<CR>year   = ,<CR>school = ,<CR>}<C-O>5<Up><End><Left><C-R>=EatChar('\s')<CR>
621 
622 endf
623 
624 
625 
626 " ==============================
627 " Help mode
628 " ==============================
629 
630 func! ModeHelp()
631 
632     " <CR> and <backspace> to navigate
633     map <buffer> <CR>        <C-]>
634     map <buffer> <Backspace> <C-O>
635 
636 endfunc
637 
638 
639 
640 " ==============================
641 " C/C++/Java mode
642 " ==============================
643 
644 fu! ModeJavaC()
645 
646     " Better indentation function
647     setlocal cindent
648 
649     " Don't automatically open new comment lines
650     setlocal formatoptions-=r
651 
652     " Don't put preprocessor directives at the start of the line
653     setlocal cinkeys-=0#
654 
655     " Make sure to automatically format pasted text
656     noremap <buffer> p p=`]`]
657     noremap <buffer> P P=`]`]
658 
659     " Automatically insert closing brackets
660     inoremap <buffer> { {<CR>}<Up><CR>
661 
662     " Some abbreviations
663     iab <buffer> com= /**<CR><Home><Space>*<CR><Home>**/<Up>
664     iab <buffer> def= #ifndef<CR>#define <CR><CR>#endif<C-O>gg<End>
665 
666 endf
667 
668 
669 
670 " ==============================
671 " Python mode
672 " ==============================
673 
674 fu! ModePython()
675 
676     " Some abbreviations
677     iab <buffer> hb=  #!/usr/bin/env python<CR><CR><C-R>=EatChar('\s')<CR>
678     iab <buffer> def= def ():<CR>"""  """<CR>pass<Up><Up><Left><Left><Left><C-R>=EatChar('\s')<CR>
679     iab <buffer> cls= class :<CR><CR>def __init__(self):<CR>""" Constructor """<CR>pass<Up><Up><Up><Up><Left><C-R>=EatChar('\s')<CR>
680 
681 endf
682 
683 
684 " ==============================
685 " Miscellaneous
686 " ==============================
687 
688 " Remove trailing spaces when saving buffers
689 au BufWrite * if ! &bin | call RemoveTrailingSpaces() | endif
690 
691 " Restore cursor position when reading a buffer
692 au BufReadPost * call RestoreCursorOnBufRead()
693 
694 " Always change to the directory of the current file
695 au BufEnter * lcd %:p:h
696 
697 " :TOhtml configuration
698 let use_xhtml = 1
699 let html_use_css = 1
700 let html_ignore_folding = 1
701 
702 
703 
704 " ==============================
705 " Color scheme
706 " ==============================
707 
708 set background=dark
709 
710 if &term =~ 'xterm'
711 
712     " Xterm supports up to 256 colors, so let's use them
713     set t_Co=256
714 
715     " Freely adapted from the 'ps_color' color scheme
716     hi Normal            ctermfg=252         ctermbg=234         cterm=NONE
717     hi Comment           ctermfg=186         ctermbg=bg          cterm=NONE
718     hi Constant          ctermfg=210         ctermbg=bg          cterm=NONE
719     hi Cursor            ctermfg=Black       ctermbg=153         cterm=NONE
720     hi CursorColumn      ctermfg=fg          ctermbg=88          cterm=NONE
721     hi CursorLine        ctermfg=Black       ctermbg=186         cterm=NONE
722     hi DiffAdd           ctermfg=fg          ctermbg=18          cterm=NONE
723     hi DiffChange        ctermfg=fg          ctermbg=90          cterm=NONE
724     hi DiffDelete        ctermfg=69          ctermbg=234         cterm=NONE
725     hi DiffText          ctermfg=Black       ctermbg=150         cterm=NONE
726     hi Directory         ctermfg=111         ctermbg=bg          cterm=NONE
727     hi Error             ctermfg=210         ctermbg=bg          cterm=NONE
728     hi ErrorMsg          ctermfg=186         ctermbg=88          cterm=NONE
729     hi FoldColumn        ctermfg=252         ctermbg=bg          cterm=NONE
730     hi Folded            ctermfg=210         ctermbg=bg          cterm=NONE
731     hi Identifier        ctermfg=219         ctermbg=bg          cterm=NONE
732     hi Ignore            ctermfg=Black       ctermbg=bg          cterm=NONE
733     hi IncSearch         ctermfg=88          ctermbg=186         cterm=NONE
734     hi LineNr            ctermfg=210         ctermbg=bg          cterm=NONE
735     hi MatchParen        ctermfg=186         ctermbg=88          cterm=NONE
736     hi ModeMsg           ctermfg=fg          ctermbg=bg          cterm=NONE
737     hi MoreMsg           ctermfg=150         ctermbg=bg          cterm=NONE
738     hi NonText           ctermfg=bg          ctermbg=bg          cterm=NONE
739     hi Question          ctermfg=Black       ctermbg=186         cterm=NONE
740     hi SignColumn        ctermfg=7           ctermbg=28          cterm=NONE
741     hi Search            ctermfg=186         ctermbg=88          cterm=NONE
742     hi Special           ctermfg=179         ctermbg=bg          cterm=NONE
743     hi SpecialComment    ctermfg=186         ctermbg=bg          cterm=NONE
744     hi SpecialKey        ctermfg=153         ctermbg=bg          cterm=NONE
745     hi SpellBad          ctermfg=210         ctermbg=bg          cterm=underline
746     hi SpellCap          ctermfg=210         ctermbg=bg          cterm=underline
747     hi SpellLocal        ctermfg=210         ctermbg=bg          cterm=underline
748     hi SpellRare         ctermfg=210         ctermbg=bg          cterm=underline
749     hi Statement         ctermfg=84          ctermbg=bg          cterm=NONE
750     hi StatusLine        ctermfg=White       ctermbg=236         cterm=NONE
751     hi StatusLineNC      ctermfg=245         ctermbg=236         cterm=NONE
752     hi Pmenu             ctermfg=245         ctermbg=236         cterm=NONE
753     hi PmenuSbar         ctermfg=236         ctermbg=236         cterm=NONE
754     hi PmenuSel          ctermfg=White       ctermbg=236         cterm=NONE
755     hi PmenuThumb        ctermfg=236         ctermbg=Black       cterm=NONE
756     hi PreProc           ctermfg=111         ctermbg=bg          cterm=NONE
757     hi TabLine           ctermfg=245         ctermbg=236         cterm=NONE
758     hi TabLineFill       ctermfg=bg          ctermbg=236         cterm=NONE
759     hi TabLineSel        ctermfg=White       ctermbg=236         cterm=NONE
760     hi Title             ctermfg=219         ctermbg=bg          cterm=NONE
761     hi Type              ctermfg=111         ctermbg=bg          cterm=NONE
762     hi Todo              ctermfg=210         ctermbg=bg          cterm=underline
763     hi Underlined        ctermfg=111         ctermbg=bg          cterm=underline
764     hi User1             ctermfg=Black       ctermbg=153         cterm=NONE
765     hi VertSplit         ctermfg=Black       ctermbg=250         cterm=NONE
766     hi Visual            ctermfg=Black       ctermbg=153         cterm=NONE
767     hi VisualNOS         ctermfg=fg          ctermbg=bg          cterm=NONE
768     hi WarningMsg        ctermfg=210         ctermbg=bg          cterm=NONE
769     hi WildMenu          ctermfg=210         ctermbg=236         cterm=NONE
770 
771     hi netrwExe          ctermfg=84          ctermbg=bg          cterm=NONE
772     hi netrwSymLink      ctermfg=210         ctermbg=bg          cterm=NONE
773 
774 else
775 
776     hi Normal            ctermfg=White       ctermbg=Black       cterm=NONE
777 
778     hi FoldColumn        ctermfg=White       ctermbg=bg          cterm=NONE
779     hi LineNr            ctermfg=Red         ctermbg=bg          cterm=NONE
780     hi NonText           ctermfg=bg          ctermbg=bg          cterm=NONE
781     hi Search            ctermfg=White       ctermbg=Red         cterm=NONE
782     hi StatusLine        ctermfg=Black       ctermbg=LightGray   cterm=NONE
783     hi Visual            ctermfg=White       ctermbg=Red         cterm=NONE
784 
785     hi netrwClassify     ctermfg=LightGray   ctermbg=bg          cterm=NONE
786     hi netrwCmdNote      ctermfg=LightGray   ctermbg=bg          cterm=NONE
787     hi netrwCmdSep       ctermfg=LightGray   ctermbg=bg          cterm=NONE
788     hi netrwComment      ctermfg=LightGray   ctermbg=bg          cterm=NONE
789     hi netrwExe          ctermfg=Green       ctermbg=bg          cterm=NONE
790     hi netrwHelpCmd      ctermfg=LightGray   ctermbg=bg          cterm=NONE
791     hi netrwHidePat      ctermfg=LightGray   ctermbg=bg          cterm=NONE
792     hi netrwList         ctermfg=LightGray   ctermbg=bg          cterm=NONE
793     hi netrwQuickHelp    ctermfg=LightGray   ctermbg=bg          cterm=NONE
794     hi netrwSymLink      ctermfg=Red         ctermbg=bg          cterm=NONE
795     hi netrwVersion      ctermfg=LightGray   ctermbg=bg          cterm=NONE
796 
797 endif
798 
799 hi! link netrwClassify  Comment
800 hi! link netrwCmdNote   Comment
801 hi! link netrwCmdSep    Comment
802 hi! link netrwComment   Comment
803 hi! link netrwHelpCmd   Comment
804 hi! link netrwHidePat   Comment
805 hi! link netrwList      Comment
806 hi! link netrwQuickHelp Comment
807 hi! link netrwVersion   Comment
808 
809 
810 
811 " ==============================
812 " GUI specific configuration
813 " ==============================
814 
815 " Triggered when Vim was compiled with GUI support
816 if has("gui")
817 
818     " Move/resize the GUI
819     au GUIEnter * call EnteringGUI()
820 
821     " Use a nice font
822     set guifont=courier\ new\ 10
823 
824     " Remove the toolbar, the right scrollbar and the menu
825     set guioptions-=T
826     set guioptions-=r
827     set guioptions-=m
828 
829     " Disable cursor blinking and set it to be a block
830     set guicursor=a:blinkon0
831     set guicursor=a:block-Cursor
832 
833     " Custom tabs label
834     set guitablabel=%t\ %m
835 
836 endif
837 
838 " Called when the GUI has just been started
839 " May happen when starting GVim or when using the :gui command
840 function! EnteringGUI()
841 
842     " Move/resize the window
843     winpos 35 40
844     set lines=63 columns=165
845 
846     " This mapping is not needed within the GUI
847     iunmap <Esc><Esc>
848 
849     " Don't limit the GUI to 256 colors
850     set t_Co=
851 
852     " Freely adapted from the 'ps_color' color scheme
853     highlight Normal     guifg=#d0d0d0       guibg=#202020       gui=NONE
854 
855     hi Comment           guifg=#d0d090       guibg=bg            gui=NONE
856     hi Constant          guifg=#f08060       guibg=bg            gui=NONE
857     hi Cursor            guifg=Black         guibg=#a6caf0       gui=NONE
858     hi CursorColumn      guifg=fg            guibg=#800000       gui=NONE
859     hi CursorLine        guifg=#000000       guibg=#d0d090       gui=NONE
860     hi DiffAdd           guifg=fg            guibg=#000080       gui=NONE
861     hi DiffChange        guifg=fg            guibg=#800080       gui=NONE
862     hi DiffDelete        guifg=#6080f0       guibg=#202020       gui=NONE
863     hi DiffText          guifg=Black         guibg=#c0e080       gui=NONE
864     hi Directory         guifg=#80c0e0       guibg=bg            gui=NONE
865     hi Error             guifg=#f08060       guibg=bg            gui=NONE
866     hi ErrorMsg          guifg=#d0d090       guibg=#800000       gui=NONE
867     hi FoldColumn        guifg=#d0d0d0       guibg=bg            gui=NONE
868     hi Folded            guifg=#f08060       guibg=bg            gui=NONE
869     hi Identifier        guifg=#f0c0f0       guibg=bg            gui=NONE
870     hi Ignore            guifg=Black         guibg=bg            gui=NONE
871     hi IncSearch         guifg=#800000       guibg=#d0d090       gui=NONE
872     hi LineNr            guifg=#f08060       guibg=bg            gui=italic
873     hi MatchParen        guifg=#d0d090       guibg=#800000       gui=NONE
874     hi ModeMsg           guifg=fg            guibg=bg            gui=NONE
875     hi MoreMsg           guifg=#c0e080       guibg=bg            gui=NONE
876     hi NonText           guifg=bg            guibg=bg            gui=NONE
877     hi Number            guifg=#f08060       guibg=bg            gui=NONE
878     hi Question          guifg=Black         guibg=#d0d090       gui=NONE
879     hi SignColumn        guifg=#e0e0e0       guibg=#008000       gui=NONE
880     hi Search            guifg=#d0d090       guibg=#800000       gui=NONE
881     hi Special           guifg=#e0c060       guibg=bg            gui=NONE
882     hi SpecialKey        guifg=#b0d0f0       guibg=bg            gui=NONE
883     hi SpellBad          guifg=#f08060       guibg=bg            guisp=#f08060
884     hi SpellCap          guifg=#f08060       guibg=bg            guisp=#f08060
885     hi SpellLocal        guifg=#f08060       guibg=bg            guisp=#f08060
886     hi SpellRare         guifg=#f08060       guibg=bg            guisp=#f08060
887     hi Statement         guifg=#60f080       guibg=bg            gui=NONE
888     hi StatusLine        guifg=Black         guibg=#a6caf0       gui=NONE
889     hi StatusLineNC      guifg=Black         guibg=#c0c0c0       gui=NONE
890     hi Pmenu             guifg=fg            guibg=#404040       gui=NONE
891     hi PmenuSbar         guifg=fg            guibg=#b0b0b0       gui=NONE
892     hi PmenuSel          guifg=#f08060       guibg=#404040       gui=italic
893     hi PmenuThumb        guifg=fg            guibg=Black         gui=NONE
894     hi PreProc           guifg=#80c0e0       guibg=bg            gui=NONE
895     hi TabLine           guifg=fg            guibg=#008000       gui=underline
896     hi TabLineFill       guifg=fg            guibg=#008000       gui=underline
897     hi TabLineSel        guifg=fg            guibg=bg            gui=NONE
898     hi Title             guifg=#f0c0f0       guibg=bg            gui=NONE
899     hi Type              guifg=#80c0e0       guibg=bg            gui=NONE
900     hi Todo              guifg=#f08060       guibg=bg            gui=bold,underline
901     hi Underlined        guifg=#80a0ff       guibg=bg            gui=underline
902     hi User1             guifg=Black         guibg=#a6caf0       gui=NONE
903     hi VertSplit         guifg=Black         guibg=#c0c0c0       gui=NONE
904     hi Visual            guifg=Black         guibg=#a6caf0       gui=NONE
905     hi VisualNOS         guifg=fg            guibg=bg            gui=NONE
906     hi WarningMsg        guifg=#f08060       guibg=bg            gui=NONE
907     hi WildMenu          guifg=Black         guibg=#a6caf0       gui=bold
908 
909     hi netrwExe          guifg=#60f080       guibg=bg            gui=NONE
910     hi netrwSymLink      guifg=#f08060       guibg=bg            gui=NONE
911 
912 endf