All of my important config files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

186 lines
6.3 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. set nocompatible " be iMproved, required
  2. filetype off " required
  3. " Load vim-plug
  4. if empty(glob("~/.vim/autoload/plug.vim"))
  5. execute '!curl -fLo ~/.vim/autoload/plug.vim https://raw.github.com/junegunn/vim-plug/master/plug.vim'
  6. endif
  7. call plug#begin()
  8. " alternatively, pass a path where Vundle should install plugins
  9. "call vundle#begin('~/some/path/here')
  10. " let Vundle manage Vundle, required
  11. Plug 'VundleVim/Vundle.vim'
  12. " The following are examples of different formats supported.
  13. " Keep Plugin commands between vundle#begin/end.
  14. " plugin on GitHub repo
  15. Plug 'tpope/vim-fugitive'
  16. " plugin from http://vim-scripts.org/vim/scripts.html
  17. Plug 'L9'
  18. " Git plugin not hosted on GitHub
  19. Plug 'tpope/vim-sensible'
  20. Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
  21. Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
  22. Plug 'kien/ctrlp.vim'
  23. Plug 'scrooloose/nerdcommenter'
  24. "Plug 'myusuf3/numbers.vim'
  25. Plug 'Shougo/neocomplete.vim'
  26. Plug 'Shougo/neosnippet.vim'
  27. Plug 'easymotion/vim-easymotion'
  28. Plug 'bling/vim-airline'
  29. Plug 'tpope/vim-ragtag'
  30. Plug 'surround.vim'
  31. " html / templates
  32. Plug 'mattn/emmet-vim', { 'for': 'html' } " emmet support for vim - easily create markdup wth CSS-like syntax
  33. Plug 'gregsexton/MatchTag', { 'for': 'html' } " match tags in html, similar to paren support
  34. Plug 'othree/html5.vim', { 'for': 'html' } " html5 support
  35. " JavaScript
  36. Plug 'gavocanov/vim-js-indent', { 'for': 'javascript' } " JavaScript indent support
  37. Plug 'moll/vim-node', { 'for': 'javascript' } " node support
  38. Plug 'othree/yajs.vim', { 'for': 'javascript' } " JavaScript syntax plugin
  39. Plug 'othree/es.next.syntax.vim', { 'for': 'javascript' } " ES6 and beyond syntax
  40. " Go
  41. Plug 'fatih/vim-go', { 'for': 'go' } " go support
  42. " All of your Plugins must be added before the following line
  43. call plug#end() " required
  44. filetype plugin indent on " required
  45. " To ignore plugin indent changes, instead use:
  46. "filetype plugin on
  47. " S E T T I N G S
  48. set number
  49. set autoread
  50. set history=1000
  51. " make comments and HTML attributes italic
  52. highlight Comment cterm=italic
  53. highlight htmlArg cterm=italic
  54. set autoindent " automatically set indent of new line
  55. set smartindent
  56. set tabstop=4
  57. set shiftwidth=4
  58. set expandtab
  59. " toggle invisible characters
  60. set list
  61. set listchars=tab:→\ ,eol,trail:⋅,extends:❯,precedes:❮
  62. set showbreak=
  63. set ttyfast " faster redrawing
  64. set diffopt+=vertical
  65. set laststatus=2 " show the satus line all the time
  66. set so=7 " set 7 lines to the cursors - when moving vertical
  67. set wildmenu " enhanced command line completion
  68. set hidden " current buffer can be put into background
  69. set showcmd " show incomplete commands
  70. " set noshowmode " don't show which mode disabled for PowerLine
  71. set wildmode=list:longest " complete files like a shell
  72. set scrolloff=3 " lines of text around cursor
  73. set shell=$SHELL
  74. set cmdheight=1 " command bar height
  75. set title " set terminal title
  76. " Uncomment the following to have Vim jump to the last position when
  77. " reopening a file
  78. if has("autocmd")
  79. au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
  80. \| exe "normal! g'\"" | endif
  81. endif
  82. " P L U G I N S
  83. let NERDTreeShowHidden=1
  84. let g:airline_powerline_fonts = 1
  85. " M A P P I N G S
  86. let mapleader = ","
  87. " Toggle NERDTree
  88. nmap <silent> <leader>k :NERDTreeToggle<cr>
  89. " expand to the path of the file in the current buffer
  90. nmap <silent> <leader>y :NERDTreeFind<cr>
  91. " Allow saving of files as sudo when I forgot to start vim using sudo.
  92. cmap w!! w !sudo tee > /dev/null %
  93. "Toggle set paste
  94. nmap <leader>tp :set paste!<cr>
  95. " N E O C O M P L E T E
  96. "Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
  97. " Disable AutoComplPop.
  98. let g:acp_enableAtStartup = 0
  99. " Use neocomplete.
  100. let g:neocomplete#enable_at_startup = 1
  101. " Use smartcase.
  102. let g:neocomplete#enable_smart_case = 1
  103. " Set minimum syntax keyword length.
  104. let g:neocomplete#sources#syntax#min_keyword_length = 3
  105. " Define dictionary.
  106. let g:neocomplete#sources#dictionary#dictionaries = {
  107. \ 'default' : '',
  108. \ 'vimshell' : $HOME.'/.vimshell_hist',
  109. \ 'scheme' : $HOME.'/.gosh_completions'
  110. \ }
  111. " Define keyword.
  112. if !exists('g:neocomplete#keyword_patterns')
  113. let g:neocomplete#keyword_patterns = {}
  114. endif
  115. let g:neocomplete#keyword_patterns['default'] = '\h\w*'
  116. " Plugin key-mappings.
  117. inoremap <expr><C-g> neocomplete#undo_completion()
  118. inoremap <expr><C-l> neocomplete#complete_common_string()
  119. " Recommended key-mappings.
  120. " <CR>: close popup and save indent.
  121. inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
  122. function! s:my_cr_function()
  123. return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
  124. " For no inserting <CR> key.
  125. "return pumvisible() ? "\<C-y>" : "\<CR>"
  126. endfunction
  127. " <TAB>: completion.
  128. inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
  129. " <C-h>, <BS>: close popup and delete backword char.
  130. inoremap <expr><C-h> neocomplete#smart_close_popup()."\<C-h>"
  131. inoremap <expr><BS> neocomplete#smart_close_popup()."\<C-h>"
  132. " Close popup by <Space>.
  133. "inoremap <expr><Space> pumvisible() ? "\<C-y>" : "\<Space>"
  134. " AutoComplPop like behavior.
  135. "let g:neocomplete#enable_auto_select = 1
  136. " Shell like behavior(not recommended).
  137. "set completeopt+=longest
  138. "let g:neocomplete#enable_auto_select = 1
  139. "let g:neocomplete#disable_auto_complete = 1
  140. "inoremap <expr><TAB> pumvisible() ? "\<Down>" : "\<C-x>\<C-u>"
  141. " Enable omni completion.
  142. autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
  143. autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
  144. autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
  145. autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
  146. autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
  147. " Enable heavy omni completion.
  148. if !exists('g:neocomplete#sources#omni#input_patterns')
  149. let g:neocomplete#sources#omni#input_patterns = {}
  150. endif
  151. "let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\|\h\w*::'
  152. "let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\|->\)'
  153. "let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::'
  154. " For perlomni.vim setting.
  155. " https://github.com/c9s/perlomni.vim
  156. let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'