Guest User

Untitled

a guest
Oct 19th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.65 KB | None | 0 0
  1. " This file should be at ~/.config/nvim/init.vim
  2. call plug#begin('~/.nvim/plugged')
  3. Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins'}
  4. Plug 'carlitux/deoplete-ternjs'
  5. Plug 'gioele/vim-autoswap'
  6. Plug 'vim-scripts/YankRing.vim'
  7. Plug 'ervandew/supertab'
  8. Plug 'neomake/neomake'
  9. Plug 'tpope/vim-surround'
  10. Plug 'tpope/vim-fugitive'
  11. Plug 'sjl/gundo.vim'
  12. Plug 'scrooloose/nerdtree'
  13. Plug 'scrooloose/nerdcommenter'
  14. Plug 'Yggdroot/indentLine'
  15. Plug 'edkolev/tmuxline.vim'
  16. Plug 'itchyny/lightline.vim'
  17. Plug 'jaawerth/nrun.vim'
  18. Plug 'mattn/emmet-vim'
  19. Plug 'mattn/webapi-vim'
  20. Plug 'mattn/gist-vim'
  21. Plug 'eapache/rainbow_parentheses.vim'
  22. Plug 'airblade/vim-gitgutter'
  23. Plug 'pangloss/vim-javascript'
  24. Plug 'othree/javascript-libraries-syntax.vim'
  25. Plug 'mxw/vim-jsx'
  26. Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
  27. Plug 'junegunn/fzf.vim'
  28. Plug 'godlygeek/tabular'
  29. Plug 'plasticboy/vim-markdown'
  30. Plug 'reedes/vim-pencil'
  31. Plug 'reedes/vim-litecorrect'
  32. Plug 'junegunn/goyo.vim'
  33. Plug 'junegunn/limelight.vim'
  34. Plug 'amix/vim-zenroom2'
  35. Plug 'onur/vim-motivate'
  36. Plug 'mhinz/vim-startify'
  37. Plug 'slashmili/alchemist.vim'
  38. Plug 'elixir-editors/vim-elixir'
  39. Plug 'tpope/vim-rails'
  40. Plug 'fleischie/vim-styled-components'
  41. Plug 'elzr/vim-json'
  42. Plug 'Raimondi/delimitMate'
  43. Plug 'fatih/vim-go'
  44. Plug 'tpope/vim-repeat'
  45. call plug#end()
  46.  
  47. colorscheme molokai
  48. "for proper scrolling/mouse behavior
  49. set mouse=a
  50. "don't find these filetypes
  51. set wildignore+=*.jpg,*.jpeg,*.gif,*.png,*.mov,*.pdf,*.psd,*.ai
  52. "don't find these filetypes either
  53. set wildignore+=*.ppt,*.pptx,*.doc,*.docx,*.xls,*.xlsx
  54. "be able to copy from neovim to clipboard on mac and ubuntu
  55. set clipboard=unnamedplus
  56. set number
  57. set smartcase
  58. set ignorecase
  59. set noshowmode
  60. set expandtab
  61. set shiftwidth=2
  62. set softtabstop=2
  63. set tabstop=2
  64. set smartindent
  65. set autoindent
  66. set listchars=tab:--,trail:ยท
  67. set list
  68. set scrolloff=8
  69. set complete+=kspell
  70. set dictionary="/usr/dict/words"
  71. set directory=~/.config/nvim/tmp//
  72. set backupdir=~/.config/nvim/tmp/backup//
  73. set undofile
  74. set history=500
  75. set undodir=~/.config/nvim/tmp/undo//
  76. set undolevels=500
  77. set undoreload=5000
  78. "show the column line at col 80
  79. set colorcolumn=80
  80. "code folding settings, colors, and params
  81. set foldmethod=indent
  82. set foldcolumn=1
  83. set foldlevelstart=20
  84. hi foldcolumn ctermbg=232
  85. hi folded ctermbg=232
  86. hi foldcolumn ctermfg=242
  87. hi folded ctermfg=242
  88. "don't hide characters, like json quotes wtf
  89. let g:vim_json_syntax_conceal = 0
  90. "space is leader key
  91. let mapleader = "\<Space>"
  92. "faster normal mode from insert mode
  93. inoremap jj <ESC>
  94. "faster saving
  95. nnoremap <leader>w :w<CR>
  96. "jsx commenting
  97. nnoremap <leader>jc i{/*<space>*/}<esc>hhi
  98. "open NERDTree
  99. map <C-o> :NERDTreeToggle %:p:h<CR>
  100. "open Gundo
  101. nnoremap <leader>u :GundoToggle<CR>
  102. "tab with visual mode
  103. vmap <Tab> >gv
  104. "back tab with visual mode
  105. vmap <S-Tab> <gv
  106. "edit this file in a new window
  107. nnoremap <leader>ev :vsp $MYVIMRC<CR>
  108. "fuzzy find file in project with FZF
  109. nnoremap F :FZF<CR>
  110. "search project for word under cursor with Ag
  111. nnoremap <silent> <leader>f :Ag <C-R><C-W><CR>
  112. "start Ag search
  113. nnoremap <leader>ag :Ag<space>
  114. "git status
  115. nnoremap <leader>gs :Gstatus<CR>
  116. "git commit
  117. nnoremap <leader>gcm :Gcommit -m<space>
  118. "moves line down in normal mode
  119. nnoremap <C-j> :m .+1<CR>==
  120. "moves line up in normal mode
  121. nnoremap <C-k> :m .-2<CR>==
  122. "moves cursor down line in insert mode "
  123. inoremap <C-j> <Esc>:m .+1<CR>==gi
  124. "moves cursor up line in insert mode "
  125. inoremap <C-k> <Esc>:m .-2<CR>==gi
  126. "moves selected block down line visual mode
  127. vnoremap <C-j> :m '>+1<CR>gv=gv
  128. "moves selected block up line visual mode
  129. vnoremap <C-k> :m '<-2<CR>gv=gv
  130. "distraction-free mode
  131. nnoremap <silent> <leader>z :Goyo<CR>
  132. "destroy/undo current insert operation with ctrl-c
  133. inoremap <C-c> <C-c>u
  134. "leave insert mode with ctrl-c
  135. vnoremap <C-c> <Esc>
  136. "use the startified screen on startup
  137. autocmd User Startified setlocal cursorline
  138. autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
  139. autocmd InsertLeave * if pumvisible() == 0|pclose|endif
  140. "strip all trailing whitespace in file on save
  141. autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()
  142. function! <SID>StripTrailingWhitespaces()
  143. let l = line(".")
  144. let c = col(".")
  145. %s/\s\+$//e
  146. call cursor(l, c)
  147. endfun
  148. "enable rainbow colors for parens, squares, and curlies
  149. au VimEnter * RainbowParenthesesToggle
  150. au Syntax * RainbowParenthesesLoadRound
  151. au Syntax * RainbowParenthesesLoadSquare
  152. au Syntax * RainbowParenthesesLoadBraces
  153. "markdown spellcheck, wrap text, auto-correct words, and enable pencil
  154. autocmd bufread,bufnewfile *.md,*.markdown inoremap . .<c-g>u
  155. autocmd bufread,bufnewfile *.md,*.markdown inoremap ? ?<c-g>u
  156. autocmd bufread,bufnewfile *.md,*.markdown inoremap ! !<c-g>u
  157. autocmd bufread,bufnewfile *.md,*.markdown inoremap , ,<c-g>u
  158. autocmd bufread,bufnewfile *.md,*.markdown setlocal spell
  159. autocmd bufread,bufnewfile *.md,*.markdown setlocal wrap
  160. autocmd bufread,bufnewfile *.md,*.markdown call litecorrect#init()
  161. autocmd bufread,bufnewfile *.md,*.markdown call pencil#init({'wrap': 'soft'})
  162. "all linters on save
  163. autocmd! BufWritePost * Neomake
  164. "enable deoplete for code completion
  165. let g:deoplete#enable_at_startup = 1
  166. let g:NERDSpaceDelims = 1
  167. "lightline settings for status bar
  168. let g:lightline = {
  169. \ 'colorscheme': 'wombat',
  170. \ 'active': {
  171. \ 'left': [ [ 'mode', 'paste' ],
  172. \ [ 'fugitive', 'readonly', 'relativepath', 'modified' ] ],
  173. \ 'right': [ [ 'lineinfo' ],
  174. \ [ 'percent' ],
  175. \ [ 'filetype' ] ]
  176. \ },
  177. \ 'component': {
  178. \ 'readonly': '%{&readonly?"x":""}',
  179. \ 'fugitive': '%{exists("*fugitive#head")?fugitive#head():""}'
  180. \ },
  181. \ 'component_visible_condition': {
  182. \ 'fugitive': '(exists("*fugitive#head") && ""!=fugitive#head())'
  183. \ },
  184. \ 'separator': { 'left': '', 'right': '' },
  185. \ 'subseparator': { 'left': '|', 'right': '|' }
  186. \ }
  187. let g:user_emmet_expandabbr_key = '<c-y>'
  188. let g:tmuxline_powerline_separators = 0
  189. "don't conceal any syntax in markdown
  190. let g:vim_markdown_conceal = 0
  191. "highlight frontmatter in markdown
  192. let g:vim_markdown_frontmatter = 1
  193. let g:tern_request_timeout = 1
  194. let g:indentLine_char = 'โ”†'
  195. let NERDTreeShowHidden = 1
  196. let g:SuperTabDefaultCompletionType = "<c-n>"
  197. let g:jsx_ext_required = 0
  198. au BufEnter *.js let b:neomake_javascript_eslint_exe = nrun#Which('eslint')
  199. let g:neomake_jsx_enabled_makers = ['eslint']
  200. let g:neomake_javascript_enabled_makers = ['eslint']
  201. let g:neomake_scss_enabled_makers = ['stylelint']
  202. let g:neomake_css_enabled_makers = ['stylelint']
  203. let g:neomake_open_list = 1
  204. let g:neomake_list_height = 3
  205. let g:yankring_history_dir = '~/.config/nvim/tmp/yank'
  206. let g:user_emmet_settings = {
  207. \ 'javascript' : {
  208. \ 'extends' : 'jsx',
  209. \ },
  210. \}
  211. let g:startify_change_to_dir = 0
  212. let g:startify_custom_header =
  213. \ map(split(system('fortune -s | cowsay | lolcat'), '\n'), '" ". v:val') + ['']
  214. "gist creation settings
  215. let g:gist_open_browser_after_post = 1
  216. let g:gist_detect_filetype = 1
  217. runtime macros/matchit.vim
  218. "distraction free mode limelight and goyo settings
  219. function! s:goyo_enter()
  220. silent !tmux set status off
  221. Goyo 100x90%
  222. Limelight
  223. endfun
  224. function! s:goyo_leave()
  225. silent !tmux set status on
  226. Limelight!
  227. endfun
  228. autocmd! User GoyoEnter nested call <SID>goyo_enter()
  229. autocmd! User GoyoLeave nested call <SID>goyo_leave()
  230. "actual codefolding that doesn't suck
  231. if has('conceal')
  232. set conceallevel=2 concealcursor=niv
  233. endif
  234. " CTRL-A CTRL-Q to select all and build quickfix list
  235. function! s:build_quickfix_list(lines)
  236. call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
  237. copen
  238. cc
  239. endfunction
  240. let g:fzf_action = {
  241. \ 'ctrl-q': function('s:build_quickfix_list'),
  242. \ 'ctrl-t': 'tab split',
  243. \ 'ctrl-x': 'split',
  244. \ 'ctrl-v': 'vsplit' }
  245. let $FZF_DEFAULT_OPTS = '--bind ctrl-a:select-all'
Add Comment
Please, Sign In to add comment