Advertisement
Guest User

Boris Bolgradov

a guest
Sep 14th, 2009
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. " An example for a vimrc file.
  2. "
  3. " Maintainer: Bram Moolenaar <Bram@vim.org>
  4. " Last change: 2008 Jul 02
  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. " Use Vim settings, rather then Vi settings (much better!).
  18. " This must be first, because it changes other options as a side effect.
  19. set nocompatible
  20.  
  21. " allow backspacing over everything in insert mode
  22. set backspace=indent,eol,start
  23.  
  24. set history=50 " keep 50 lines of command line history
  25. set ruler " show the cursor position all the time
  26. set showcmd " display incomplete commands
  27. set incsearch " do incremental searching
  28.  
  29. " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
  30. " let &guioptions = substitute(&guioptions, "t", "", "g")
  31.  
  32. " Don't use Ex mode, use Q for formatting
  33. map Q gq
  34.  
  35. " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
  36. " so that you can undo CTRL-U after inserting a line break.
  37. inoremap <C-U> <C-G>u<C-U>
  38.  
  39. " In many terminal emulators the mouse works just fine, thus enable it.
  40. if has('mouse')
  41. set mouse=a
  42. endif
  43.  
  44. " Switch syntax highlighting on, when the terminal has colors
  45. " Also switch on highlighting the last used search pattern.
  46. if &t_Co > 2 || has("gui_running")
  47. syntax on
  48. set hlsearch
  49. endif
  50.  
  51. " Only do this part when compiled with support for autocommands.
  52. if has("autocmd")
  53.  
  54. " Enable file type detection.
  55. " Use the default filetype settings, so that mail gets 'tw' set to 72,
  56. " 'cindent' is on in C files, etc.
  57. " Also load indent files, to automatically do language-dependent indenting.
  58. filetype plugin indent on
  59.  
  60. " Put these in an autocmd group, so that we can delete them easily.
  61. augroup vimrcEx
  62. au!
  63.  
  64. " For all text files set 'textwidth' to 78 characters.
  65. autocmd FileType text setlocal textwidth=78
  66.  
  67. " When editing a file, always jump to the last known cursor position.
  68. " Don't do it when the position is invalid or when inside an event handler
  69. " (happens when dropping a file on gvim).
  70. " Also don't do it when the mark is in the first line, that is the default
  71. " position when opening a file.
  72. autocmd BufReadPost *
  73. \ if line("'\"") > 1 && line("'\"") <= line("$") |
  74. \ exe "normal! g`\"" |
  75. \ endif
  76.  
  77. augroup END
  78.  
  79. else
  80.  
  81. set autoindent " always set autoindenting on
  82.  
  83. endif " has("autocmd")
  84.  
  85. " Convenient command to see the difference between the current buffer and the
  86. " file it was loaded from, thus the changes you made.
  87. " Only define it when not defined already.
  88. if !exists(":DiffOrig")
  89. command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
  90. \ | wincmd p | diffthis
  91. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement