medmond919

Amazing VIMRC

Mar 25th, 2018
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. " .vimrc
  2.  
  3.  
  4. " Setup
  5.  
  6. " Leader as a comma
  7. let mapleader = ","
  8. " Use Vim features, not Vi
  9. set nocompatible
  10. set encoding=utf-8
  11.  
  12.  
  13. " Set the dimmed colour for Limelight
  14. " let g:limelight_conceal_ctermfg = 'LightGrey'
  15.  
  16. " Starts Vundle
  17. set nocompatible              " be iMproved, required
  18. filetype off                  " required
  19.  
  20. " set the runtime path to include Vundle and initialize
  21. set rtp+=~/.vim/bundle/Vundle.vim
  22. call vundle#begin()
  23. " alternatively, pass a path where Vundle should install plugins
  24. "call vundle#begin('~/some/path/here')
  25.  
  26. " let Vundle manage Vundle, required
  27. Plugin 'VundleVim/Vundle.vim'
  28. Plugin 'bling/vim-airline'
  29. Plugin 'vim-airline/vim-airline-themes'
  30. Plugin 'altercation/vim-colors-solarized'
  31. Plugin 'bling/vim-bufferline'
  32. Plugin 'tpope/vim-fugitive'
  33. Plugin 'kien/ctrlp.vim'
  34. Plugin 'mattn/emmet-vim'
  35. Plugin 'scrooloose/nerdtree'
  36. Plugin 'cakebaker/scss-syntax.vim'
  37. Plugin 'Xuyuanp/nerdtree-git-plugin'
  38. Plugin 'nathanaelkane/vim-indent-guides'
  39. Plugin 'othree/html5.vim'
  40. Plugin 'ap/vim-css-color'
  41. Plugin 'tpope/vim-commentary'
  42. " All of your Plugins must be added before the following line
  43. call vundle#end()            " required
  44. filetype plugin indent on    " required
  45. " ends Vundle
  46.  
  47.  
  48. " Syntax highlighting
  49.  
  50. " Enable syntax highighting
  51. syntax enable
  52. " 256 colours please
  53. set t_Co=256
  54. " Dark solarized scheme
  55. set background=dark
  56. colorscheme solarized
  57.  
  58. " Emmet setting
  59. let g:user_emmet_install_global = 0
  60. autocmd FileType html,css EmmetInstall
  61.  
  62.  
  63. "CtrlP
  64. let g:ctrlp_map = '<c-p>'
  65. let g:ctrlp_show_hidden = 1
  66.  
  67. " Airline
  68. let g:airline#extensions#bufferline#enabled = 1
  69. set laststatus=2
  70.  
  71. let g:airline#extensions#tabline#enabled = 1
  72. let g:airline#extensions#tabline#left_sep = ' '
  73. let g:airline#extensions#tabline#left_alt_sep = '|'
  74. " Removes the path of the files
  75. let g:airline#extensions#tabline#fnamemod = ':t'
  76.  
  77. let g:airline_theme='powerlineish'
  78. let g:airline_right_sep=''
  79. let g:airline_section_z=''
  80.  
  81. " NERDTree
  82.  
  83. " Run NERDTree as soon as we launch Vim...
  84. "autocmd vimenter * NERDTree
  85. "" ...but focus on the file itself, rather than NERDTree
  86. "autocmd VimEnter * wincmd p
  87. " Close Vim if only NERDTree is left open
  88. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  89. let NERDTreeShowHidden=1
  90.  
  91.  
  92. " Set relevant filetypes
  93. " au BufRead,BufNewFile *.scss set filetype=css
  94. au BufRead,BufNewFile *.md set filetype=markdown
  95. au BufRead,BufNewFile *.hbs set filetype=html
  96.  
  97.  
  98. " Buffer management
  99.  
  100. " Open splits to the right or below; more natural than the default
  101. set splitright
  102. set splitbelow
  103. " Set the working directory to wherever the open file lives (can be problematic)
  104. set autochdir
  105. " set path+=**
  106. " Show file options above the command line
  107. set wildmenu
  108.  
  109.  
  110. " Text management
  111.  
  112. filetype plugin indent on
  113. " 2 spaces please
  114. set expandtab
  115. set shiftwidth=2
  116. set tabstop=2
  117. set softtabstop=2
  118. " Round indent to nearest multiple of 2
  119. set shiftround
  120. " No line-wrapping
  121. set nowrap
  122. " Spell-check always on
  123. set spell
  124. " Underscores denote words
  125. set iskeyword-=_
  126. " No extra spaces when joining lines
  127. set nojoinspaces
  128. " Interpret numbers with leading zeroes as decimal, not octal
  129. set nrformats=
  130.  
  131. "Sets soft wrapping
  132. set breakindent
  133.  
  134. " refreshes buffers when you do git merge  or change fils with git
  135. set autoread
  136.  
  137.  
  138.  
  139. " Interactions
  140.  
  141. " Start scrolling slightly before the cursor reaches an edge
  142. set scrolloff=3
  143. set sidescrolloff=5
  144. " Scroll sideways a character at a time, rather than a screen at a time
  145. set sidescroll=1
  146. " Allow motions and back-spacing over line-endings etc
  147. set backspace=indent,eol,start
  148. set whichwrap=h,l,b,<,>,~,[,]
  149.  
  150.  
  151.  
  152. " Visual decorations
  153.  
  154. " Show status line
  155. set laststatus=2
  156. " Show what mode you're currently in
  157. set showmode
  158. " Show what commands you're typing
  159. set showcmd
  160. " Allow modelines
  161. set modeline
  162. " Show current line and column position in file
  163. set ruler
  164. " Show file title in terminal tab
  165. set title
  166. " Show invisibles
  167. set list
  168. set listchars=tab:»-,trail:
  169. " Set relative line numbers...
  170. set relativenumber
  171. " ...but absolute numbers on the current line
  172. set number
  173. " Limit line-length to 80 columns by highlighting col 81 onward
  174. set colorcolumn=81
  175. " Force cursor onto a new line after 80 characters
  176. set textwidth=80
  177. " Highlight current line
  178. set cursorline
  179. " Mute bells
  180. set visualbell
  181.  
  182.  
  183.  
  184. " Search
  185.  
  186. " Don't keep results highlighted after searching...
  187. set nohlsearch
  188. " ...just highlight as we type
  189. " set incsearch
  190. " Ignore case when searching...
  191. set ignorecase
  192. " ...except if we input a capital letter
  193. set smartcase
  194.  
  195.  
  196.  
  197. " Abbreviations and auto-completions
  198.  
  199. " lipsum<Tab> drops some Lorem ipsum text into the document
  200. iab lipsum Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
  201.  
  202. " Key mappings
  203.  
  204. " jj to throw you into normal mode from insert mode
  205. " inoremap jj <esc>
  206. " jk to throw you into normal mode from insert mode
  207. " inoremap jk <esc>
  208. " Disable arrow keys (hardcore)
  209.   " map  <up>    <nop>
  210.   " imap <up>    <nop>
  211.   " map  <down>  <nop>
  212. "  imap <down>  <nop>
  213. "  map  <left>  <nop>
  214. "  imap <left>  <nop>
  215. "  map  <right> <nop>
  216. "  map <right> <nop>
  217. "  nnoremap <Left> :echoe "Use h"<CR>
  218. "  nnoremap <Right> :echoe "Use l"<CR>
  219. "  nnoremap <Up> :echoe "Use k"<CR>
  220. "  nnoremap <Down> :echoe "Use j"<CR>
  221.  
  222. " let mapleader = ","
  223.  
  224. "  Set clipboard to unname so I can yy and paste in another app like Atom
  225. set clipboard=unnamed
  226.  
  227. " Send more characters for redraws
  228. set ttyfast
  229.  
  230. " Enable mouse use in all modes
  231. set mouse=a
  232.  
  233. " Set this to the name of your terminal that supports mouse codes.
  234. " Must be one of: xterm, xterm2, netterm, dec, jsbterm, pterm
  235. set ttymouse=xterm2
  236.  
  237. " Save And quits
  238. nnoremap <Leader>w :w<CR>
  239. nnoremap <Leader>q :q<CR>
  240.  
  241. map <Leader>/ gc$<ESC>
  242.  
  243. " Oprns ctrl P
  244. nnoremap <Leader>o :CtrlP<CR>
  245.  
  246. " Move around buffers
  247. nnoremap <Leader>b :bp<CR>
  248. nnoremap <Leader>f :bn<CR>
  249.  
  250. " Insert lines, I am so happy with this one
  251. map <Enter> o<ESC>
  252.  
  253. nnoremap <leader>ev :split $MYVIMRC<CR>
  254. nnoremap <leader>sv :source $MYVIMRC<CR>
Advertisement