SHARE
TWEET

Untitled

a guest May 19th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. call plug#begin('~/.vim/plugged')
  2. Plug 'scrooloose/nerdtree'
  3. Plug 'Xuyuanp/nerdtree-git-plugin'
  4. Plug 'itchyny/lightline.vim'
  5. Plug 'myusuf3/numbers.vim'
  6. Plug 'tpope/vim-surround'
  7. Plug 'ctrlpvim/ctrlp.vim'
  8. Plug 'mattn/emmet-vim'
  9. Plug 'morhetz/gruvbox'
  10. Plug 'jiangmiao/auto-pairs'
  11. Plug 'Valloric/YouCompleteMe'
  12. Plug 'tpope/vim-commentary'
  13. Plug 'posva/vim-vue'
  14. Plug 'airblade/vim-gitgutter'
  15. Plug 'w0rp/ale'
  16. Plug 'machakann/vim-highlightedyank'
  17. Plug 'rust-lang/rust.vim'
  18. Plug 'racer-rust/vim-racer'
  19. Plug 'google/vim-searchindex'
  20. Plug 'tacahiroy/ctrlp-funky'
  21. Plug 'nelstrom/vim-visual-star-search'
  22. Plug 'leafgarland/typescript-vim'
  23. Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
  24. " Plug 'SirVer/ultisnips'
  25. Plug 'altercation/vim-colors-solarized'
  26. call plug#end()
  27.  
  28. " test vimscript
  29. let mapleader = ","
  30. let maplocalleader = "\\"
  31. nnoremap <leader>ev :vsplit $MYVIMRC<cr>
  32. nnoremap <leader>sv :source $MYVIMRC<cr>
  33. nnoremap <leader>s :w<cr>
  34. nnoremap <localleader>ev :vsplit $MYVIMRC<cr>
  35. augroup testgroup
  36.   autocmd!
  37.   autocmd BufRead,BufWritePre *.html :normal gg=G
  38.   autocmd FileType javascript nnoremap <buffer> <leader>c I// <esc>
  39.   autocmd FileType go :set relativenumber | set cursorcolumn
  40.   autocmd FileType go nmap <leader>r <Plug>(go-run)
  41.   autocmd FileType go nmap <leader>b <Plug>(go-build)
  42.   autocmd FileType go nmap <leader>t <Plug>(go-test)
  43.   autocmd FileType go nmap <leader>d <Plug>(go-def)
  44.   autocmd FileType go map <C-n> :cnext<CR>
  45.   autocmd FileType go map <C-p> :cprevious<CR>
  46.  
  47.   " autocmd BufWrite * :echom "Writing buffer!"
  48. augroup END
  49. " end test vimscript
  50.  
  51. set encoding=utf-8
  52. set cursorcolumn
  53. set foldenable
  54. set foldmethod=manual
  55. " loadview and mkview when buffer enter and leave
  56. autocmd BufWinLeave *.* mkview
  57. autocmd BufWinEnter *.* silent loadview
  58. " zf in view mode will fold
  59. " za will expand
  60.  
  61. set rnu
  62. set nu
  63. set showmatch
  64. set showcmd
  65. syntax enable
  66. set tabstop=2
  67. set shiftwidth=2
  68. set softtabstop=2
  69. set nolist
  70. " set listchars=space:_,nbsp:+,tab:>-
  71. " set noexpandtab
  72. set expandtab
  73. set autoindent
  74. set wildmenu
  75. set wildmode=full
  76. set hlsearch
  77. set incsearch
  78. set ruler
  79. set nocompatible
  80. filetype plugin indent on
  81. set smartindent
  82. runtime macros/matchit.vim
  83.  
  84. inoremap { {}<left>
  85. inoremap {<CR> {<CR><CR>}<ESC>0<UP>i<TAB>
  86. inoremap {;<CR> {<CR><CR>};<ESC>0<UP>i<TAB>
  87.  
  88. set background=dark
  89. colorscheme solarized
  90.  
  91. if executable('rls')
  92.     au User lsp_setup call lsp#register_server({
  93.         \ 'name': 'rls',
  94.         \ 'cmd': {server_info->['rustup', 'run', 'nightly', 'rls']},
  95.         \ 'whitelist': ['rust'],
  96.         \ })
  97.   endif
  98.  
  99. let &t_SI = "\e[6 q"
  100. let &t_EI = "\e[2 q"
  101.  
  102. " used for lightline.vim
  103. set laststatus=2
  104. set noshowmode
  105. let g:lightline = {
  106.   \     'active': {
  107.   \         'left': [['mode', 'paste' ], ['readonly', 'filename', 'modified']],
  108.   \         'right': [['lineinfo'], ['percent'], ['fileformat', 'fileencoding']]
  109.   \     }
  110.   \ }
  111. " end lightline.vim
  112.  
  113. " used for NERDTree
  114. map <C-B> :NERDTreeToggle<CR>
  115. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  116. " autocmd vimenter * NERDTree
  117. autocmd StdinReadPre * let s:std_in=1
  118. autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
  119. autocmd StdinReadPre * let s:std_in=1
  120. autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd     p | ene | endif
  121.  
  122. " Check if NERDTree is open or active
  123. function! IsNERDTreeOpen()
  124.   return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
  125. endfunction
  126.  
  127. " Call NERDTreeFind iff NERDTree is active, current window contains a modifiable
  128. " file, and we're not in vimdiff
  129. function! SyncTree()
  130.   if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff
  131.     NERDTreeFind
  132.     wincmd p
  133.   endif
  134. endfunction
  135.  
  136. " Highlight currently open buffer in NERDTree
  137. autocmd BufEnter * call SyncTree()
  138. " end NERDTree
  139.  
  140. " ctrlP config begin
  141. let g:ctrlp_map = '<c-p>'
  142. let g:ctrlp_custom_ignore = {
  143.   \ 'dir': 'target\|node_modules\|DS_Store\|.git',
  144.   \ 'file': '\v\.(exe|so|dll|zip|tar|tar.gz|pyc)$'
  145. \ }
  146. nnoremap <Leader>fu :CtrlPFunky<Cr>
  147. " narrow the list down with a word under cursor
  148. " nnoremap <Leader>fU :execute 'CtrlPFunky ' . expand('<cword>')<Cr>
  149. let g:ctrlp_funky_syntax_highlight = 1
  150. let g:ctrlp_extensions = ['funky']
  151. " ctrlP config end
  152.  
  153. let NERDTreeShowHidden = 1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top