Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.99 KB | None | 0 0
  1. " Use Vim settings, rather then Vi settings (much better!).
  2. " This must be first, because it changes other options as a side effect.
  3. set nocompatible
  4.  
  5. set autochdir
  6.  
  7. " leader is just used elsewhere
  8. let mapleader = "\<Space>"
  9.  
  10. " save
  11. nnoremap <Leader>w :w<CR>
  12.  
  13. " space space to visual line mode
  14. nmap <Leader><Leader> V
  15.  
  16. " Vundle and some plugins: NerdTree and Dash
  17. filetype off " required for Vundle
  18. set rtp+=~/.vim/bundle/Vundle.vim
  19. call vundle#begin()
  20. Plugin 'gmarik/Vundle.vim'
  21. Plugin 'w0rp/ale'
  22. Plugin 'dart-lang/dart-vim-plugin'
  23. Plugin 'thosakwe/vim-flutter'
  24. Plugin 'udalov/kotlin-vim'
  25. Plugin 'scrooloose/nerdtree'
  26. Plugin 'rizzatti/dash.vim'
  27. Plugin 'altercation/vim-colors-solarized'
  28. Plugin 'pangloss/vim-javascript'
  29. Plugin 'jeler/vim-javascript-syntax'
  30. Plugin 'airblade/vim-gitgutter'
  31. Plugin 'marijnh/tern_for_vim'
  32. Plugin 'Valloric/YouCompleteMe'
  33. Plugin 'SirVer/ultisnips'
  34. Plugin 'honza/vim-snippets'
  35. Plugin 'epilande/vim-es2015-snippets'
  36. Plugin 'epilande/vim-react-snippets'
  37. Plugin 'kien/ctrlp.vim'
  38. Plugin 'terryma/vim-expand-region'
  39. Plugin 'vim-scripts/gitignore'
  40. Plugin 'tpope/vim-commentary'
  41. Plugin 'tpope/vim-rsi'
  42. Plugin 'bling/vim-airline'
  43. Plugin 'jeffkreeftmeijer/vim-numbertoggle'
  44. Plugin 'mxw/vim-jsx'
  45. Plugin 'othree/html5.vim'
  46. Plugin 'digitaltoad/vim-pug'
  47. Plugin 'haya14busa/incsearch.vim'
  48. call vundle#end()
  49.  
  50. " javascript / eslint goodness
  51. let g:ale_fixers = {
  52. \ 'javascript': ['eslint']
  53. \ }
  54. let g:ale_sign_error = '❌'
  55. let g:ale_sign_warning = '⚠️'
  56. let g:ale_fix_on_save = 1
  57.  
  58. " dart goodness
  59. let g:lsc_server_commands = {'dart': 'dart_language_server'}
  60. let g:lsc_auto_map = {
  61. \ 'defaults': v:true,
  62. \ 'NextReference': '',
  63. \ 'PreviousReference': '',
  64. \ }
  65. let dart_format_on_save = 1
  66. let dart_style_guide = 2
  67.  
  68. " flutter goodness
  69. nnoremap <leader>fa :FlutterRun<cr>
  70. nnoremap <leader>fq :FlutterQuit<cr>
  71. nnoremap <leader>fr :FlutterHotReload<cr>
  72. nnoremap <leader>fR :FlutterHotRestart<cr>
  73. nnoremap <leader>fD :FlutterVisualDebug<cr>
  74.  
  75. let g:UltiSnipsSnippetDirectories=["UltiSnips", "tim-snippets"]
  76.  
  77. " airline
  78. set laststatus=2
  79. set noshowmode
  80. let g:airline#extensions#tabline#enabled = 1
  81.  
  82. " gitgutter will complain all the time if it exceeds the max
  83. let g:gitgutter_max_signs=9999
  84.  
  85. " git gutter commands
  86. nmap <Leader>hn <Plug>GitGutterNextHunk
  87. nmap <Leader>hN <Plug>GitGutterPrevHunk
  88. nmap <Leader>hs <Plug>GitGutterStageHunk
  89. nmap <Leader>hu <Plug>GitGutterUndoHunk
  90.  
  91. " region expanding
  92. vmap v <Plug>(expand_region_expand)
  93. vmap <C-v> <Plug>(expand_region_shrink)
  94.  
  95. " make ctrl-p faster
  96. let g:ctrlp_use_caching = 0
  97. if executable('ag')
  98. set grepprg=ag\ --nogroup\ --nocolor
  99. let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
  100. else
  101. let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
  102. let g:ctrlp_prompt_mappings = {
  103. \ 'AcceptSelection("e")': ['<space>', '<cr>', '<2-LeftMouse>'],
  104. \ }
  105. endif
  106.  
  107.  
  108. " ultisnip configuration
  109. let g:UltiSnipsExpandTrigger="<c-j>"
  110. let g:UltiSnipsJumpForwardTrigger="<c-j>"
  111. let g:UltiSnipsJumpBackwardTrigger="<c-k>"
  112.  
  113. " If you want :UltiSnipsEdit to split your window.
  114. "let g:UltiSnipsEditSplit="vertical"
  115.  
  116. " sets terminal title upon exit so the unhelpful Thanks for flying message is not shown
  117. let &titleold=getcwd()
  118.  
  119. " ycm: show results as you type in CSS / SASS
  120. let g:ycm_semantic_triggers = {
  121. \ 'css,scss': [ 're!^\s{4}', 're!:\s+' ],
  122. \ }
  123.  
  124. " disable ycm for .rb (it complains that gems are not built)
  125. let g:ycm_filetype_blacklist = { 'ruby': 1 }
  126.  
  127. " disable the scratch preview window in omnicomplete
  128. set completeopt-=preview
  129.  
  130. " set nowrap
  131. set expandtab
  132. set tabstop=2
  133. set shiftwidth=2
  134. set autowrite
  135. set mouse=a
  136. set title
  137.  
  138. " line numbers (plugin uses relative)
  139. set number
  140.  
  141. " exit insert mode (ESC is far away)
  142. :imap jj <Esc>
  143.  
  144. " use system clipboard yank / put
  145. set clipboard=unnamed
  146.  
  147. " nerd tree with t key
  148. nnoremap <silent> q :NERDTreeToggle<CR>
  149.  
  150. " moves cursor to previous line when hitting back/forward movement
  151. set whichwrap+=<,>,h,l,[,]
  152.  
  153. " move through buffers (must disable ale_fix_on_save first because it will
  154. " error
  155. command! ALEToggleFixer execute "let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0) ? 0 : 1"
  156. nmap <silent> <C-j> :ALEToggleFixer<CR>:bn<CR>:ALEToggleFixer<CR>
  157. nmap <silent> <C-k> :ALEToggleFixer<CR>:bp<CR>:ALEToggleFixer<CR>
  158. nmap <silent> <C-h> :ALEToggleFixer<CR>:update<CR>:bd<CR>:ALEToggleFixer<CR>
  159.  
  160. " allow the minimum window height to be zero so only file name is visible
  161. set wmh=0
  162.  
  163. " quickly resize
  164. nmap - <C-W>-
  165. nmap + <C-W>+
  166. nmap _ <C-W>_
  167. nmap = <C-W>=
  168.  
  169. " Open new split panes to right and bottom, which feels more natural than Vim’s default:
  170. set splitbelow
  171. set splitright
  172.  
  173. " allow backspacing over everything in insert mode
  174. set backspace=indent,eol,start
  175.  
  176. set history=50 " keep 50 lines of command line history
  177. set ruler " show the cursor position all the time
  178. set showcmd " display incomplete commands
  179.  
  180. " incsearch plugin does highlighting
  181. set hlsearch
  182. map / <Plug>(incsearch-forward)
  183. map ? <Plug>(incsearch-backward)
  184. map g/ <Plug>(incsearch-stay)
  185. let g:incsearch#auto_nohlsearch = 1
  186. map n <Plug>(incsearch-nohl-n)zz
  187. map N <Plug>(incsearch-nohl-N)zz
  188. map * <Plug>(incsearch-nohl-*)
  189. map # <Plug>(incsearch-nohl-#)
  190. map g* <Plug>(incsearch-nohl-g*)
  191. map g# <Plug>(incsearch-nohl-g#)
  192.  
  193. " Don't use Ex mode, use Q for formatting
  194. map Q gq
  195.  
  196. " CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo,
  197. " so that you can undo CTRL-U after inserting a line break.
  198. inoremap <C-U> <C-G>u<C-U>
  199.  
  200. " Switch syntax highlighting on, when the terminal has colors
  201. " Also switch on highlighting the last used search pattern.
  202. if &t_Co > 2 || has("gui_running")
  203. syntax on
  204. " set hlsearch
  205. endif
  206.  
  207. " Only do this part when compiled with support for autocommands.
  208. if has("autocmd")
  209.  
  210. " Enable file type detection.
  211. " Use the default filetype settings, so that mail gets 'tw' set to 72,
  212. " 'cindent' is on in C files, etc.
  213. " Also load indent files, to automatically do language-dependent indenting.
  214. filetype plugin indent on
  215.  
  216. " Put these in an autocmd group, so that we can delete them easily.
  217. augroup vimrcEx
  218. au!
  219.  
  220. " For all text files set 'textwidth' to 78 characters.
  221. autocmd FileType text setlocal textwidth=78
  222.  
  223. " When editing a file, always jump to the last known cursor position.
  224. " Don't do it when the position is invalid or when inside an event handler
  225. " (happens when dropping a file on gvim).
  226. " Also don't do it when the mark is in the first line, that is the default
  227. " position when opening a file.
  228. autocmd BufReadPost *
  229. \ if line("'\"") > 1 && line("'\"") <= line("$") |
  230. \ exe "normal! g`\"" |
  231. \ endif
  232.  
  233. augroup END
  234.  
  235. else
  236.  
  237. set autoindent " always set autoindenting on
  238.  
  239. endif " has("autocmd")
  240.  
  241. " Convenient command to see the difference between the current buffer and the
  242. " file it was loaded from, thus the changes you made.
  243. " Only define it when not defined already.
  244. if !exists(":DiffOrig")
  245. command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
  246. \ | wincmd p | diffthis
  247. endif
  248.  
  249. " solarized dark color scheme
  250. "set background=light
  251. set background=dark
  252. colorscheme solarized
  253. set t_Co=256
  254.  
  255. " highlight after 80 characters
  256. let &colorcolumn=join(range(81,999),",")
  257.  
  258. " this clears the terrible Solarized support for the SignColumn of gitgutter
  259. highlight clear SignColumn
  260.  
  261. " put swap files and backups in a better place
  262. set backup
  263. set backupdir=/Users/omar/tmp
  264. set dir=/Users/omar/tmp
  265.  
  266. " code folding
  267. " autocmd Syntax html,ruby,javascript setlocal foldmethod=syntax
  268. " automatically unfold things when it starts
  269. " autocmd Syntax html,ruby,javascript normal zR
  270. "let javaScript_fold=1
  271. "let html_fold=1
  272. "let ruby_fold=1
  273.  
  274. " jsx highlighting in .js files
  275. let g:jsx_ext_required = 0
  276.  
  277.  
  278. " this should improve performance of syntax highlighting
  279. set nocursorcolumn
  280. set nocursorline
  281. " syntax sync minlines=256
  282. autocmd BufEnter * :syntax sync fromstart
  283.  
  284. " this sets .jst.ejs to same as .erb
  285. au BufNewFile,BufRead *.ejs set filetype=html
  286.  
  287.  
  288. " es6
  289. au BufNewFile,BufRead *.es6 set filetype=javascript
  290. au BufNewFile,BufRead *.ts set filetype=javascript
  291.  
  292. " rails things
  293. au BufNewFile,BufRead *.cap set filetype=ruby
  294. au BufNewFile,BufRead *.rabl set filetype=ruby
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement