Guest User

Untitled

a guest
Jun 25th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. filetype off
  2.  
  3. " Plug settings.
  4. call plug#begin('~/.vim/plugged')
  5. " Themes
  6. Plug 'rakr/vim-one'
  7. " Vim defaults
  8. Plug 'tpope/vim-sensible'
  9. " Directory tree
  10. Plug 'scrooloose/nerdtree'
  11. " Comment stuff out
  12. Plug 'tpope/vim-commentary'
  13. " Language pack
  14. Plug 'sheerun/vim-polyglot'
  15. " Linter
  16. Plug 'w0rp/ale'
  17. " Fuzzy file/buffer finder
  18. Plug '/usr/local/opt/fzf'
  19. Plug 'junegunn/fzf.vim'
  20. " JS formater
  21. Plug 'prettier/vim-prettier'
  22. call plug#end()
  23.  
  24. " Setup syntax highlights
  25. set termguicolors
  26. set background=dark
  27. colorscheme one
  28. " Everybody do that
  29. set nocompatible
  30. " Disable swap files
  31. set noswapfile
  32. " No backup file while editing
  33. set nowritebackup
  34. " Auto save the file when closing
  35. set autowrite
  36. " Hide buffer when unsaved
  37. set hidden
  38. " Show lines number
  39. set number
  40. " Show existing tabs with 2 spaces
  41. set tabstop=2
  42. " When indenting with '>', use 2 spaces width
  43. set shiftwidth=2
  44. " On pressing tabs, insert 2 spaces
  45. set expandtab
  46. " Mode in status bar
  47. set noshowmode
  48. " Browse files in same dir as open file
  49. set browsedir=buffer
  50. " Better split characters
  51. set fillchars=vert:\ ,stl:\ ,stlnc:\
  52. set backupcopy=yes
  53. " Highlight search matches
  54. set hlsearch
  55. " Format completeopt list
  56. set completeopt=longest,menuone,preview
  57. set previewheight=5
  58.  
  59. " Leader key
  60. let mapleader = ","
  61. inoremap jk <Esc>
  62.  
  63. " Ale configuration
  64. let g:ale_set_loclist = 1
  65. let g:ale_set_quickfix = 0
  66. let g:ale_fixers = { 'javascript': ['eslint'] }
  67. let g:ale_lint_on_text_changed = 'never'
  68. let g:ale_lint_on_enter = 0
  69. let g:ale_javascript_prettier_use_global = 1
  70. nmap <silent> <C-k> <Plug>(ale_previous_wrap)
  71. nmap <silent> <C-j> <Plug>(ale_next_wrap)
  72.  
  73. " FZF configuration (with Ag)
  74. set rtp+=/usr/local/opt/fzf
  75. let $FZF_DEFAULT_COMMAND= 'ag --hidden --ignore .git -g ""'
  76. let g:fzf_history_dir = '~/.local/share/fzf-history'
  77. let g:fzf_colors =
  78. \ { 'fg': ['fg', 'Normal'],
  79. \ 'bg': ['bg', 'Normal'],
  80. \ 'hl': ['fg', 'Comment'],
  81. \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  82. \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
  83. \ 'hl+': ['fg', 'Statement'],
  84. \ 'info': ['fg', 'PreProc'],
  85. \ 'prompt': ['fg', 'Conditional'],
  86. \ 'pointer': ['fg', 'Exception'],
  87. \ 'marker': ['fg', 'Keyword'],
  88. \ 'spinner': ['fg', 'Label'],
  89. \ 'header': ['fg', 'Comment'] }
  90.  
  91. " No ext for jsx files
  92. let g:jsx_ext_required = 0
  93.  
  94. command! -bang -nargs=* Rg
  95. \ call fzf#vim#grep(
  96. \ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1,
  97. \ fzf#vim#with_preview('right:40%'),
  98. \ <bang>0)
  99.  
  100. " Prettier configuration
  101. let g:prettier#config#semi = 'false'
  102. let g:prettier#config#trailing_comma = 'es5'
  103. let g:prettier#config#bracket_spacing = 'true'
  104. let g:prettier#config#singleQuote = 'true'
  105.  
  106. nmap <Leader>b :Buffers<CR>
  107. nmap <Leader>f :Files<CR>
  108. nmap <Leader>r :Tags<CR>
  109. nmap <Leader>s :Rg<CR>
  110.  
  111. " Remove all trailing spaces
  112. autocmd BufWritePre * %s/\s\+$//e
  113.  
  114. " Undodir
  115. set undodir=~/.config/vim/tmp/undo//
  116. " Backupdir
  117. set backupdir=~/.config/vim/tmp/backup//
  118. " Swapfile
  119. set directory=~/.config/vim/tmp/swap//
  120.  
  121. " Make those folders automatically if they don't already exist.
  122. if !isdirectory(expand(&undodir))
  123. call mkdir(expand(&undodir), "p")
  124. endif
  125. if !isdirectory(expand(&backupdir))
  126. call mkdir(expand(&backupdir), "p")
  127. endif
  128. if !isdirectory(expand(&directory))
  129. call mkdir(expand(&directory), "p")
  130. endif
  131.  
  132. " Enable backups for Gundo
  133. set backup
  134. " Save the file
  135. set undofile
  136.  
  137. map <C-n> :NERDTreeToggle<CR>
Add Comment
Please, Sign In to add comment