Advertisement
FamiHug

hvn'svimrc

Aug 5th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1.  
  2. " An example for a vimrc file.
  3. "
  4. " Maintainer: Bram Moolenaar <[email protected]>
  5. " Last change: 2008 Dec 17
  6. "
  7. " To use it, copy it to
  8. " for Unix and OS/2: ~/.vimrc
  9. " for Amiga: s:.vimrc
  10. " for MS-DOS and Win32: $VIM\_vimrc
  11. " for OpenVMS: sys$login:.vimrc
  12.  
  13. " When started as "evim", evim.vim will already have done these settings.
  14. if v:progname =~? "evim"
  15. finish
  16. endif
  17.  
  18. " Use Vim settings, rather than 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=50 " keep 50 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.  
  35. " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
  36. " let &guioptions = substitute(&guioptions, "t", "", "g")
  37.  
  38. " Don't use Ex mode, use Q for formatting
  39. map Q gq
  40.  
  41. " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
  42. " so that you can undo CTRL-U after inserting a line break.
  43. inoremap <C-U> <C-G>u<C-U>
  44.  
  45. " In many terminal emulators the mouse works just fine, thus enable it.
  46. if has('mouse')
  47. set mouse=a
  48. endif
  49.  
  50. " Switch syntax highlighting on, when the terminal has colors
  51. " Also switch on highlighting the last used search pattern.
  52. if &t_Co > 2 || has("gui_running")
  53. syntax on
  54. set hlsearch
  55. endif
  56.  
  57. " Only do this part when compiled with support for autocommands.
  58. if has("autocmd")
  59.  
  60. " Enable file type detection.
  61. " Use the default filetype settings, so that mail gets 'tw' set to 72,
  62. " 'cindent' is on in C files, etc.
  63. " Also load indent files, to automatically do language-dependent indenting.
  64. filetype plugin indent on
  65.  
  66. " Put these in an autocmd group, so that we can delete them easily.
  67. augroup vimrcEx
  68. au!
  69.  
  70. " For all text files set 'textwidth' to 78 characters.
  71. autocmd FileType text setlocal textwidth=78
  72.  
  73. " When editing a file, always jump to the last known cursor position.
  74. " Don't do it when the position is invalid or when inside an event handler
  75. " (happens when dropping a file on gvim).
  76. " Also don't do it when the mark is in the first line, that is the default
  77. " position when opening a file.
  78. autocmd BufReadPost *
  79. \ if line("'\"") > 1 && 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. " Convenient command to see the difference between the current buffer and the
  92. " file it was loaded from, thus the changes you made.
  93. " Only define it when not defined already.
  94. if !exists(":DiffOrig")
  95. command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
  96. \ | wincmd p | diffthis
  97. endif
  98. set nu
  99. set ts=4
  100. set hlsearch
  101. set sw=4
  102. set cindent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement