Guest User

Untitled

a guest
Apr 19th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1. set nocompatible
  2. filetype off
  3. " set the runtime path to include Vundle and initialize
  4. set rtp+=~/.vim/bundle/vundle/
  5. call vundle#begin()
  6.  
  7. " PLUGINS
  8. Plugin 'VundleVim/Vundle.vim'
  9. Plugin 'scrooloose/nerdtree'
  10. Plugin 'majutsushi/tagbar'
  11. Plugin 'ctrlpvim/ctrlp.vim'
  12. Plugin 'bumaociyuan/vim-swift'
  13. Plugin 'arcticicestudio/nord-vim'
  14. Plugin 'artur-shaik/vim-javacomplete2'
  15. Plugin 'tpope/vim-fugitive'
  16. Plugin 'tpope/vim-commentary'
  17. Plugin 'dyng/ctrlsf.vim'
  18. Plugin 'mileszs/ack.vim'
  19. Plugin 'vim-airline/vim-airline'
  20. Plugin 'junegunn/goyo.vim'
  21. Plugin 'godlygeek/tabular'
  22. Plugin 'sjl/gundo.vim'
  23. Plugin 'w0rp/ale'
  24. Plugin 'realm/SwiftLint'
  25. " All of your Plugins must be added before the following line
  26. call vundle#end() " required
  27. filetype plugin indent on " required
  28.  
  29. " Nice-to-haves
  30. set number
  31. set nolist
  32. set nospell
  33. set hlsearch
  34. syntax on
  35. set tags=./tags,tags;$HOME
  36. colorscheme nord
  37. set backspace=2
  38. set scrolloff=3
  39. set gcr=a:blinkon0
  40. set relativenumber
  41. set binary
  42. set noeol
  43. " SEARCH
  44. set ignorecase
  45. set incsearch
  46. set cursorline
  47.  
  48. " SPLITS
  49. nmap <C-v> :vsplit<CR>
  50. nmap <C-h> :split<CR>
  51.  
  52. " KEYBINDINGS
  53. nnoremap <C-e> :NERDTreeToggle<CR>
  54. nnoremap <C-p> :CtrlP<CR>
  55.  
  56. " SEARCH NAVIGATION
  57. nmap <C-t> :TagbarToggle<CR>
  58. let g:ackprg = 'ag --vimgrep'
  59.  
  60. " HARDMODE
  61. inoremap <Up> <Nop>
  62. inoremap <Down> <Nop>
  63. inoremap <Left> <Nop>
  64. inoremap <Right> <Nop>
  65. " SEARCH - KEYBINDINGS
  66. nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
  67.  
  68. " Toggle Line numbers
  69. noremap <C-l> :set invnumber<CR>
  70.  
  71. if has('mouse')
  72. set mouse=a
  73. endif
  74.  
  75. " SILVER SEARCH
  76. if executable('ag')
  77. " Use ag over grep
  78. set grepprg=ag\ --nogroup\ --nocolor
  79.  
  80. " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
  81. let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
  82.  
  83. " ag is fast enough that CtrlP doesn't need to cache
  84. let g:ctrlp_use_caching = 0
  85. endif
  86.  
  87. " OPEN FILES IN NEW TAB
  88. let g:ctrlp_prompt_mappings = {
  89. \ 'AcceptSelection("e")': ['<c-t>'],
  90. \ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
  91. \ }
  92.  
  93.  
  94. let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
  95.  
  96. " AUTO SOURCE VIMRC
  97. if has("autocmd")
  98. autocmd bufwritepost .vimrc source $MYVIMRC
  99. endif
  100.  
  101. set showtabline=2
  102. set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
  103.  
  104. filetype plugin on
  105.  
  106. function! GitResetAll()
  107. !git reset HEAD --hard
  108. endfunction
  109.  
  110. command! GitResetAll call GitResetAll()
  111. nmap \r :GitResetAll<CR>
  112.  
  113. nmap \q :ccl<CR>
  114. nmap \hl :set invhlsearch<CR>
  115. nmap \t : NERDTree %<CR>
  116.  
  117. let g:ale_fixers = {
  118. \ 'swift': ['swiftformat'],
  119. \}
  120.  
  121. let g:ale_fix_on_save = 1
  122.  
  123. cnoreabbrev W! w!
  124. cnoreabbrev Q! q!
  125. cnoreabbrev Qall! qall!
  126. cnoreabbrev Wq wq
  127. cnoreabbrev Wa wa
  128. cnoreabbrev wQ wq
  129. cnoreabbrev WQ wq
  130. cnoreabbrev W w
  131. cnoreabbrev Q q
  132. cnoreabbrev Qall qall
  133.  
  134. let g:NERDTreeWinSize = 30
  135.  
  136. packloadall
  137. silent! helptags All
  138.  
  139. " quickfixopenall.vim
  140. "Author:
  141. " Tim Dahlin
  142. "
  143. "Description:
  144. " Opens all the files in the quickfix list for editing.
  145. "
  146. "Usage:
  147. " 1. Perform a vimgrep search
  148. " :vimgrep /def/ *.rb
  149. " 2. Issue QuickFixOpenAll command
  150. " :QuickFixOpenAll
  151.  
  152. function! QuickFixOpenAll()
  153. if empty(getqflist())
  154. return
  155. endif
  156. let s:prev_val = ""
  157. for d in getqflist()
  158. let s:curr_val = bufname(d.bufnr)
  159. if (s:curr_val != s:prev_val)
  160. exec "edit " . s:curr_val
  161. endif
  162. let s:prev_val = s:curr_val
  163. endfor
  164. endfunction
  165.  
  166. command! QuickFixOpenAll call QuickFixOpenAll()
  167.  
  168. " Rename.vim - Rename a buffer within Vim and on the disk
  169. "
  170. " Copyright June 2007-2011 by Christian J. Robinson <heptite@gmail.com>
  171. "
  172. " Distributed under the terms of the Vim license. See ":help license".
  173. "
  174. " Usage:
  175. "
  176. " :Rename[!] {newname}
  177.  
  178. command! -nargs=* -complete=file -bang Rename call Rename(<q-args>, '<bang>')
  179.  
  180. function! Rename(name, bang)
  181. let l:name = a:name
  182. let l:oldfile = expand('%:p')
  183.  
  184. if bufexists(fnamemodify(l:name, ':p'))
  185. if (a:bang ==# '!')
  186. silent exe bufnr(fnamemodify(l:name, ':p')) . 'bwipe!'
  187. else
  188. echohl ErrorMsg
  189. echomsg 'A buffer with that name already exists (use ! to override).'
  190. echohl None
  191. return 0
  192. endif
  193. endif
  194.  
  195. let l:status = 1
  196.  
  197. let v:errmsg = ''
  198. silent! exe 'saveas' . a:bang . ' ' . l:name
  199.  
  200. if v:errmsg =~# '^$\|^E329'
  201. let l:lastbufnr = bufnr('$')
  202.  
  203. if expand('%:p') !=# l:oldfile && filewritable(expand('%:p'))
  204. if fnamemodify(bufname(l:lastbufnr), ':p') ==# l:oldfile
  205. silent exe l:lastbufnr . 'bwipe!'
  206. else
  207. echohl ErrorMsg
  208. echomsg 'Could not wipe out the old buffer for some reason.'
  209. echohl None
  210. let l:status = 0
  211. endif
  212.  
  213. if delete(l:oldfile) != 0
  214. echohl ErrorMsg
  215. echomsg 'Could not delete the old file: ' . l:oldfile
  216. echohl None
  217. let l:status = 0
  218. endif
  219. else
  220. echohl ErrorMsg
  221. echomsg 'Rename failed for some reason.'
  222. echohl None
  223. let l:status = 0
  224. endif
  225. else
  226. echoerr v:errmsg
  227. let l:status = 0
  228. endif
  229.  
  230. return l:status
  231. endfunction
Add Comment
Please, Sign In to add comment