Advertisement
Guest User

Untitled

a guest
Nov 7th, 2017
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.57 KB | None | 0 0
  1. set nocompatible " be iMproved, required
  2. filetype off " required
  3.  
  4. " set the runtime path to include Vundle and initialize
  5. set rtp+=~/.vim/bundle/Vundle.vim
  6. call vundle#begin()
  7. " alternatively, pass a path where Vundle should install plugins
  8. "call vundle#begin('~/some/path/here')
  9.  
  10. " let Vundle manage Vundle, required
  11. Plugin 'VundleVim/Vundle.vim'
  12.  
  13. " The following are examples of different formats supported.
  14. " Keep Plugin commands between vundle#begin/end.
  15. " plugin on GitHub repo
  16. Plugin 'tpope/vim-fugitive'
  17. " plugin from http://vim-scripts.org/vim/scripts.html
  18. " Plugin 'L9'
  19. " Git plugin not hosted on GitHub
  20. " Plugin 'git://git.wincent.com/command-t.git'
  21. " git repos on your local machine (i.e. when working on your own plugin)
  22. " Plugin 'file:///home/gmarik/path/to/plugin'
  23. " The sparkup vim script is in a subdirectory of this repo called vim.
  24. " Pass the path to set the runtimepath properly.
  25. " Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
  26. " Install L9 and avoid a Naming conflict if you've already installed a
  27. " different version somewhere else.
  28. " Plugin 'ascenator/L9', {'name': 'newL9'}
  29.  
  30. " Display colors for color codes
  31. Plugin 'chrisbra/Colorizer'
  32.  
  33. " Color Scheme
  34. Plugin 'altercation/vim-colors-solarized'
  35.  
  36. " Airline
  37. Plugin 'vim-airline/vim-airline'
  38. Plugin 'vim-airline/vim-airline-themes'
  39.  
  40. " NERDTree
  41. Plugin 'scrooloose/nerdtree'
  42.  
  43. " Preview the effect of replace in real time.
  44. Plugin 'osyo-manga/vim-over'
  45.  
  46. " Go plugin
  47. Plugin 'fatih/vim-go'
  48.  
  49. " CtrlP
  50. Plugin 'kien/ctrlp.vim'
  51. "
  52. Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
  53. Plugin 'junegunn/fzf.vim'
  54.  
  55. " Automatically create directories
  56. Plugin 'pbrisbin/vim-mkdir'
  57.  
  58. " Delimiter
  59. Plugin 'jiangmiao/auto-pairs'
  60.  
  61. " Go autocomplete
  62. Plugin 'nsf/gocode', {'rtp': 'vim/'}
  63.  
  64. " YouCompleteMe
  65. Plugin 'Valloric/YouCompleteMe'
  66.  
  67. Plugin 'majutsushi/tagbar'
  68.  
  69. Plugin 'tpope/vim-surround'
  70. Plugin 'christoomey/vim-tmux-navigator'
  71. Plugin 'benmills/vimux'
  72. Plugin 'mileszs/ack.vim'
  73. Plugin 'lervag/vimtex'
  74. Plugin 'SirVer/ultisnips'
  75.  
  76. Plugin 'tpope/vim-commentary'
  77.  
  78. " Snippets are separated from the engine. Add this if you want them:
  79. Plugin 'honza/vim-snippets'
  80.  
  81. " Just for interop of YCM and Ultisnips
  82. " Plugin 'ervandew/supertab'
  83.  
  84. Plugin 'vim-syntastic/syntastic'
  85.  
  86. Plugin 'jceb/vim-orgmode'
  87.  
  88. " All of your Plugins must be added before the following line
  89. call vundle#end() " required
  90. filetype plugin indent on " required
  91. " To ignore plugin indent changes, instead use:
  92. "filetype plugin on
  93. "
  94. " Brief help
  95. " :PluginList - lists configured plugins
  96. " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
  97. " :PluginSearch foo - searches for foo; append `!` to refresh local cache
  98. " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
  99. "
  100. " see :h vundle for more details or wiki for FAQ
  101. " Put your non-Plugin stuff after this line
  102.  
  103. " Syntax highlighting
  104. syntax on
  105.  
  106. " Color scheme
  107. set background=dark
  108. colorscheme solarized
  109.  
  110. " Allow switching away from modified buffers
  111. set hidden
  112.  
  113. " NERDTree's File highlighting
  114. function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg)
  115. exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg
  116. exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#'
  117. endfunction
  118.  
  119. call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515')
  120. call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515')
  121. call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515')
  122. call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515')
  123. call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow', '#151515')
  124. call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515')
  125. call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515')
  126. call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515')
  127. call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515')
  128. call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515')
  129. call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515')
  130. call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515')
  131. call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515')
  132.  
  133. " Remap Esc in insert mode and command mode
  134. imap fd <Esc>
  135. map fd <Esc>
  136. cnoremap fd <c-c>
  137.  
  138. " Leader key as space
  139. let mapleader = " "
  140. let maplocalleader = ","
  141.  
  142. nnoremap <SPACE> <Nop>
  143.  
  144. " NERDTree toggle
  145. map <Leader>t :NERDTreeToggle<CR>
  146.  
  147. " vim-over
  148. map <Leader>s :OverCommandLine<CR>
  149.  
  150. " Saving file
  151. map <Leader>fs :w<CR>
  152. map <Leader>fS :w !sudo tee %<CR>l
  153. map <Leader>fr :CtrlPMRUFiles<CR>
  154.  
  155. " Fast edit vimrc
  156. map <Leader>v :e ~/.vim/vimrc<CR>
  157.  
  158. " Alternate buffer
  159. map <Leader><Tab> :e #<CR>
  160.  
  161. " CtrlP
  162. " let g:ctrlp_cmd = 'CtrlPMixed'
  163.  
  164. " goimports
  165. let g:go_fmt_command = "goimports"
  166.  
  167. " Preventing pileup
  168. augroup customized
  169. autocmd!
  170. augroup end
  171.  
  172. " cwd
  173. autocmd customized BufEnter * silent! lcd %:p:h
  174.  
  175. " window shortcut
  176. nnoremap <silent> vv <C-w>v
  177. nnoremap <silent> vS <C-w>S
  178. nnoremap <silent> vc <C-w>c
  179. nnoremap <silent> vq <C-w>q
  180.  
  181. " Prompt for a command to run
  182. function! CdAndRunCommand(...)
  183. let command = a:0 == 1 ? a:1 : ""
  184. let l:command = input(_VimuxOption("g:VimuxPromptString", "Command? "), command)
  185. call VimuxRunCommand("cd ".shellescape(expand('%:p:h'), 1))
  186. call VimuxRunCommand(l:command)
  187. endfunction
  188. function! Cd()
  189. call VimuxRunCommand("cd ".shellescape(expand('%:p:h'), 1))
  190. endfunction
  191. command! -nargs=? CdAndRunCommand :call CdAndRunCommand(<args>)
  192. map <Leader>cp :CdAndRunCommand<CR>
  193. map <Leader>cl :VimuxRunLastCommand<CR>
  194. map <Leader>' :call Cd()<CR>
  195.  
  196. " visual line
  197. nmap j gj
  198. nmap k gk
  199.  
  200. " Close buffer
  201. map <Leader>bd :bd<CR>
  202.  
  203. " YCMD
  204. let g:ycm_server_python_interpreter = '/usr/bin/python2'
  205.  
  206. " ASCII symbols
  207. let g:airline_symbols_ascii = 1
  208.  
  209. " CtrlP custom map
  210. " let g:ctrlp_prompt_mappings = {
  211. " \ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>', 'fd'],
  212. " \ }
  213.  
  214. " tabwidth
  215. set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
  216.  
  217. " This isn't there by default
  218. autocmd customized Filetype tex let b:AutoPairs = g:AutoPairs | let b:AutoPairs['$'] = '$'
  219.  
  220. " vim-surround. More used to s
  221. vmap s S
  222.  
  223. " Use system clipboard
  224. set clipboard=unnamedplus
  225.  
  226. let g:UltiSnipsExpandTrigger = "<c-m-i>"
  227. let g:ulti_expand_or_jump_res = 0
  228. function! ExpandSnippetOrCarriageReturn()
  229. let snippet = UltiSnips#ExpandSnippetOrJump()
  230. if g:ulti_expand_or_jump_res > 0
  231. return snippet
  232. else
  233. return "\<CR>"
  234. endif
  235. endfunction
  236. inoremap <expr> <CR> pumvisible() ? "\<C-R>=ExpandSnippetOrCarriageReturn()\<CR>" : "\<CR>"
  237.  
  238. nmap <c-b> :Buffers<cr>
  239. map <Leader>sb :Lines<cr>
  240. map <Leader>ss :BLines<cr>
  241.  
  242. " if executable('rg')
  243. " set grepprg=rg\ --color=never
  244. " let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
  245. " let g:ctrlp_use_caching = 0
  246. " elseif executable('ag')
  247. " let g:ctrlp_user_command = 'ag %s -i --nocolor --nogroup --hidden
  248. " \ --ignore .git
  249. " \ --ignore .hg
  250. " \ --ignore "**/*.pyc"
  251. " \ --ignore .svn
  252. " \ -g ""'
  253. " endif
  254.  
  255. set grepprg=rg\ --vimgrep
  256.  
  257. " syntastic config
  258. set statusline+=%#warningmsg#
  259. set statusline+=%{SyntasticStatuslineFlag()}
  260. set statusline+=%*
  261.  
  262. " Find using rg
  263. command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>).'| tr -d "\017"', 1, <bang>0)
  264. map <Leader>sf :Find<cr>
  265.  
  266. " First find a git repo. If not, fall back to Files.
  267. function! s:find_git_root()
  268. return system('git rev-parse --show-toplevel 2> /dev/null')[:-2]
  269. endfunction
  270.  
  271. command! ProjectFiles execute 'Files' s:find_git_root()
  272.  
  273. " fzf
  274. map <c-p> :ProjectFiles<cr>
  275.  
  276. " avoid conflict
  277. let g:ctrlp_map = '<c-t>'
  278. map <c-t> :CtrlP<CR>
  279.  
  280. let g:syntastic_always_populate_loc_list = 1
  281. let g:syntastic_auto_loc_list = 1
  282. let g:syntastic_check_on_open = 1
  283. let g:syntastic_check_on_wq = 0
  284.  
  285. " put swp files in vim
  286. set directory=$HOME/tmp/vimswap
  287.  
  288. map <Leader>j :TagbarToggle<cr>
  289.  
  290. " Jump to definition
  291. map <localleader>d :MerlinLocate<cr>
  292.  
  293. let g:syntastic_ocaml_checkers = ['merlin']
  294.  
  295. " No plaintex pls
  296. let g:tex_flavor = "latex"
  297.  
  298. set ignorecase smartcase
  299.  
  300. " go tabwidth
  301. au BufNewFile,BufRead *.go setlocal noet ts=4 sw=4 sts=4
  302.  
  303. " Highlight cursor line. Line number
  304. set cursorline number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement