Advertisement
JohansRes

Untitled

Apr 6th, 2017
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 14.29 KB | None | 0 0
  1. " BlackEagles vimrc for Linux && Windows
  2. " (c) 2005 - 2015
  3. " nocompatible has to be the first of all ( use the real vimpower )
  4. set nocompatible
  5. " filetype
  6. filetype on
  7. filetype plugin on
  8. filetype indent on
  9. " let $HOME = 'C:\Users\JohansRes\vim-for-php\vimfiles'
  10.  
  11. " set  runtimepath^=$HOME/vim-for-php/vimfiles
  12.  
  13. " let &rtp = substitute(&rtp,'vimfiles','vim-for-php/vimfiles','g')
  14.  
  15. " enable pathogen
  16. " execute pathogen#infect("C:/Users/JohansRes/vim-for-php/vimfiles/bundle/{}")
  17. execute pathogen#infect()
  18. " build helptags
  19. execute pathogen#helptags()
  20.  
  21. " highlight the current cursor line
  22. set cursorline
  23.  
  24.  
  25. "specify the font-size and font-style
  26. set guifont=Ubuntu\ Mono\ derivative\ Powerline\ Nerd\ Font\ 11
  27.  
  28. "change the default browser to preview markdown.
  29. let g:livedown_browser="google-chrome-stable"
  30.  
  31.  
  32. "specify the layout of winmanager
  33.  
  34. "customize  taglist left and nerdtree  right
  35. nmap wm :WMToggle<cr>:TagbarToggle<cr>:wincmd h<cr>
  36.  
  37.  
  38. let g:winManagerWindowLayout='NERDTree|BufExplorer'
  39.  
  40. function! NERDTree_Start()
  41.     exec 'NERDTree'
  42. endfunction
  43.  
  44. function! NERDTree_IsValid()
  45.     return 1
  46. endfunction
  47.  
  48. " Exit taglist when only one window leaves
  49. let Tlist_Exit_OnlyWindow=1
  50.  
  51. " settle for left tagbar  
  52. let g:tagbar_left=1
  53.  
  54. set encoding=utf-8
  55. set fileencodings=utf-8,chinese,ISO-8859,latin-1,
  56. if has("win32")
  57.     set fileencoding=chiness
  58. else
  59.     set fileencoding=utf-8
  60. endif
  61.  
  62. "settle  messey code in menu bar
  63. source $VIMRUNTIME/delmenu.vim
  64. source $VIMRUNTIME/menu.vim
  65.  
  66. "settle messey code in console
  67. "language messages zh_CN.utf-8
  68.  
  69. " dont do matchparen
  70. " let loaded_matchparen = 1
  71.  
  72. " big nesting with new regexpengine is slooooooow
  73. set regexpengine=1
  74.  
  75. " set leader key
  76. let mapleader = ','
  77.  
  78. " WHO ARE YOU ?
  79. let g:AuthorName="jiayin"
  80. let g:AuthorEmail="zhangjiayin99@gmail.com"
  81.  
  82. " DEFAULT WORKSPACE AREA
  83. let g:Workspace="D:/WorkPlace"
  84.  
  85.  
  86.  
  87. syntax on
  88.  
  89. " set the colorsheme
  90. set t_Co=16
  91. let g:wwdc16_term_trans_bg =1
  92. colorscheme dracula
  93.  
  94. " backup rules
  95. set backup
  96. set undofile
  97. if has("win32")
  98.     set backupdir=$TEMP
  99.     set directory=$TEMP
  100.     set viewdir=$TEMP
  101.     set undodir=$TEMP
  102. else
  103.     silent execute '!mkdir -p $HOME/.vim/tmp/backup'
  104.     set backupdir=$HOME/.vim/tmp/backup
  105.     silent execute '!mkdir -p $HOME/.vim/tmp/swap'
  106.     set directory=$HOME/.vim/tmp/swap
  107.     silent execute '!mkdir -p $HOME/.vim/tmp/views'
  108.     set viewdir=$HOME/.vim/tmp/views
  109.     silent execute '!mkdir -p $HOME/.vim/tmp/undo'
  110.     set undodir=$HOME/.vim/tmp/undo
  111. endif
  112.  
  113. " commandline history
  114. set history=1000
  115.  
  116. " backspace stuff
  117. set backspace=indent,eol,start
  118.  
  119. " make higlighting faster
  120. set nocursorcolumn " dont change bg color column on cursorposition
  121. set nocursorline   " dont change bg color line on cursorpostion
  122.  
  123. " allow project specific settings
  124. set secure
  125.  
  126. " some interface options
  127. set ruler                 " show cursorposition
  128. set showcmd               " display incomplete commands
  129.  
  130.  
  131. "set nowrap                " dont wrap long lines
  132. set wrap                  " wrap long lines
  133. set incsearch             " incremental searching
  134. set hlsearch              " highlight searchresult
  135. set relativenumber
  136. set number                " show linennumbers
  137. set linespace=0           " stick together (usefull for nfo files)
  138. set hidden                " hide buffer even when changed
  139. set scrolloff=4           " keep at least 4 lines above or below the cursor
  140. set colorcolumn=80,120    " show column 80 and 120 in different color
  141. set wildmode=longest,full " command completion longest common part, then all.
  142.  
  143. " fileformat stuff
  144. "set fileformat=unix
  145. set encoding=utf-8
  146. set fileencoding=utf-8
  147. "set fileencodings=utf-8,gbk,ucs-bom,cp1250,iso-8859-1
  148.  
  149. " tabstop settings
  150. set tabstop=4     " a tab found in a file will be represented with 4 columns
  151. set softtabstop=4 " when in insert mode <tab> is pressed move 4 columns
  152. set shiftwidth=4  " indentation is 4 columns
  153. set expandtab     " tabs are tabs, do not replace with spaces
  154.  
  155. " statusline stuff
  156. set laststatus=2
  157. "set statusline=%<%F%h\ %(%y\ %)[%{&ff}]\ %{\"[\".(&fenc==\"\"?&enc:&fenc).\"]\"}\ %([%R%M]\ %)%=#%n\ %l/%L,%c%V\ %P
  158. "if has("gui_gtk2") || has("gui_qt")
  159. let g:airline_powerline_fonts=1
  160. " endif
  161. let g:airline#extensions#tabline#enabled = 1
  162. let g:airline#extensions#tabline#tab_nr_type = 1
  163. let g:airline#extensions#whitespace#enabled = 0
  164.  
  165. " diff settings
  166. set diffopt=filler,iwhite,vertical
  167.  
  168. " php settings
  169. "let php_sql_query=0
  170. "let php_htmlInStrings =0
  171. let php_parent_error_close=1
  172. let php_parent_error_open=1
  173.  
  174. " snips author
  175. let g:snips_author = g:AuthorName . " <" . g:AuthorEmail . ">"
  176.  
  177. " AutoClose settings
  178. let g:AutoCloseOn=1 "switch on AutoClose
  179. let g:AutoClosePairs= {'(': ')', '[': ']', '"': '"', "'": "'", '<': '>'}
  180.  
  181. " syntastic
  182. set statusline+=%#warningmsg#
  183. set statusline+=%{SyntasticStatuslineFlag()}
  184. set statusline+=%*
  185.  
  186. let g:syntastic_always_populate_loc_list = 0
  187. let g:syntastic_auto_loc_list = 0
  188. let g:syntastic_check_on_open = 1
  189. let g:syntastic_check_on_wq = 0
  190. "let g:syntastic_java_javac_classpath='/mnt/D/Developer/WorkPlace/Personal-Workplace-Temp/Java/Thief/lib/mysql-connector-java-5.1.39-bin.jar:/mnt/D/Developer/WorkPlace/Personal-Workplace-Temp/Java/Thief/FrameTest2/'
  191. let g:syntastic_java_javac_classpath='./:'
  192. " enable omnifunc
  193. set  omnifunc=syntaxcomplete#Complete
  194.  
  195.  
  196. "Java keymaps (Plugin javacomplete2)
  197. autocmd Filetype java setlocal omnifunc=javacomplete#Complete
  198. autocmd Filetype java map <leader>b :call javacomplete#GoToDefinition()<CR>
  199. "class import
  200. autocmd Filetype java nmap <F4> <Plug>(JavaComplete-Imports-Add) \
  201.    imap <F4> <Plug>(JavaComplete-Imports-Add) \
  202.    "add all missing imports with <F5>
  203.    nmap <F3> <Plug>(JavaComplete-Imports-AddMissing) \
  204.    imap <F3> <Plug>(JavaComplete-Imports-AddMissing) \
  205.    "remove all missing imports with F6
  206.    nmap <F6> <Plug>(JavaComplete-Imports-RemoveUnused) \
  207.    imap <F6> <Plug>(JavaComplete-Imports-RemoveUnused) \
  208. "specify the javafx lib path  
  209. "let g:JavaComplete_LibsPath="/usr/share/java/openjfx/lib/:/mnt/D/Developer/WorkPlace/Personal-Workplace-Temp/Java/Thief/lib/:"
  210. "let g:JavaComplete_LibsPath="/mnt/D/Developer/WorkPlace/Personal-Workplace-Temp/Java/AntTest/lib/:"
  211.  
  212. "let g:JavaComplete_ShowExternalCommandsOutput = 1
  213.  
  214.  
  215.  
  216.  
  217. " SuperTab settings
  218. let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
  219. let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"
  220.  
  221. " Ack.vim
  222. if executable('ag')
  223.     " ack.vim with the_silver_searcher
  224.     let g:ackprg = 'ag --nogroup --nocolor --column --smart-case'
  225. elseif executable('ack-grep')
  226.     " ack.vim with renamed ack
  227.     let g:ackprg="ack-grep -H --nocolor --nogroup --column"
  228. endif
  229.  
  230. " CtrlP
  231. let g:ctrlp_working_path_mode = 'ra'
  232. let g:ctrlp_max_files = 100000
  233. let g:ctrlp_custom_ignore = {
  234.     \ 'dir':  '\.git$\|\.hg$\|\.svn$',
  235.     \ 'file': '\.exe$\|\.so$\|\.dll$\|\.pyc$' }
  236.  
  237. if executable('ag')
  238.     let s:ctrlp_fallback = 'ag %s --nocolor -l -g ""'
  239. elseif executable('ack-grep')
  240.     let s:ctrlp_fallback = 'ack-grep %s --nocolor -f'
  241. elseif executable('ack')
  242.     let s:ctrlp_fallback = 'ack %s --nocolor -f'
  243. else
  244.     let s:ctrlp_fallback = 'find %s -type f'
  245. endif
  246.  
  247. " MatchTagAlways
  248. let g:mta_filetypes = {
  249.     \ 'html' : 1,
  250.     \ 'xhtml' : 1,
  251.     \ 'xml' : 1,
  252.     \ 'jinja' : 1,
  253.     \ 'phtml' : 1,
  254.     \ 'twig' : 1,
  255.     \}
  256.  
  257. " vim-signify
  258. let g:signify_vcs_list = [ 'git', 'hg', 'svn' ]
  259.  
  260. " extra keymappings
  261. " sudo save (when one forgets to sudo vim)
  262. cmap w!! w !sudo tee % >/dev/null
  263.  
  264. " custom mapping
  265. nnoremap <silent> <Leader>nt :NERDTreeToggle<CR>
  266. nnoremap <silent> <Leader>nf :NERDTreeFind<CR>
  267. nnoremap <silent> <Leader>tb :TagbarToggle<CR>
  268. nnoremap <silent> <Leader>ut :UndotreeToggle<CR>
  269. nnoremap <silent> <Leader>bl :call BufferList()<CR>
  270. nnoremap <silent> <Leader>lt :set list!<CR>
  271.  
  272. " nfo shit
  273.  au BufReadPre *.nfo set fileencodings=cp437
  274.  au BufReadPost *.nfo set fileencodings=utf-8,ucs-bom,cp1250
  275.  au BufReadPre *.diz set fileencodings=cp437
  276.  au BufReadPost *.diz set fileencodings=utf-8,ucs-bom,cp1250
  277.  
  278. if version >= 702
  279.     autocmd BufWinLeave * call clearmatches()
  280. endif
  281.  
  282.  
  283. " For nodejs-complete
  284. let g:nodejs_complete_config = {
  285.             \  'js_compl_fn': 'jscomplete#CompleteJS',
  286.             \  'max_node_compl_len': 15
  287.             \}
  288. " For jschecker
  289. let g:syntastic_javascript_checkers = ['jslint']
  290.  
  291. " for neocomplete
  292.  
  293. " Disable AutoComplPop.
  294. let g:acp_enableAtStartup = 0
  295. " Use neocomplete.
  296. let g:neocomplete#enable_at_startup = 1
  297. " Use smartcase.
  298. let g:neocomplete#enable_smart_case = 1
  299. " Set minimum syntax keyword length.
  300. let g:neocomplete#sources#syntax#min_keyword_length = 3
  301. let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'
  302.  
  303. " Define dictionary.
  304. let g:neocomplete#sources#dictionary#dictionaries = {
  305.     \ 'default' : '',
  306.     \ 'vimshell' : $HOME.'/.vimshell_hist',
  307.     \ 'scheme' : $HOME.'/.gosh_completions'
  308.         \ }
  309.  
  310. " Define keyword.
  311. if !exists('g:neocomplete#keyword_patterns')
  312.     let g:neocomplete#keyword_patterns = {}
  313. endif
  314.     let g:neocomplete#keyword_patterns['default'] = '\h\w*'
  315.  
  316.     " Plugin key-mappings.
  317. inoremap <expr><C-g>     neocomplete#undo_completion()
  318. inoremap <expr><C-l>     neocomplete#complete_common_string()
  319.  
  320. " Recommended key-mappings.
  321. " <CR>: close popup and save indent.
  322. inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
  323. function! s:my_cr_function()
  324.           return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
  325. " For no inserting <CR> key.
  326.               "return pumvisible() ? "\<C-y>" : "\<CR>"
  327.           endfunction
  328.           " <TAB>: completion.
  329.          inoremap <expr><TAB>  pumvisible() ? "\<C-n>" : "\<TAB>"
  330.         " <C-h>, <BS>: close popup and delete backword char.
  331.        inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
  332.       inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
  333.      " Close popup by <Space>.
  334.     "inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>"
  335.    
  336. " AutoComplPop like behavior.
  337. "let g:neocomplete#enable_auto_select = 1
  338.  
  339. " Shell like behavior(not recommended).
  340. set completeopt+=longest,menuone
  341. "let g:neocomplete#enable_auto_select = 1
  342. let g:neocomplete#disable_auto_complete = 1
  343. inoremap <expr><TAB>  pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
  344.  
  345. " Enable omni completion.
  346. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  347. autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  348. autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
  349. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  350. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  351.  
  352. " Enable heavy omni completion.
  353. if !exists('g:neocomplete#sources#omni#input_patterns')
  354.       let g:neocomplete#sources#omni#input_patterns = {}
  355.   endif
  356. let g:neocomplete#sources#omni#input_patterns.php = '[^.\t]->\h\w*\|\h\w*::'
  357. let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:]*\t]\%(\.\|->\)'
  358. let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:]"*\t]\%(\.\|->\)\|\h\w*::'
  359.  
  360. " For perlomni.vim setting.
  361. " https://github.com/c9s/perlomni.vim
  362. let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
  363.  
  364. "For JsBeautifier
  365. map <c-f> :call JsBeautify()<cr>
  366. " or
  367. autocmd FileType javascript noremap <buffer>  <c-f> :call JsBeautify()<cr>
  368. " for json
  369. autocmd FileType json noremap <buffer> <c-f> :call JsonBeautify()<cr>
  370. "  for jsx
  371. autocmd FileType jsx noremap <buffer> <c-f> :call JsxBeautify()<cr>
  372. "  for html
  373. autocmd FileType html noremap <buffer> <c-f> :call HtmlBeautify()<cr>
  374. " for css or scss
  375. autocmd FileType css noremap <buffer> <c-f> :call CSSBeautify()<cr>
  376.  
  377. "For hightlight brackets
  378. set showmatch
  379. "searching the word while typing the search words
  380. set incsearch
  381.  
  382. "tweak brackets  hightlight color
  383. hi MatchParen cterm=bold ctermbg=none ctermfg=red
  384.  
  385. " UltiSnips
  386. let g:UltiSnipsExpandTrigger="<c-x>"
  387. let g:UltiSnipsJumpForwardTrigger="<c-b>"
  388. let g:UltiSnipsJumpBackwardTrigger="<c-z>"
  389.  
  390. "YoucompleteMe
  391. let g:ycm_global_ycm_extra_conf="/home/johans/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py"
  392. let g:syntastic_cpp_compiler = 'g++'
  393. let g:syntastic_cpp_compiler_options = '-std=c++11 -stdlib=libc++ '
  394.  
  395. " Shortcuts for   Slimux
  396. noremap sb   :SlimuxREPLSendBuff<cr>
  397. noremap sp   :SlimuxShellPrompt<cr>
  398. vnoremap s   :SlimuxREPLSendSelection<cr>
  399. noremap sc   :SlimuxREPLConfigure<cr>
  400. noremap Sc   :SlimuxShellConfigure<cr>
  401. noremap sl   :SlimuxREPLSendLine<cr>
  402.  
  403. " NodeJs keymaps
  404. "Disabled auto-reload on write for vim-reload plugin
  405. let g:reload_on_write = 0
  406.  
  407.  
  408. "auto check out the directory
  409. set noautochdir
  410. autocmd BufEnter * if expand("%:p:h") !~ '^/tmp' |  silent! lcd %:p:h |  endif
  411. "To stop vim-rooter changing directory automatically
  412. let g:rooter_manual_only = 1
  413.  
  414. "Fix the mess Chinese character display
  415. au  InsertLeave * :redraw!
  416.  
  417. "avoid annoyed fileformats
  418. if has('win32')
  419.     set fileformat=dos
  420. else
  421.     set fileformat=unix
  422. endif
  423.  
  424. " disable the buggy red hightlight for chinese character
  425. autocmd FileType markdown set nospell
  426.  
  427. " auto insert html tags in xml, html ,xhtml files
  428. let g:closetag_filenames = "*.html,*xhtml,*.phtml,*.md,*.xml"
  429.  
  430. " test for tagbar-phpctags
  431.  
  432. let g:tagbar_phpctags_bin='~/.vim/bundle/tagbar-phpctags.vim/bin/phpctags'
  433. let g:tagbar_phpctags_memory='512M'
  434.  
  435. " search related docsets
  436. nnoremap <Leader>k :Dasht<Space>
  437.  
  438. " search ALL the docsets
  439. nnoremap <Leader><Leader>k :Dasht!<Space>
  440.  
  441. " search related docsets
  442. nnoremap <silent> <Leader>K :call Dasht([expand('<cWORD>'), expand('<cword>')])<Return>
  443.  
  444. " search ALL the docsets
  445. nnoremap <silent> <Leader><Leader>K :call Dasht([expand('<cWORD>'), expand('<cword>')], '!')<Return>"
  446.  
  447.  
  448. " search related docsets
  449. vnoremap <silent> <Leader>K y:<C-U>call Dasht(getreg(0))<Return>
  450.  
  451. " search ALL the docsets
  452. vnoremap <silent> <Leader><Leader>K y:<C-U>call Dasht(getreg(0),'!')<Return>"
  453.  
  454.  
  455. let g:dasht_filetype_docsets = {} " filetype => list of docset name regexp
  456. " When in Elixir, also search Erlang:
  457. let g:dasht_filetype_docsets['elixir'] = ['erlang']
  458. " When in C++, also search C, Boost, and OpenGL:
  459. let g:dasht_filetype_docsets['cpp'] = ['^c$', 'boost', 'OpenGL']
  460. " When in Python, also search NumPy, SciPy, and Pandas:
  461. let g:dasht_filetype_docsets['python'] = ['(num|sci)py', 'pandas']
  462. " When in HTML, also search CSS, JavaScript, Bootstrap, and jQuery:
  463. let g:dasht_filetype_docsets['html'] = ['css', 'js', 'bootstrap']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement