Advertisement
Guest User

vimrc

a guest
Mar 3rd, 2015
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.67 KB | None | 0 0
  1. " General shenanigans
  2.  
  3. "" not vi-compatible mode
  4. set nocompatible
  5.  
  6. "" persistent undos
  7. set undodir=$HOME/.vim/undo
  8. set undofile
  9. set undolevels=1000
  10. set undoreload=10000
  11.  
  12. "" much to do with folds
  13. " highlight folds lightly, fold on syntax, only nest 2 folds deep
  14. highlight folded ctermbg=233
  15. set foldmethod=syntax
  16. set foldnestmax=2
  17.  
  18. " save and load folds automatically
  19. autocmd BufWinLeave *.* mkview!
  20. autocmd BufWinEnter *.* silent loadview
  21.  
  22. "Plugins
  23.  
  24. ""vundle
  25. "filetype must be off for vundle commands
  26. filetype off
  27. set rtp+=$HOME/.vim/bundle/vundle
  28. call vundle#begin()
  29. "vundle manages itself, this is required
  30. Plugin 'gmarik/vundle'
  31. "other packages
  32. " autocompletion
  33. Plugin 'Shougo/neocomplete'
  34.  
  35. call vundle#end()
  36. filetype plugin indent on
  37.  
  38. noremap ; l
  39. noremap l k
  40. noremap k j
  41. noremap j h
  42.  
  43. nnoremap <C-n> :nohl<CR>
  44.  
  45. " " tab behavior (all smart/auto, tab = 4 spaces)
  46. set autoindent
  47. set smartindent
  48. set smarttab
  49. set shiftwidth=4
  50. set softtabstop=0
  51. set tabstop=4
  52. set expandtab
  53. ":retab applyes these rules to the current buffer
  54.  
  55. "" show trailing spaces as '_', tabs as '> '
  56. "set list listchars=tab:\ \ ,trail:_,extends:»,precedes:«
  57. set list listchars=tab:▸\ ,eol:¬,extends:»,precedes:«
  58. map <leader>lc :set list!<cr>
  59.  
  60. "" syntax highlighting
  61. syntax on
  62.  
  63. "" numbers in margin
  64. set number
  65.  
  66. "" keep 12 lines above and below the current line when scrolling
  67. set scrolloff=12
  68.  
  69. " " set color scheme
  70. colorscheme custom1
  71.  
  72. " " line break at 80 characters
  73. set formatoptions+=t
  74. set textwidth=80
  75. set wrap linebreak
  76.  
  77. " " highlight current line
  78. highlight cursorline ctermbg=233
  79. noremap <leader>cl :set cursorline!<cr>
  80. set cursorline
  81.  
  82. " Command Behavior
  83.  
  84. " " incrementally search, highlight matches
  85. set incsearch
  86. set hlsearch
  87.  
  88. " Keybindings
  89.  
  90. "" '>' and '<' in normal mode to change tabs
  91. nnoremap > gt
  92. nnoremap < gT
  93.  
  94. "" latex files, @w compiles, @o opens in pdf reader, @p prints the pdf
  95. """ locally compile (if you have pdflatex installed)
  96. "autocmd BufRead,BufNewFile *.tex let @w=':w
  97. :!pdflatex %:r; bibtex %:r; pdflatex %:r; pdflatex %:r
  98. '
  99. """ call serv_tex, a script which uploads and remotely compiles latex
  100. "autocmd BufRead,BufNewFile *.tex let @w=':wa
  101. :!ssh_tex m_mh247 %:r
  102. '
  103. autocmd BufRead,BufNewFile *.tex let @w=':wa
  104. :!pdflatex %:r
  105. '
  106. \ | let @o=':!mupdf %:r.pdf &> /dev/null &
  107. '
  108. " \ | let @p=':wa
  109. :!ssh_print m_mh247 %:r.pdf
  110. '
  111.  
  112. """ start settings for neocomplete
  113. " Disable AutoComplPop.
  114. let g:acp_enableAtStartup = 0
  115. " Use neocomplete.
  116. let g:neocomplete#enable_at_startup = 1
  117. " Use smartcase.
  118. let g:neocomplete#enable_smart_case = 1
  119. " Set minimum syntax keyword length.
  120. let g:neocomplete#sources#syntax#min_keyword_length = 3
  121. let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
  122.  
  123. " Define dictionary.
  124. let g:neocomplete#sources#dictionary#dictionaries = {
  125. \ 'default' : '',
  126. \ 'vimshell' : $HOME.'/.vimshell_hist',
  127. \ 'scheme' : $HOME.'/.gosh_completions'
  128. \ }
  129.  
  130. " Define keyword.
  131. if !exists('g:neocomplete#keyword_patterns')
  132. let g:neocomplete#keyword_patterns = {}
  133. endif
  134. let g:neocomplete#keyword_patterns['default'] = '\h\w*'
  135.  
  136. " Plugin key-mappings.
  137. inoremap <expr><C-g> neocomplete#undo_completion()
  138. inoremap <expr><C-l> neocomplete#complete_common_string()
  139.  
  140. " Recommended key-mappings.
  141. " <CR>: close popup and save indent.
  142. inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
  143. function! s:my_cr_function()
  144. return neocomplete#close_popup() . "\<CR>"
  145. " For no inserting <CR> key.
  146. "return pumvisible() ? neocomplete#close_popup() : "\<CR>"
  147. endfunction
  148. " <TAB>: completion.
  149. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  150. " <C-h>, <BS>: close popup and delete backword char.
  151. inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
  152. inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
  153. inoremap <expr><C-y> neocomplete#close_popup()
  154. inoremap <expr><C-e> neocomplete#cancel_popup()
  155. " Close popup by <Space>.
  156. "inoremap <expr><Space> pumvisible() ? neocomplete#close_popup() : "\<Space>"
  157.  
  158. " For cursor moving in insert mode(Not recommended)
  159. "inoremap <expr><Left> neocomplete#close_popup() . "\<Left>"
  160. "inoremap <expr><Right> neocomplete#close_popup() . "\<Right>"
  161. "inoremap <expr><Up> neocomplete#close_popup() . "\<Up>"
  162. "inoremap <expr><Down> neocomplete#close_popup() . "\<Down>"
  163. " Or set this.
  164. "let g:neocomplete#enable_cursor_hold_i = 1
  165. " Or set this.
  166. "let g:neocomplete#enable_insert_char_pre = 1
  167.  
  168. " AutoComplPop like behavior.
  169. "let g:neocomplete#enable_auto_select = 1
  170.  
  171. " Shell like behavior(not recommended).
  172. "set completeopt+=longest
  173. "let g:neocomplete#enable_auto_select = 1
  174. "let g:neocomplete#disable_auto_complete = 1
  175. "inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
  176.  
  177. " Enable omni completion.
  178. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  179. autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  180. autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
  181. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  182. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  183.  
  184. " Enable heavy omni completion.
  185. if !exists('g:neocomplete#sources#omni#input_patterns')
  186. let g:neocomplete#sources#omni#input_patterns = {}
  187. endif
  188. "let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
  189. "let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
  190. "let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
  191.  
  192. " For perlomni.vim setting.
  193. " https://github.com/c9s/perlomni.vim
  194. let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
  195.  
  196. """ end settings for neocomplete
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement