Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. set nocompatible " be iMproved, required
  2. filetype off " required
  3. set rtp+=~/.vim/bundle/Vundle.vim
  4. call vundle#begin()
  5. Plugin 'VundleVim/Vundle.vim'
  6. call vundle#end() " required
  7. filetype plugin indent on " required
  8.  
  9. set nu
  10.  
  11. filetype plugin indent on
  12.  
  13. set smartindent
  14.  
  15. colo evening
  16.  
  17. syntax on
  18.  
  19. set langmenu=zh_CN.UTF-8
  20.  
  21. set helplang=cn
  22.  
  23. set autoread
  24.  
  25. set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
  26.  
  27. set termencoding=utf-8
  28.  
  29. set encoding=utf-8
  30.  
  31. set fileencodings=ucs-bom,utf-8,cp936
  32.  
  33. filetype plugin on
  34.  
  35. set clipboard+=unnamed
  36.  
  37. set nobackup
  38.  
  39. set autowrite
  40.  
  41. set ruler
  42.  
  43. set cursorline
  44.  
  45. set nocompatible
  46.  
  47. set noeb
  48.  
  49. set confirm
  50.  
  51. set tabstop=4
  52.  
  53. set softtabstop=4
  54.  
  55. set shiftwidth=4
  56.  
  57. set expandtab
  58.  
  59. set smarttab
  60.  
  61. set nobackup
  62.  
  63. set noswapfile
  64.  
  65. set ignorecase
  66.  
  67. set cmdheight=2
  68.  
  69. filetype on
  70.  
  71. filetype plugin on
  72.  
  73. filetype indent on
  74.  
  75. set mouse=a
  76.  
  77. set selection=exclusive
  78.  
  79. set selectmode=mouse,key
  80.  
  81. set showmatch
  82.  
  83. set matchtime=3
  84.  
  85. set scrolloff=3
  86.  
  87. autocmd vimenter * NERDTree
  88.  
  89. autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()"
  90. func SetTitle()
  91. if &filetype == 'sh'
  92. call setline(1,"\#########################################################################")
  93. call append(line("."), "\# File Name: ".expand("%"))
  94. call append(line(".")+1, "\# Author: Rylynnn")
  95. call append(line(".")+2, "\# Mail: jingry0321@gmail.com")
  96. call append(line(".")+3, "\# Created Time: ".strftime("%c"))
  97. call append(line(".")+4, "\#########################################################################")
  98. call append(line(".")+5, "\#!/bin/bash")
  99. call append(line(".")+6, "")
  100. else
  101. call setline(1, "/*************************************************************************")
  102. call append(line("."), " > File Name: ".expand("%"))
  103. call append(line(".")+1, " > Author: Rylynnn")
  104. call append(line(".")+2, " > Mail: jingry0321@gmail.com")
  105. call append(line(".")+3, " > Created Time: ".strftime("%c"))
  106. call append(line(".")+4, " ************************************************************************/")
  107. call append(line(".")+5, "")
  108. endif
  109. if &filetype == 'cpp'
  110. call append(line(".")+6, "#include <iostream>")
  111. call append(line(".")+7, "#include <fstream>")
  112. call append(line(".")+8, "#include <cmath>")
  113. call append(line(".")+9, "#include <cstdio>")
  114. call append(line(".")+10, "#include <cstdlib>")
  115. call append(line(".")+11, "#include <climits>")
  116. call append(line(".")+12, "#include <cstring>")
  117. call append(line(".")+13, "#include <iomanip>")
  118. call append(line(".")+14, "#include <algorithm>")
  119. call append(line(".")+15, "#include <map>")
  120. call append(line(".")+16, "#include <set>")
  121. call append(line(".")+17, "#include <queue>")
  122. call append(line(".")+18, "#include <deque>")
  123. call append(line(".")+19, "#include <string>")
  124. call append(line(".")+20, "using namespace std;")
  125. call append(line(".")+21, "")
  126. endif
  127. if &filetype == 'c'
  128. call append(line(".")+6, "#include <stdio.h>")
  129. call append(line(".")+7, "#include <stdlib.h>")
  130. call append(line(".")+8, "#include <math.h>")
  131. call append(line(".")+9, "")
  132. endif
  133. if &filetype == 'py'
  134. call append(line(".")+6, "#!/usr/bin/env python")
  135. call append(line(".")+7, "# -*- coding: utf-8 -*-")
  136. call append(line(".")+19, "")
  137. endif
  138. autocmd BufNewFile * normal G
  139. endfunc
  140.  
  141. nmap <leader>w :w!<cr>
  142.  
  143. nmap <leader>f :find<cr>
  144.  
  145. map <C-A> ggVGY
  146.  
  147. map! <C-A> <Esc>ggVGY
  148.  
  149. map <F12> gg=G
  150.  
  151. vmap <C-c> "+y
  152.  
  153. map <F5> :call CompileRunGcc()<CR>
  154. func! CompileRunGcc()
  155. exec "w"
  156. if &filetype == 'c'
  157. exec "!g++ % -o %<"
  158. exec "! ./%<"
  159. elseif &filetype == 'cpp'
  160. exec "!g++ % -o %<"
  161. exec "! ./%<"
  162. elseif &filetype == 'java'
  163. exec "!javac %"
  164. exec "!java %<"
  165. elseif &filetype == 'sh'
  166. :!./%
  167. endif
  168. endfunc
  169.  
  170. map <F8> :call Rungdb()<CR>
  171. func! Rungdb()
  172. exec "w"
  173. exec "!g++ % -g -o %<"
  174. exec "!gdb ./%<"
  175. endfunc
  176.  
  177. autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>
  178.  
  179. execute pathogen#infect()
  180. Plugin 'godlygeek/tabular'
  181. Plugin 'plasticboy/vim-markdown'
  182. call pathogen#helptags()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement