Guest User

Untitled

a guest
Jul 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.15 KB | None | 0 0
  1. syntax on
  2. set autoindent
  3. set cindent
  4. set sw=4
  5. set ts=4
  6.  
  7. " Wrap too long lines
  8. set wrap
  9.  
  10. " Tabs are 2 characters
  11. set tabstop=4
  12.  
  13. " (Auto)indent uses 2 characters
  14. set shiftwidth=4
  15.  
  16. " spaces instead of tabs
  17. set expandtab
  18.  
  19. " guess indentation
  20. set autoindent
  21.  
  22. " Expand the command line using tab
  23. set wildchar=<Tab>
  24.  
  25. " show line numbers
  26. set number
  27.  
  28. " Fold using markers {
  29. " {{
  30. " like this
  31. " }}}
  32. set foldmethod=marker
  33.  
  34. " enable all features
  35. set nocompatible
  36.  
  37. " powerful backspaces
  38. set backspace=indent,eol,start
  39.  
  40. " highlight the searchterms
  41. set hlsearch
  42.  
  43. " jump to the matches while typing
  44. set incsearch
  45.  
  46. " ignore case while searching
  47. set ignorecase
  48.  
  49. " don't wrap words
  50. set textwidth=0
  51.  
  52. " history
  53. set history=50
  54.  
  55. " 1000 undo levels
  56. set undolevels=1000
  57.  
  58. " show a ruler
  59. set ruler
  60.  
  61. " show partial commands
  62. set showcmd
  63.  
  64. " show matching braces
  65. set showmatch
  66.  
  67. " write before hiding a buffer
  68. set autowrite
  69.  
  70. " allows hidden buffers to stay unsaved, but we do not want this, so comment
  71. " it out:
  72. "set hidden
  73.  
  74. "set wmh=0
  75.  
  76. " auto-detect the filetype
  77. filetype plugin indent on
  78.  
  79. " syntax highlight
  80. syntax on
  81.  
  82. " Always show the menu, insert longest match
  83. set completeopt=menuone,longest
  84.  
  85. " When editing a file, always jump to the last known cursor position.
  86. " Don't do it when the position is invalid or when inside an event handler
  87. " (happens when dropping a file on gvim).
  88. autocmd BufReadPost *
  89. \ if line("'\"") > 0 && line("'\"") <= line("$") |
  90. \ exe "normal g`\"" |
  91. \ endif
  92.  
  93. " I like highlighting strings inside C comments
  94. let c_comment_strings=1
  95.  
  96. set encoding=utf-8
  97. set scrolloff=3
  98. set autoindent
  99. set showmode
  100. set showcmd
  101. set hidden
  102. set wildmenu
  103. set wildmode=list:longest
  104. set visualbell
  105. set cursorline
  106. set ttyfast
  107. set laststatus=2
  108. "set relativenumber
  109. set undofile
  110.  
  111. nnoremap / /\v
  112. vnoremap / /\v
  113. set ignorecase
  114. set smartcase
  115. set gdefault
  116.  
  117.  
  118. " handling long lines
  119. set wrap
  120. set textwidth=79
  121. set formatoptions=qrn1
  122. set colorcolumn=80
  123.  
  124.  
  125. " disabling some keys
  126. nnoremap <up> <nop>
  127. nnoremap <down> <nop>
  128. nnoremap <left> <nop>
  129. nnoremap <right> <nop>
  130. inoremap <up> <nop>
  131. inoremap <down> <nop>
  132. inoremap <left> <nop>
  133. inoremap <right> <nop>
  134. nnoremap j gj
  135. nnoremap k gk
  136.  
  137. " save file on losing focus of vim
  138. au FocusLost * :wa
  139.  
  140. " let / + w open new vertical split and switch to it
  141. nnoremap <leader>w <C-w>v<C-w>l
  142.  
  143. " remove some gui widgets
  144. :set guioptions-=m "remove menu bar
  145. :set guioptions-=T "remove toolbar
  146. :set guioptions-=r "remove right-hand scroll bar
  147.  
  148. " use file dir as working dir
  149. set autochdir
  150.  
  151. map <F5> :call CompileRunGcc()<CR>
  152. map <F8> : call CompileGcc()<CR>
  153.  
  154. func! CompileRunGcc()
  155. exec "w" "Save the file
  156. exec "make"
  157. exec "elogread.exe"
  158. exec "i" "jump back where we were
  159. endfunc
  160.  
  161. " Save and make current file.o
  162. function! Make()
  163. let curr_dir = expand('%:h')
  164. if curr_dir == ''
  165. let curr_dir = '.'
  166. endif
  167. echo curr_dir
  168. execute 'lcd ' . curr_dir
  169. execute 'make %:r.o'
  170. execute 'lcd -'
  171. endfunction
  172. nnoremap <F7> :update<CR>:call Make()<CR>
  173.  
  174. func! CompileGcc()
  175. exec "w"
  176. exec "!gcc % -o %< && IF EXIST %<.exe (cr 5 && banner -c # Success) ELSE banner -c # Compile Unsuccessful "
  177. exec "i"
  178. endfun
  179.  
  180. set undodir=E:/backup/vim/undo
  181.  
  182. " Setup backup location and enable
  183. set backupdir=E:/backup/vim
  184. set backup
  185.  
  186. " Set Swap directory
  187. set directory=E:/backup/vim/swap
  188.  
  189. " GUI Settings {
  190. if has("gui_running")
  191. " Basics {
  192. colorscheme mustang " my color scheme (only works in GUI)
  193. set columns=180 " perfect size for me
  194. set guifont=Consolas:h11 " My favorite font
  195. set guioptions=ce
  196. " ||
  197. " |+-- use simple dialogs rather than pop-ups
  198. " + use GUI tabs, not console style tabs
  199. set lines=55 " perfect size for me
  200. " set mousehide " hide the mouse cursor when typing
  201. language messages en
  202. set langmenu=en_US.UTF-8
  203. " }
  204.  
  205. " Font Switching Binds {
  206. map <F8> <ESC>:set guifont=Consolas:h8<CR>
  207. map <F9> <ESC>:set guifont=Consolas:h11<CR>
  208. map <F10> <ESC>:set guifont=Consolas:h12<CR>
  209. map <F11> <ESC>:set guifont=Consolas:h16<CR>
  210. map <F12> <ESC>:set guifont=Consolas:h20<CR>
  211. " }
  212. endif
  213. " }
  214.  
  215. " NERDTree Customization
  216. let NERDChristmasTree=1
  217. let NERDTreeIgnore=['\.o$', '\.exe$', '\.dll$']
Add Comment
Please, Sign In to add comment