" to avoid execution of commands when savint this file ....
"
"
"
"
"
"
"
"
"
"
"
"
"
"
"set nocompatible

set term=xterm
" set lines=78

"let vimrplugin_r_path = 'c:\\Program\ Files\\R\\R-3.2.2\\bin\\x64\\'
"let vimrplugin_r_path = 'c:\Program Files\R\R-3.2.2\bin\x64\'
"let vimrplugin_r_path = "c:/Program\ Files/R/R-3.2.2/bin/"
let vimrplugin_r_path = "/cygdrive/c/Program\ Files/R/R-3.2.2/bin/"
" let vimrplugin_r_path = 'c:\\Program\ Files\\R\\R-3.2.2\\bin\\x64'
"let vimrplugin_r_path = 'c:/Program\ Files/R/R-3.2.2/bin/x64'
"let vimrplugin_vimcom_wait = 10000
let vimrplugin_assign = 0

set nocompatible
syntax on
filetype plugin on
filetype indent off

" set t_ts=^[k
" set t_fs=^[\
" auto BufEnter * :set title | let &titlestring = 'v:' . expand('%')
" auto VimLeave * :set t_ts=^[k^[\
set title


inoremap <Left> <Esc>h
inoremap <Down> <Esc>j
inoremap <Up> <Esc>k
inoremap <Right> <Esc>l
" vmap <Space> <Plug>RDSendSelection
nmap <Space> <ESC><PLUG>RSendLine
nmap ' <ESC><PLUG>RSendLine<DOWN>


autocmd bufnewfile * so /home/Admin/header.txt
autocmd bufnewfile * exe "1," . 9  . 'g/File Name:.*/s//File Name: ' .expand("%")
autocmd bufnewfile * exe "1," . 9 . 'g/Creation Date:.*/s//Creation Date: ' .strftime("%d-%m-%Y")
autocmd Bufwritepre,filewritepre * execute "normal ma"
autocmd Bufwritepre,filewritepre * exe "1," . 9 . "g/Last Modified: .*/s//Last Modified: " .strftime("%c")
autocmd bufwritepost,filewritepost * execute "normal `a"


au bufreadpre,bufnewfile *.bnf set ft=bnf
au bufreadpre,bufnewfile *.ebnf set ft=ebnf
au bufreadpre,bufnewfile *.lbnf set ft=lbnf
au bufreadpre,bufnewfile *.cf set ft=lbnf
au bufreadpre,bufnewfile *.hs set ft=hs
au bufreadpre,bufnewfile *.lhs set ft=lhs

" set nocompatible
syntax enable
filetype plugin on
filetype indent off

" set paste
set number

set tabstop=8
" set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab

function! WC()
    let filename = expand("%")
    let cmd = "detex " . filename . " | wc -w | tr -d [:space:]"
    let result = system(cmd)
    echo result . " words"
endfunction

" command WC call WC()




" let c_minlines=-1
autocmd BufEnter * :syntax sync fromstart


" An example for a vimrc file.
"
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	2002 Sep 19
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.vimrc
"	      for Amiga:  s:.vimrc
"  for MS-DOS and Win32:  $VIM\_vimrc
"	    for OpenVMS:  sys$login:.vimrc

" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

if v:progname =~? "gvim"
   colorscheme darkblue
endif
" set number
" to turn autocomments off ...
set fo-=r

" setlocal spell spelllang=en

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
" set nocompatible


" allow backspacing over everything in insert mode
set backspace=indent,eol,start

if has("vms")
  set nobackup		" do not keep a backup file, use versions instead
else
  set backup		" keep a backup file
endif
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

" Don't use Ex mode, use Q for formatting
map Q gq

" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
set t_Co=256
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

" Only do this part when compiled with support for autocommands.

if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
 " filetype plugin indent on

  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
  au!

   " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal g`\"" |
    \ endif

  augroup END

else

  " set autoindent		" always set autoindenting on


endif " has("autocmd")

highlight DiffAdd    cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffText   cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red

" if &diff
"     colorscheme evening
" endif
"

" set mouse=a