Guest User

.vimrc

a guest
Feb 11th, 2013
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.68 KB | None | 0 0
  1. "Some of this from: http://stevelosh.com/blog/2010/09/coming-home-to-vim/
  2.  
  3. filetype off
  4. call pathogen#runtime_append_all_bundles()
  5. filetype plugin indent on
  6.  
  7. set nocompatible
  8.  
  9. set modelines=0
  10.  
  11. "Set tabstops to 4 spaces
  12. "set smartindent
  13. set tabstop=4
  14. set shiftwidth=4
  15. set softtabstop=4
  16. set expandtab
  17.  
  18. set encoding=utf-8
  19. set scrolloff=3
  20. set autoindent
  21. set showmode
  22. set showcmd
  23. set hidden
  24. set wildmenu
  25. set wildmode=list:longest
  26. set visualbell
  27. set cursorline
  28. set ttyfast
  29. set ruler
  30. set backspace=indent,eol,start
  31. set laststatus=2
  32. set relativenumber
  33. set undofile
  34.  
  35. let mapleader = ","
  36.  
  37. "nnoremap / /\v
  38. "vnoremap / /\v
  39. set ignorecase
  40. set smartcase
  41. set gdefault
  42. set incsearch
  43. set showmatch
  44. set hlsearch
  45. nnoremap <leader><space> :noh<cr>
  46. nnoremap <tab> %
  47. vnoremap <tab> %
  48.  
  49. set wrap
  50. set textwidth=79
  51. set formatoptions=qrn1
  52. set colorcolumn=85
  53.  
  54. " Shortcut to rapidly toggle `set list`
  55. "http://vimcasts.org/episodes/show-invisibles/
  56. nmap <leader>l :set list!<CR>
  57. set list
  58. "set listchars=tab:▸\ ,eol:¬
  59. set listchars=tab:▸\
  60.  
  61. inoremap <F1> <ESC>
  62. nnoremap <F1> <ESC>
  63. vnoremap <F1> <ESC>
  64.  
  65. "so i don't have to shift to enter colon
  66. nnoremap ; :
  67.  
  68. "When window focus lost, save everything
  69. au FocusLost * :wa
  70.  
  71. "Leader customizations
  72.  
  73. ",W : strip trailing whitespace
  74. nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
  75.  
  76. "Use Ack (I downloaded to plugin directory). grep replacement
  77. nnoremap <leader>a :Ack
  78.  
  79. "in insert mode, two js in a row will get you back to normal mode.
  80. inoremap jj <ESC>
  81.  
  82. "Make splitting windows not so clunky
  83. nnoremap <leader>w <C-w>v<C-w>l
  84. nnoremap <C-h> <C-w>h
  85. nnoremap <C-j> <C-w>j
  86. nnoremap <C-k> <C-w>k
  87. nnoremap <C-l> <C-w>l
  88.  
  89. "Color schemes
  90. "-----------------------------------------------------------------------
  91. syntax enable
  92. "colorscheme midnightclouds
  93. "colorscheme molokai
  94.  
  95. "if has('gui_running')
  96. "set background=light
  97. "else
  98. "set background=dark
  99. "endif
  100. "colorscheme solarized
  101. "-----------------------------------------------------------------------
  102.  
  103.  
  104. "Keys for yankring
  105. nnoremap <silent> <F4> :YRShow<cr>
  106. inoremap <silent> <F4> <ESC>:YRShow<cr>
  107. nnoremap <leader>Y :YRToggle<cr>
  108.  
  109.  
  110. "NERDTree shortcut
  111. nmap <leader>fe :NERDTree<cr>
  112.  
  113. "Leader map for Rainbow parentheses
  114. nnoremap <leader>R :RainbowParenthesesToggle<CR>
  115.  
  116. "Change horizontal splits to vertical
  117. nnoremap <leader>V <C-W>t<C-W>H<CR>
  118.  
  119. "Quickly open a scratch buffer in vertical split
  120. nnoremap <leader>S :Sscratch<CR><C-W>t<C-W>H<CR>
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. " When splitting window, open below or on right
  128. set splitbelow
  129. set splitright
  130.  
  131. "Set to default to have line numbers
  132. "set number
  133.  
  134. "Access system clipboard for OSX
  135. set clipboard=unnamed
  136.  
  137. " Turn off beeping/bell
  138. set vb
  139.  
  140. " Good settings found at:
  141. " http://www.slackorama.com/projects/vim/vimrc.html
  142.  
  143.  
  144. " select when using the mouse
  145. set selectmode=mouse
  146.  
  147. " allow backspacing over everything in insert mode
  148. "set backspace=indent,eol,start
  149.  
  150. "Command region height
  151. set cmdheight=2
  152.  
  153. " do not keep a backup files
  154. set nobackup
  155. set nowritebackup
  156.  
  157. " show the cursor position all the time
  158. "set ruler
  159.  
  160. " do incremental searches (annoying but handy);
  161. "set incsearch
  162.  
  163. " Show tab characters. Visual Whitespace.
  164. "set list
  165. "set listchars=tab:>.
  166.  
  167. " Set ignorecase on
  168. "set ignorecase
  169.  
  170. " smart search (override 'ic' when pattern has uppers)
  171. "set scs
  172.  
  173. " Set 'g' substitute flag on
  174. "set gdefault
  175.  
  176. " Set status line
  177. set statusline=[%02n]\ %f\ %(\[%M%R%H]%)%=\ %4l,%02c%2V\ %P%*
  178.  
  179. " Always display a status line at the bottom of the window
  180. set laststatus=2
  181.  
  182. " pressing < or > will let you indent/unident selected lines
  183. vnoremap < <gv
  184. vnoremap > >gv
  185.  
  186. " Make tab in v mode work like I think it should (keep highlighting):
  187. "vmap <tab> >gv
  188. "vmap <s-tab> <gv
  189.  
  190. " Map <c-s> to write current buffer.
  191. map <c-s> :w<cr>
  192. imap <c-s> <c-o><c-s>
  193. imap <c-s> <esc><c-s>
  194.  
  195. " Buffer naviation
  196. map <M-Left> :bprevious<CR>
  197. map <M-Right> :bnext<CR>
  198.  
  199.  
  200. " Select all.
  201. map <c-a> ggVG
  202.  
  203. " Undo in insert mode.
  204. imap <c-z> <c-o>u
  205.  
  206. "switch to directory of current file
  207. command! CD cd %:p:h
  208.  
  209.  
  210. "Bindings
  211. "--------
  212. map <F2> :set wrap!<CR>
  213. "From http://stackoverflow.com/questions/953398/how-to-execute-file-im-editing-in-vim/
  214. nmap <F3> :w<CR>:silent !chmod +x %:p<CR>:silent !%:p 2>&1 \| tee ~/.vim/output<CR>:10split ~/.vim/output<CR>:redraw!<CR>
  215.  
  216.  
  217. " http://superuser.com/questions/35389/in-vim-how-do-i-make-the-left-and-right-arrow-keys-change-line
  218. " Arrow keys to go over newlines...
  219. set whichwrap+=<,>,[,]
  220.  
  221. " http://stackoverflow.com/questions/102384/using-vims-tabs-like-buffers
  222. "set hidden
Advertisement
Add Comment
Please, Sign In to add comment