Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. " Author: Emiliano Firmino
  2. " Contact: emiliano.firmino@gmail.com
  3. " Description: New vim configuration for 2016
  4.  
  5. set nocompatible
  6. filetype off
  7. set rtp+=~/.vim/bundle/Vundle.vim/
  8. call vundle#begin()
  9. Plugin 'VundleVim/Vundle.vim'
  10. Plugin 'aperezdc/vim-template.git'
  11. Plugin 'flazz/vim-colorschemes.git'
  12. Plugin 'Lokaltog/vim-powerline.git'
  13. Plugin 'Gundo'
  14. Plugin 'scrooloose/nerdcommenter.git'
  15. Plugin 'scrooloose/nerdtree.git'
  16. Plugin 'tpope/vim-fugitive.git'
  17. Plugin 'surround.vim'
  18. Plugin 'L9'
  19. Plugin 'vim-scripts/FuzzyFinder.git'
  20. call vundle#end()
  21.  
  22. filetype plugin indent on
  23.  
  24. scriptencoding utf-8
  25. set encoding=utf-8
  26.  
  27. set modelines=5
  28. syntax enable " enable syntax highlight
  29.  
  30. set autoread " reload file if changed outside
  31. set backspace=indent,eol,start " expected behavior for backspace
  32. set backup " always keep a backup file
  33. set clipboard=unnamed " expected behavior for clipboard
  34. set laststatus=2 " show status line
  35. set hlsearch " enable search highligh
  36. set mouse=a " expected behavior for mouse
  37. set nocompatible " remove vi compability annoyances
  38. set nowrap " don't break virtual lines
  39. set number " show line number
  40. set list " show invisible character
  41. set wildmenu " show command suggestions
  42. set wildmode=list:longest,full " list available options
  43. set virtualedit=onemore " add virtual character at the end
  44.  
  45. " Typo fixes
  46. cab W w
  47. cab Q q
  48. cab Wq wq
  49. cab wQ wq
  50. cab WQ wq
  51. cab Qa qa
  52. cab qA qa
  53. cab QA qa
  54.  
  55. " Real programmers don't use tabs but spaces
  56. set expandtab " Convert pressed tab to spaces
  57. set shiftround " Round shiftwidth to multiples
  58. set shiftwidth=4 " Number of spaces to use for each step of indent
  59. set softtabstop=4 " Number of spaces that a tab counts
  60. set tabstop=4 " Number of spaces that a tab counts
  61.  
  62. " Common Editor Shortcuts
  63. nnoremap ; :
  64.  
  65. " Undo
  66. noremap <silent> <C-Z> :undo<CR>
  67. vnoremap <silent> <C-Z> :undo<CR>
  68. inoremap <silent> <C-Z> <ESC>:undo<CR>`[
  69.  
  70. " Redo
  71. inoremap <silent> <C-Y> <C-R>
  72. noremap <silent> <C-Y> <C-R>
  73. vnoremap <silent> <C-Y> <C-R>
  74.  
  75. " Save
  76. noremap <silent> <C-S> :update<CR>
  77. vnoremap <silent> <C-S> :update<CR>
  78. inoremap <silent> <C-S> <ESC>:update<CR>`[
  79.  
  80. " Copy to Clipboard
  81. noremap <silent> <C-C> Y
  82. vnoremap <silent> <C-C> y
  83. inoremap <silent> <C-C> <ESC>Y`[
  84.  
  85. " Paste from Clipboard
  86. noremap <silent> <C-V> p
  87. vnoremap <silent> <C-V> p
  88. inoremap <silent> <C-V> <ESC>p`[
  89.  
  90. " Close Vim
  91. noremap <silent> <C-X> :quit<CR>
  92. vnoremap <silent> <C-X> :quit<CR>
  93. inoremap <silent> <C-X> <ESC>:quit<CR>`[
  94.  
  95. " Firefox Like TabNavigation
  96. nnoremap <C-S-tab> :tabprevious<CR>
  97. nnoremap <C-tab> :tabnext<CR>
  98. nnoremap <C-t> :tabnew<CR>
  99. inoremap <C-S-tab> <Esc>:tabprevious<CR>`[
  100. inoremap <C-tab> <Esc>:tabnext<CR>`[
  101. inoremap <C-t> <Esc>:tabnew<CR>
  102.  
  103. " Vi Like TAbNavigation
  104. nnoremap th :tabfirst<CR>
  105. nnoremap tj :tabnext<CR>
  106. nnoremap tk :tabprev<CR>
  107. nnoremap tl :tablast<CR>
  108. nnoremap tt :tabedit<Space>
  109. nnoremap tn :tabnext<Space>
  110. nnoremap tm :tabm<Space>
  111. nnoremap td :tabclose<CR>
  112.  
  113. " Go to Tab
  114. nnoremap <A-1> 1gt
  115. nnoremap <A-2> 2gt
  116. nnoremap <A-3> 3gt
  117. nnoremap <A-4> 4gt
  118. nnoremap <A-5> 5gt
  119. nnoremap <A-6> 6gt
  120. nnoremap <A-7> 7gt
  121. nnoremap <A-8> 8gt
  122. nnoremap <A-9> 9gt
  123. nnoremap <A-0> 10gt
  124.  
  125. " Split Navigation
  126. map <silent> <C-h> <C-w>h
  127. map <silent> <C-j> <C-w>j
  128. map <silent> <C-k> <C-w>k
  129. map <silent> <C-l> <C-w>l
  130.  
  131. " Bubble single lines
  132. nmap <silent> <C-Up> [e
  133. nmap <silent> <C-Down> ]e
  134.  
  135. " Bubble multiple lines
  136. nmap <silent> <C-Up> [egv
  137. nmap <silent> <C-Down> ]egv
  138.  
  139. " Sort Functions to a key when press '\'s
  140. vnoremap <Leader>s :sort<CR>
  141.  
  142. " Toggle invisible
  143. noremap <Leader>i :set list!<CR>
  144.  
  145. " Toggle NERDTree
  146. map <C-n> :NERDTreeToggle<CR>
  147.  
  148. " Easier moving of code blocks
  149. vnoremap < <gv
  150. vnoremap > >gv
  151.  
  152. " Invisible characters
  153. set listchars=tab:>\ ,eol:¬,trail:.
  154.  
  155. " Show WhiteSpaces
  156. autocmd InsertLeave * match ExtraWhitespace /\s\+$/
  157. autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
  158.  
  159. " Remove WhiteSpaces
  160. autocmd BufWritePre * :%s/\s\+$//e
  161.  
  162. " Easier formatting paragraphs
  163. vmap Q gq
  164. nmap Q gqap
  165.  
  166. " Alert problems
  167. hi Problem ctermbg=red guibg=red
  168. match Problem /\s\+$/
  169. match Problem /^\s\*\t\+\s\*/
  170. nnoremap <silent> ,a :call Preserve("%s/\\s\\+$//e")<CR>
  171. autocmd BufWritePre *.py, *.js, *.dtml :call Preserver("%s/\\s\\+$//e")
  172.  
  173. " Vim-template Config
  174. let g:email = "emiliano.firmino@gmail.com"
  175. let g:user = "Emiliano Firmino"
  176.  
  177. " Colorscheme
  178. colorscheme elise
  179.  
  180. let g:vimshell_prompt = "$"
  181. let g:vimshell_secondary_prompt = ">"
  182. let g:SuperTabDefaultCompletionType = "context"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement