fork download
  1. " The default vimrc file.
  2. "
  3. " Maintainer: Bram Moolenaar <Bram@vim.org>
  4. " Last change: 2017 Jun 13
  5. "
  6. " This is loaded if no vimrc file was found.
  7. " Except when Vim is run with "-u NONE" or "-C".
  8. " Individual settings can be reverted with ":set option&".
  9. " Other commands can be reverted as mentioned below.
  10.  
  11. " When started as "evim", evim.vim will already have done these settings.
  12. if v:progname =~? "evim"
  13. finish
  14. endif
  15.  
  16. " Bail out if something that ran earlier, e.g. a system wide vimrc, does not
  17. " want Vim to use these default values.
  18. if exists('skip_defaults_vim')
  19. finish
  20. endif
  21.  
  22. " Use Vim settings, rather than Vi settings (much better!).
  23. " This must be first, because it changes other options as a side effect.
  24. " Avoid side effects when it was already reset.
  25. if &compatible
  26. set nocompatible
  27. endif
  28.  
  29. " When the +eval feature is missing, the set command above will be skipped.
  30. " Use a trick to reset compatible only when the +eval feature is missing.
  31. silent! while 0
  32. set nocompatible
  33. silent! endwhile
  34.  
  35. " Allow backspacing over everything in insert mode.
  36. set backspace=indent,eol,start
  37.  
  38. set history=200 " keep 200 lines of command line history
  39. set ruler " show the cursor position all the time
  40. set showcmd " display incomplete commands
  41. set wildmenu " display completion matches in a status line
  42.  
  43. set ttimeout " time out for key codes
  44. set ttimeoutlen=100 " wait up to 100ms after Esc for special key
  45.  
  46. " Show @@@ in the last line if it is truncated.
  47. set display=truncate
  48.  
  49. " Show a few lines of context around the cursor. Note that this makes the
  50. " text scroll if you mouse-click near the start or end of the window.
  51. set scrolloff=5
  52.  
  53. " Do incremental searching when it's possible to timeout.
  54. if has('reltime')
  55. set incsearch
  56. endif
  57.  
  58. " Do not recognize octal numbers for Ctrl-A and Ctrl-X, most users find it
  59. " confusing.
  60. set nrformats-=octal
  61.  
  62. " For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries.
  63. if has('win32')
  64. set guioptions-=t
  65. endif
  66.  
  67. " Don't use Ex mode, use Q for formatting.
  68. " Revert with ":unmap Q".
  69. map Q gq
  70.  
  71. " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
  72. " so that you can undo CTRL-U after inserting a line break.
  73. " Revert with ":iunmap <C-U>".
  74. inoremap <C-U> <C-G>u<C-U>
  75.  
  76. " In many terminal emulators the mouse works just fine. By enabling it you
  77. " can position the cursor, Visually select and scroll with the mouse.
  78. if has('mouse')
  79. set mouse=
  80. endif
  81.  
  82. " Switch syntax highlighting on when the terminal has colors or when using the
  83. " GUI (which always has colors).
  84. if &t_Co > 2 || has("gui_running")
  85. " Revert with ":syntax off".
  86. syntax on
  87.  
  88. " I like highlighting strings inside C comments.
  89. " Revert with ":unlet c_comment_strings".
  90. let c_comment_strings=1
  91. endif
  92.  
  93. " Only do this part when compiled with support for autocommands.
  94. if has("autocmd")
  95.  
  96. " Enable file type detection.
  97. " Use the default filetype settings, so that mail gets 'tw' set to 72,
  98. " 'cindent' is on in C files, etc.
  99. " Also load indent files, to automatically do language-dependent indenting.
  100. " Revert with ":filetype off".
  101. filetype plugin indent on
  102.  
  103. " Put these in an autocmd group, so that you can revert them with:
  104. " ":augroup vimStartup | au! | augroup END"
  105. augroup vimStartup
  106. au!
  107.  
  108. " When editing a file, always jump to the last known cursor position.
  109. " Don't do it when the position is invalid, when inside an event handler
  110. " (happens when dropping a file on gvim) and for a commit message (it's
  111. " likely a different one than last time).
  112. autocmd BufReadPost *
  113. \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
  114. \ | exe "normal! g`\""
  115. \ | endif
  116.  
  117. augroup END
  118.  
  119. endif " has("autocmd")
  120.  
  121. " Convenient command to see the difference between the current buffer and the
  122. " file it was loaded from, thus the changes you made.
  123. " Only define it when not defined already.
  124. " Revert with: ":delcommand DiffOrig".
  125. if !exists(":DiffOrig")
  126. command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
  127. \ | wincmd p | diffthis
  128. endif
  129.  
  130. if has('langmap') && exists('+langremap')
  131. " Prevent that the langmap option applies to characters that result from a
  132. " mapping. If set (default), this may break plugins (but it's backward
  133. " compatible).
  134. set nolangremap
  135. endif
  136.  
  137. "USERSCRIT
  138.  
  139. if empty(glob('~/.vim/autoload/plug.vim'))
  140. silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
  141. \ https://r...content-available-to-author-only...t.com/junegunn/vim-plug/master/plug.vim
  142. autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
  143. endif
  144.  
  145. call plug#begin('~/.vim/plugged')
  146. " 把要安裝的套件寫在這裡
  147. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  148. Plug 'jistr/vim-nerdtree-tabs'
  149. Plug 'ludovicchabant/vim-gutentags'
  150. Plug 'skywind3000/gutentags_plus'
  151. call plug#end()
  152.  
  153. "USER
  154.  
  155. let g:autocscope_menus=0
  156. "[NERDTREE]
  157. " 關閉NERDTree快捷鍵
  158. "map <leader>t :NERDTreeToggle<CR>
  159. " 顯示行號
  160. let NERDTreeShowLineNumbers=0
  161. let NERDTreeAutoCenter=0
  162. " 是否顯示隱藏文件
  163. let NERDTreeShowHidden=1
  164. " 設置寬度
  165. let NERDTreeWinSize=20
  166. " 在終端啟動vim時,共享NERDTree
  167. let g:nerdtree_tabs_open_on_console_startup=2
  168. " 忽略一下文件的顯示
  169. let NERDTreeIgnore=['\.pyc','\~$','\.swp']
  170. " 顯示書籤列表
  171. let NERDTreeShowBookmarks=0
  172.  
  173. "[GTAGS]
  174. " enable gtags module
  175. let g:gutentags_modules = ['ctags', 'gtags_cscope']
  176. " config project root markers.
  177. let g:gutentags_project_root = ['.root']
  178. " generate datebases in my cache directory, prevent gtags files polluting my project
  179. let g:gutentags_cache_dir = expand('~/.cache/tags')
  180. " change focus to quickfix window after search (optional).
  181. let g:gutentags_plus_switch = 1
  182.  
  183. set tabstop=4
  184. set shiftwidth=4
  185. set ts=4
  186. set nu!
  187. set expandtab
  188. "autocmd FileType make setlocal noexpandtab
  189. "colorscheme torte
  190.  
  191. set ai
  192. set cursorline
  193.  
  194. "不用vi模式
  195. set nocompatible
  196.  
  197. set mouse=""
  198. "顯示顏色
  199. syntax on
  200. "設定backspace
  201. set backspace=indent,eol,start
  202.  
  203. set nobackup "表示不需要備份文件
  204. set noswapfile "表示不創建臨時交換文件
  205. "set nowritebackup "表示編輯的時候不需要備份文件
  206. set noundofile "表示不創建撤銷文件
  207. "set clipboard=unnamed
  208. nnoremap <silent> <F5> :NERDTree<CR>
  209. nnoremap <silent> <tab> gt<CR>
  210. nnoremap <silent> <d-tab> gT<CR>
  211.  
  212.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty