Advertisement
medmond919

VIM Example

Apr 8th, 2018
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. " An example for a vimrc file.
  2. "
  3. " Maintainer:   Bram Moolenaar <Bram@vim.org>
  4. " Last change:  2002 Sep 19
  5. "
  6. " To use it, copy it to
  7. "     for Unix and OS/2:  ~/.vimrc
  8. "         for Amiga:  s:.vimrc
  9. "  for MS-DOS and Win32:  $VIM\_vimrc
  10. "       for OpenVMS:  sys$login:.vimrc
  11.  
  12. " When started as "evim", evim.vim will already have done these settings.
  13. if v:progname =~? "evim"
  14.   finish
  15. endif
  16.  
  17. set t_Co=256
  18. " Use Vim settings, rather then Vi settings (much better!).
  19. " This must be first, because it changes other options as a side effect.
  20. set nocompatible
  21.  
  22. " allow backspacing over everything in insert mode
  23. set backspace=indent,eol,start
  24.  
  25. if has("vms")
  26.   set nobackup      " do not keep a backup file, use versions instead
  27. else
  28.   set backup        " keep a backup file
  29. endif
  30. set history=1000    " keep 1000 lines of command line history
  31. set ruler       " show the cursor position all the time
  32. set showcmd     " display incomplete commands
  33. set incsearch       " do incremental searching
  34. set hidden
  35. set ignorecase
  36. set smartcase
  37. set scrolloff=3
  38. set title
  39. nnoremap ' `        " backtick is more useful for marks
  40. nnoremap ` '
  41.  
  42. " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
  43. " let &guioptions = substitute(&guioptions, "t", "", "g")
  44.  
  45. " Don't use Ex mode, use Q for formatting
  46. map Q gq
  47.  
  48. " This is an alternative that also works in block mode, but the deleted
  49. " text is lost and it only works for putting the current register.
  50. "vnoremap p "_dp
  51.  
  52. " Switch syntax highlighting on, when the terminal has colors
  53. " Also switch on highlighting the last used search pattern.
  54. if &t_Co > 2 || has("gui_running")
  55.   syntax on
  56.   set hlsearch
  57. endif
  58.  
  59. " Only do this part when compiled with support for autocommands.
  60. if has("autocmd")
  61.  
  62.   " Enable file type detection.
  63.   " Use the default filetype settings, so that mail gets 'tw' set to 72,
  64.   " 'cindent' is on in C files, etc.
  65.   " Also load indent files, to automatically do language-dependent indenting.
  66.   filetype plugin indent on
  67.  
  68.   " Put these in an autocmd group, so that we can delete them easily.
  69.   augroup vimrcEx
  70.   au!
  71.  
  72.   " For all text files set 'textwidth' to 78 characters.
  73.   autocmd FileType text setlocal textwidth=78
  74.  
  75.   " When editing a file, always jump to the last known cursor position.
  76.   " Don't do it when the position is invalid or when inside an event handler
  77.   " (happens when dropping a file on gvim).
  78.   autocmd BufReadPost *
  79.     \ if line("'\"") > 0 && line("'\"") <= line("$") |
  80.     \   exe "normal g`\"" |
  81.     \ endif
  82.  
  83.   augroup END
  84.  
  85. else
  86.  
  87.   set autoindent        " always set autoindenting on
  88.  
  89. endif " has("autocmd")
  90.  
  91. set number
  92. iab vehilce vehicle
  93. iab vehilces vehicles
  94. set showmode
  95. set nowrap
  96. set laststatus=2
  97. set statusline=[%n]\ %<%f\ %((%1*%M%*%R%Y)%)\ %=%-19(\LINE\ [%3l/%3L]\ COL\ [%02c%03V]%)\ ascii['%02b']\ %P
  98. imap jj <Esc>
  99. vmap <silent> g/y/=substitute(escape(@", '\\/.*$^~[]'), '\n','\\n','g')
  100.  
  101. "set fdm=syntax
  102. set backupdir=~/.vim/backup
  103. "----------------------------------------
  104. " Highlight a particular csv column (put in .vimrc)
  105. function! CSVH(x)
  106.     execute 'match Keyword /^\([^,]*,\)\{'.a:x.'}\zs[^,]*/'
  107.     execute 'normal ^'.a:x.'f,'
  108. endfunction
  109. command! -nargs=1 Csv :call CSVH(<args>)
  110. " call with
  111. ":Csv 5                             : highlight fifth column
  112. autocmd BufRead *.erb set filetype=eruby
  113. set wildmenu
  114. set wildmode=list:longest,full
  115. silent! ruby nil
  116.  
  117. "for HTML.vim to use lower case tags
  118. :let g:html_tag_case = 'lowercase'
  119. set autoread
  120. colorscheme vividchalk
  121. let g:GetLatestVimScripts_allowautoinstall=1
  122. cmap w!! w !sudo tee % >/dev/null<CR>:e!<CR><CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement