Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 9.53 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. " -----------------------------------------------------------------------------  
  2. " |                            VIM Settings                                   |
  3. " |                   (see gvimrc for gui vim settings)                       |
  4. " |                                                                           |
  5. " | Some highlights:                                                          |
  6. " |   jj = <esc>  Very useful for keeping your hands on the home row          |
  7. " |   ,n = toggle NERDTree off and on                                         |
  8. " |                                                                           |
  9. " |   ,f = fuzzy find all files                                               |
  10. " |   ,b = fuzzy find in all buffers                                          |
  11. " |                                                                           |
  12. " |   hh = inserts '=>'                                                       |
  13. " |   aa = inserts '@'                                                        |
  14. " |                                                                           |
  15. " |   ,h = new horizontal window                                              |
  16. " |   ,v = new vertical window                                                |
  17. " |                                                                           |
  18. " |   ,i = toggle invisibles                                                  |
  19. " |                                                                           |
  20. " |   enter and shift-enter = adds a new line after/before the current line   |
  21. " |                                                                           |
  22. " |   :call Tabstyle_tabs = set tab to real tabs                              |
  23. " |   :call Tabstyle_spaces = set tab to 2 spaces                             |
  24. " |                                                                           |
  25. " | Put machine/user specific settings in ~/.vimrc.local                      |
  26. " -----------------------------------------------------------------------------  
  27.  
  28.  
  29. set nocompatible
  30.  
  31.  
  32. " Tabs ************************************************************************
  33. "set sta " a <Tab> in an indent inserts 'shiftwidth' spaces
  34.  
  35. function! Tabstyle_tabs()
  36.   " Using 4 column tabs
  37.   set softtabstop=4
  38.   set shiftwidth=4
  39.   set tabstop=4
  40.   set noexpandtab
  41.   autocmd User Rails set softtabstop=4
  42.   autocmd User Rails set shiftwidth=4
  43.   autocmd User Rails set tabstop=4
  44.   autocmd User Rails set noexpandtab
  45. endfunction
  46.  
  47. function! Tabstyle_spaces()
  48.   " Use 2 spaces
  49.   set softtabstop=4
  50.   set shiftwidth=4
  51.   set tabstop=4
  52.   set expandtab
  53. endfunction
  54.  
  55. call Tabstyle_spaces()
  56.  
  57.  
  58. " Indenting *******************************************************************
  59. set ai " Automatically set the indent of a new line (local to buffer)
  60. set si " smartindent    (local to buffer)
  61.  
  62.  
  63. " Scrollbars ******************************************************************
  64. set sidescrolloff=2
  65. set numberwidth=4
  66.  
  67.  
  68. " Windows *********************************************************************
  69. set equalalways " Multiple windows, when created, are equal in size
  70. set splitbelow splitright
  71.  
  72. "Vertical split then hop to new buffer
  73. :noremap ,v :vsp^M^W^W<cr>
  74. :noremap ,h :split^M^W^W<cr>
  75.  
  76.  
  77. " Cursor highlights ***********************************************************
  78. "set cursorline
  79. "set cursorcolumn
  80.  
  81.  
  82. " Searching *******************************************************************
  83. set nohlsearch  " highlight search
  84. set incsearch  " incremental search, search as you type
  85. set ignorecase " Ignore case when searching
  86. set smartcase " Ignore case when searching lowercase
  87.  
  88.  
  89. " Colors **********************************************************************
  90. "set t_Co=256 " 256 colors
  91. set background=dark
  92. syntax on " syntax highlighting
  93. colorscheme vividchalk
  94.  
  95.  
  96. " Status Line *****************************************************************
  97. set showcmd
  98. set ruler " Show ruler
  99. "set ch=2 " Make command line two lines high
  100.  
  101.  
  102. " Line Wrapping ***************************************************************
  103. set nowrap
  104. set linebreak  " Wrap at word
  105.  
  106.  
  107. " Mappings ********************************************************************
  108. " Professor VIM says '87% of users prefer jj over esc', jj abrams disagrees
  109. imap jj <Esc>
  110. imap uu _
  111. imap hh =>
  112. imap aa @
  113.  
  114.  
  115. " Directories *****************************************************************
  116. " Setup backup location and enable
  117. "set backupdir=~/backup/vim
  118. "set backup
  119.  
  120. " Set Swap directory
  121. "set directory=~/backup/vim/swap
  122.  
  123. " Sets path to directory buffer was loaded from
  124. "autocmd BufEnter * lcd %:p:h
  125.  
  126.  
  127. " File Stuff ******************************************************************
  128. filetype plugin indent on
  129. " To show current filetype use: set filetype
  130.  
  131. "autocmd FileType html :set filetype=xhtml
  132.  
  133.  
  134. " Inser New Line **************************************************************
  135. map <S-Enter> O<ESC> " awesome, inserts new line without going into insert mode
  136. map <Enter> o<ESC>
  137. set fo-=r " do not insert a comment leader after an enter, (no work, fix!!)
  138.  
  139.  
  140. " Sessions ********************************************************************
  141. " Sets what is saved when you save a session
  142. set sessionoptions=blank,buffers,curdir,folds,help,resize,tabpages,winsize
  143.  
  144.  
  145. " Misc ************************************************************************
  146. set backspace=indent,eol,start
  147. " set number " Show line numbers
  148. set matchpairs+=<:>
  149. set vb t_vb= " Turn off bell, this could be more annoying, but I'm not sure how
  150. " laptop - blinking cursor no good, lah
  151. set guicursor+=a:blinkon0
  152.  
  153.  
  154. " Invisible characters *********************************************************
  155. set listchars=trail:.,tab:>-,eol:$
  156. set nolist
  157. :noremap ,i :set list!<CR> " Toggle invisible chars
  158.  
  159.  
  160. " Mouse ***********************************************************************
  161. "set mouse=a " Enable the mouse
  162. "behave xterm
  163. "set selectmode=mouse
  164.  
  165.  
  166. " Cursor Movement *************************************************************
  167. " Make cursor move by visual lines instead of file lines (when wrapping)
  168. map <up> gk
  169. map k gk
  170. imap <up> <C-o>gk
  171. map <down> gj
  172. map j gj
  173. imap <down> <C-o>gj
  174. map E ge
  175.  
  176.  
  177. " Ruby stuff ******************************************************************
  178. "compiler ruby         " Enable compiler support for ruby
  179. "map <F5> :!ruby %<CR>
  180.  
  181.  
  182. " Omni Completion *************************************************************
  183. autocmd FileType html :set omnifunc=htmlcomplete#CompleteTags
  184. autocmd FileType python set omnifunc=pythoncomplete#Complete
  185. autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
  186. autocmd FileType css set omnifunc=csscomplete#CompleteCSS
  187. autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
  188. autocmd FileType php set omnifunc=phpcomplete#CompletePHP
  189. autocmd FileType c set omnifunc=ccomplete#Complete
  190. " May require ruby compiled in
  191. autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
  192.  
  193.  
  194.  
  195. " -----------------------------------------------------------------------------  
  196. " |                              Plug-ins                                     |
  197. " -----------------------------------------------------------------------------  
  198.  
  199. " NERDTree ********************************************************************
  200. :noremap ,n :NERDTreeToggle<CR>
  201.  
  202. " User instead of Netrw when doing an edit /foobar
  203. let NERDTreeHijackNetrw=1
  204.  
  205. " Single click for everything
  206. let NERDTreeMouseMode=1
  207.  
  208.  
  209. " SnippetsEmu *****************************************************************
  210. "imap <unique> <C-j> <Plug>Jumper
  211. "let g:snip_start_tag = "_\."
  212. "let g:snip_end_tag = "\._"
  213. "let g:snip_elem_delim = ":"
  214. "let g:snip_set_textmate_cp = '1'  " Tab to expand snippets, not automatically.
  215.  
  216.  
  217. " fuzzyfinder_textmate ********************************************************
  218. map ,f :FuzzyFinderTextMate<CR>
  219. map ,b :FuzzyFinderBuffer<CR>
  220. "let g:fuzzy_ignore = '.o;.obj;.bak;.exe;.pyc;.pyo;.DS_Store;.db'
  221.  
  222. " autocomplpop ***************************************************************
  223. " complete option
  224. "set complete=.,w,b,u,t,k
  225. "let g:AutoComplPop_CompleteOption = '.,w,b,u,t,k'
  226. "set complete=.
  227. let g:AutoComplPop_IgnoreCaseOption = 0
  228. let g:AutoComplPop_BehaviorKeywordLength = 2
  229.  
  230.  
  231.  
  232. " -----------------------------------------------------------------------------  
  233. " |                             OS Specific                                   |
  234. " |                      (GUI stuff goes in gvimrc)                           |
  235. " -----------------------------------------------------------------------------  
  236.  
  237. " Mac *************************************************************************
  238. "if has("mac")
  239.   ""
  240. "endif
  241.  
  242. " Windows *********************************************************************
  243. "if has("gui_win32")
  244.   ""
  245. "endif
  246.  
  247.  
  248.  
  249. " -----------------------------------------------------------------------------  
  250. " |                               Startup                                     |
  251. " -----------------------------------------------------------------------------  
  252. " Open NERDTree on start
  253. "autocmd VimEnter * exe 'NERDTree' | wincmd l
  254.  
  255.  
  256.  
  257. " -----------------------------------------------------------------------------  
  258. " |                               Host specific                               |
  259. " -----------------------------------------------------------------------------  
  260. if filereadable(expand("~/.vimrc.local"))
  261.   source ~/.vimrc.local
  262. endif
  263.  
  264. "if hostname() == "foo"
  265.   " do something
  266. "endif