Advertisement
pupil337

.vimrc

Jun 26th, 2024 (edited)
840
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 1.96 KB | None | 0 0
  1. " An example for a vimrc file.
  2. "
  3. " Maintainer:   The Vim Project <https://github.com/vim/vim>
  4. " Last Change:  2023 Aug 10
  5. " Former Maintainer:    Bram Moolenaar <Bram@vim.org>
  6. "
  7. " To use it, copy it to
  8. "          for Unix:  ~/.vimrc
  9. "         for Amiga:  s:.vimrc
  10. "    for MS-Windows:  $VIM\_vimrc
  11. "         for Haiku:  ~/config/settings/vim/vimrc
  12. "       for OpenVMS:  sys$login:.vimrc
  13.  
  14. " When started as "evim", evim.vim will already have done these settings, bail
  15. " out.
  16. if v:progname =~? "evim"
  17.     finish
  18. endif
  19.  
  20. " Get the defaults that most users want.
  21. source $VIMRUNTIME/defaults.vim
  22.  
  23. if has("vms")
  24.     set nobackup        " do not keep a backup file, use versions instead
  25. else
  26.     set backup      " keep a backup file (restore to previous version)
  27.     if has('persistent_undo')
  28.         set undofile    " keep an undo file (undo changes after closing)
  29.     endif
  30. endif
  31.  
  32. if &t_Co > 2 || has("gui_running")
  33.     " Switch on highlighting the last used search pattern.
  34.     set hlsearch
  35. endif
  36.  
  37. " Put these in an autocmd group, so that we can delete them easily.
  38. augroup vimrcEx
  39.     au!
  40.  
  41.     " For all text files set 'textwidth' to 78 characters.
  42.     autocmd FileType text setlocal textwidth=78
  43. augroup END
  44.  
  45. " Add optional packages.
  46. "
  47. " The matchit plugin makes the % command work better, but it is not backwards
  48. " compatible.
  49. " The ! means the package won't be loaded right away but when plugins are
  50. " loaded during initialization.
  51. if has('syntax') && has('eval')
  52.     packadd! matchit
  53. endif
  54.  
  55. " 不兼容vi
  56. set nocompatible
  57.  
  58. " 文件编码
  59. set encoding=utf-8
  60.  
  61. " 制表符
  62. set noexpandtab
  63. set shiftwidth=4
  64. set tabstop=4
  65. set softtabstop=4
  66. set autoindent
  67. set smartindent
  68. set cindent
  69.  
  70. " 状态栏
  71. set statusline=%-040.40(%F%m%)%-030.30([%l,%c]%)%p%%
  72. set laststatus=2
  73. set showcmd
  74. set showmode
  75.  
  76. " 行号
  77. set number
  78. set relativenumber
  79.  
  80. " 补全模式
  81. set wildmenu
  82. set wildmode=longest,list,full
  83.  
  84. " 配色
  85. set t_Co=256
  86. colorscheme slate
  87.  
  88. " 列表
  89. " set list
  90. set listchars=eol:$,tab:>-,space:_
  91.  
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement