Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.82 KB | None | 0 0
  1. set t_Co=256
  2. set nocompatible " be iMproved
  3. filetype off " required!
  4. set shell=/bin/bash
  5.  
  6. set rtp+=~/.vim/bundle/Vundle.vim
  7. set tags+=~/.ctags
  8. call vundle#begin()
  9.  
  10. " let Vundle manage Vundle
  11. " required!
  12. Plugin 'gmarik/Vundle.vim'
  13. Plugin 'digitaltoad/vim-jade'
  14. Plugin 'rodjek/vim-puppet'
  15. Plugin 'elzr/vim-json'
  16. Plugin 'scrooloose/syntastic'
  17. Plugin 'elixir-lang/vim-elixir'
  18. Plugin 'flazz/vim-colorschemes'
  19. Plugin 'scrooloose/nerdtree'
  20. Plugin 'tpope/vim-rails'
  21. Plugin 'tpope/vim-endwise'
  22. Plugin 'tpope/vim-rvm'
  23. Plugin 'tpope/vim-bundler'
  24. Plugin 'vim-ruby/vim-ruby'
  25. Plugin 'tpope/vim-haml'
  26. Plugin 'vim-scripts/YankRing.vim'
  27. Plugin 'Yggdroot/indentLine'
  28. Plugin 'geekjuice/vim-spec'
  29. Plugin 'derekwyatt/vim-scala'
  30. Plugin 'tpope/vim-fugitive'
  31. Plugin 'ervandew/supertab'
  32. Plugin 'zeis/vim-kolor'
  33. Plugin 'mileszs/ack.vim'
  34. Plugin 'Arkham/vim-quickfixdo'
  35. Plugin 'heartsentwined/vim-ember-script'
  36. Plugin 'shime/vim-livedown'
  37. Plugin 'AndrewRadev/splitjoin.vim'
  38. Plugin 'scrooloose/nerdcommenter'
  39. Plugin 'ntpeters/vim-better-whitespace'
  40. Plugin 'airblade/vim-gitgutter'
  41. Plugin 'godlygeek/tabular'
  42. Plugin 'ntpeters/vim-indent-guides'
  43. Plugin 'bling/vim-airline'
  44. Plugin 'bling/vim-bufferline'
  45. Plugin 'sheerun/vim-yardoc'
  46. Plugin 'ryanss/vim-hackernews'
  47. "gS and gJ
  48.  
  49. call vundle#end()
  50. filetype plugin indent on " required!
  51. "
  52. "" Brief help
  53. " :PluginList - list configured bundles
  54. " :PluginInstall(!) - install(update) bundles
  55. " " :PluginSearch(!) foo - search(or refresh cache first) for foo
  56. " :PluginClean(!) - confirm(or auto-approve) removal of unused bundles
  57. "
  58. " see :h vundle for more details or wiki for FAQ
  59. " NOTE: comments after Plugin command are not allowed..
  60.  
  61. syntax on
  62. colorscheme grb256
  63.  
  64. let g:indentLine_char = '┊'
  65. let g:indentLine_enabled = 1
  66. let g:indentLine_color_term = 239
  67. au VimEnter * ToggleStripWhitespaceOnSave
  68.  
  69. " Change the mapleader from \ to ,
  70. let mapleader=","
  71. let maplocalleader="\\"
  72.  
  73. " Editing behaviour {{{
  74. set showmode " always show what mode we're currently editing in
  75. set tabstop=2 " a tab is four spaces
  76. set softtabstop=2 " when hitting <BS>, pretend like a tab is removed, even if spaces
  77. set expandtab " expand tabs by default (overloadable per file type later)
  78. set shiftwidth=2 " number of spaces to use for autoindenting
  79. set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
  80. set backspace=indent,eol,start " allow backspacing over everything in insert mode
  81. set autoindent " always set autoindenting on
  82. set copyindent " copy the previous indentation on autoindenting
  83. set number " always show line numbers
  84. set showmatch " set show matching parenthesis
  85. set smartcase " ignore case if search pattern is all lowercase,
  86. " case-sensitive otherwise
  87. set smarttab " insert tabs on the start of a line according to
  88. " shiftwidth, not tabstop
  89. set scrolloff=4 " keep 4 lines off the edges of the screen when scrolling
  90. set virtualedit=all " allow the cursor to go in to "invalid" places
  91. set hlsearch " highlight search terms
  92. set incsearch " show search matches as you type
  93. set gdefault " search/replace "globally" (on a line) by default
  94. set listchars=tab:▸\ ,trail:·,extends:#,nbsp:·
  95.  
  96. set nolist " don't show invisible characters by default,
  97. " but it is enabled for some file types (see later)
  98. set pastetoggle=<F2> " when in insert mode, press <F2> to go to
  99. " paste mode, where you can paste mass data
  100. " that won't be autoindented
  101. set mouse=a " enable using the mouse if terminal emulator
  102. " supports it (xterm does)
  103. set fileformats="unix,dos,mac"
  104. set formatoptions+=1 " When wrapping paragraphs, don't end lines
  105. " with 1-letter words (looks stupid)
  106.  
  107. set nrformats= " make <C-a> and <C-x> play well with
  108. " zero-padded numbers (i.e. don't consider
  109. " them octal or hex)
  110.  
  111. " Toggle show/hide invisible chars
  112. nnoremap <leader>i :set list!<cr>
  113.  
  114. " Toggle line numbers
  115. nnoremap <leader>N :setlocal number!<cr>
  116.  
  117. " Editor layout {{{
  118. set termencoding=utf-8
  119. set encoding=utf-8
  120. set lazyredraw " don't update the display while executing macros
  121. " }}}
  122.  
  123. " Vim behaviour {{{
  124. set hidden " hide buffers instead of closing them this
  125. " means that the current buffer can be put
  126. " to background without being written; and
  127. " that marks and undo history are preserved
  128. set switchbuf=useopen " reveal already opened files from the
  129. " quickfix window instead of opening new
  130. " buffers
  131. set history=1000 " remember more commands and search history
  132. set undolevels=1000 " use many muchos levels of undo
  133. if v:version >= 730
  134. set undofile " keep a persistent backup file
  135. set undodir=~/.vim/.undo,~/tmp,/tmp
  136. endif
  137. set nobackup " do not keep backup files, it's 70's style cluttering
  138. set noswapfile " do not write annoying intermediate swap files,
  139. " who did ever restore from swap files anyway?
  140. set directory=~/.vim/.tmp,~/tmp,/tmp
  141. " store swap files in one of these directories
  142. " (in case swapfile is ever turned on)
  143. set viminfo='20,\"80 " read/write a .viminfo file, don't store more
  144. " than 80 lines of registers
  145. set wildmenu " make tab completion for files/buffers act like bash
  146. set wildmode=list:full " show a list when pressing tab and complete
  147. " first full match
  148. set wildignore=*.swp,*.bak,*.pyc,*.class
  149. set title " change the terminal's title
  150. set visualbell " don't beep
  151. set noerrorbells " don't beep
  152. set showcmd " show (partial) command in the last line of the screen
  153. " this also shows visual selection info
  154. set nomodeline " disable mode lines (security measure)
  155. "set ttyfast " always use a fast terminal
  156. " }}}
  157.  
  158. if &t_Co > 2 || has("gui_running")
  159. syntax on " switch syntax highlighting on, when the terminal has colors
  160. endif
  161. " }}}
  162.  
  163. " Enable shift movement for Mac OX X
  164. if has("gui_macvim")
  165. let macvim_hig_shift_movement = 1
  166. endif
  167.  
  168. " Shortcut mappings {{{
  169. " Since I never use the ; key anyway, this is a real optimization for almost
  170. " all Vim commands, as I don't have to press the Shift key to form chords to
  171. " enter ex mode.
  172. nnoremap ; :
  173. nnoremap <leader>; ;
  174.  
  175. " Avoid accidental hits of <F1> while aiming for <Esc>
  176. noremap! <F1> <Esc>
  177.  
  178. " Quickly close the current window
  179. nnoremap <leader>q :q<CR>
  180.  
  181. " Use Q for formatting the current paragraph (or visual selection)
  182. vnoremap Q gq
  183. nnoremap Q gqap
  184.  
  185. " make p in Visual mode replace the selected text with the yank register
  186. vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
  187.  
  188. " Shortcut to make
  189. nnoremap mk :make<CR>
  190.  
  191. " Swap implementations of ` and ' jump to markers
  192. " By default, ' jumps to the marked line, ` jumps to the marked line and
  193. " column, so swap them
  194. nnoremap ' `
  195. nnoremap ` '
  196.  
  197. " Run current file in ruby
  198. imap <Leader>rr <ESC>:!ruby %<CR>
  199. nmap <Leader>rr :!ruby %<CR>
  200.  
  201. " Use the damn hjkl keys
  202. noremap <up> <nop>
  203. noremap <down> <nop>
  204. noremap <left> <nop>
  205. noremap <right> <nop>
  206.  
  207. " Remap j and k to act as expected when used on long, wrapped, lines
  208. " nnoremap j gj
  209. " nnoremap k gk
  210.  
  211. " Easy window navigation
  212. noremap <C-h> <C-w>h
  213. noremap <C-j> <C-w>j
  214. noremap <C-k> <C-w>k
  215. noremap <C-l> <C-w>l
  216. nnoremap <leader>w <C-w>v<C-w>l
  217.  
  218. " RSpec mappings
  219. map <Leader>t :call RunCurrentSpecFile()<CR>
  220. map <Leader>s :call RunNearestSpec()<CR>
  221. map <Leader>l :call RunLastSpec()<CR>
  222. map <Leader>a :call RunAllSpecs()<CR>
  223.  
  224. " Complete whole filenames/lines with a quicker shortcut key in insert mode
  225. inoremap <C-f> <C-x><C-f>
  226. inoremap <C-l> <C-x><C-l>
  227.  
  228. " Use ,d (or ,dd or ,dj or 20,dd) to delete a line without adding it to the
  229. " yanked stack (also, in visual mode)
  230. nnoremap <silent> <leader>d "_d
  231. vnoremap <silent> <leader>d "_d
  232.  
  233. " Quick yanking to the end of the line
  234. nnoremap Y y$
  235.  
  236. " Yank/paste to the OS clipboard with ,y and ,p
  237. set clipboard=unnamed
  238. nnoremap <leader>y "+y
  239. nnoremap <leader>Y "+yy
  240. nnoremap <leader>p "+p
  241. nnoremap <leader>P "+P
  242.  
  243. " YankRing stuff
  244. let g:yankring_history_dir = '$HOME/.vim/.tmp'
  245. nnoremap <leader>r :YRShow<CR>
  246.  
  247. " Edit the vimrc file
  248. nnoremap <silent> <leader>ev :e $MYVIMRC<CR>
  249. nnoremap <silent> <leader>sv :so $MYVIMRC<CR>
  250.  
  251. " Clears the search register
  252. nnoremap <silent> <leader>/ :nohlsearch<CR>
  253.  
  254. " Pull word under cursor into LHS of a substitute (for quick search and
  255. " replace)
  256. nnoremap <leader>z :%s#\<<C-r>=expand("<cword>")<CR>\>#
  257.  
  258. " Quickly get out of insert mode without your fingers having to leave the
  259. " home row (either use 'jj' or 'jk')
  260. inoremap jj <Esc>
  261.  
  262. nnoremap <leader>q :q!
  263.  
  264. " Quick alignment of text
  265. nnoremap <leader>al :left<CR>
  266. nnoremap <leader>ar :right<CR>
  267. nnoremap <leader>ac :center<CR>
  268.  
  269. " Sudo to write
  270. cnoremap w!! w !sudo tee % >/dev/null
  271.  
  272. " Jump to matching pairs easily, with Tab
  273. nnoremap <Tab> %
  274. vnoremap <Tab> %
  275.  
  276. " Folding
  277. nnoremap <Space> za
  278. vnoremap <Space> za
  279.  
  280. " Ack for the word under cursor
  281. "nnoremap <leader>a :Ack<Space>
  282. nnoremap <leader>a :Ack<Space><c-r><c-W>
  283.  
  284. " Reselect text that was just pasted with ,v
  285. nnoremap <leader>v V`]
  286.  
  287. " NERDTree settings {{{
  288. " Put focus to the NERD Tree with F3 (tricked by quickly closing it and
  289. " immediately showing it again, since there is no :NERDTreeFocus command)
  290. " nnoremap <leader>n :NERDTreeClose<CR>:NERDTreeToggle<CR>
  291. map <Leader>n :NERDTreeToggle<CR>
  292. nnoremap <leader>m :NERDTreeClose<CR>:NERDTreeFind<CR>
  293. nnoremap <leader>N :NERDTreeClose<CR>
  294.  
  295. " Store the bookmarks file
  296. let NERDTreeBookmarksFile=expand("$HOME/.vim/NERDTreeBookmarks")
  297.  
  298. " Show the bookmarks table on startup
  299. let NERDTreeShowBookmarks=1
  300.  
  301. " Show hidden files, too
  302. let NERDTreeShowFiles=1
  303. let NERDTreeShowHidden=1
  304.  
  305. " Quit on opening files from the tree
  306. let NERDTreeQuitOnOpen=1
  307.  
  308. " Highlight the selected entry in the tree
  309. let NERDTreeHighlightCursorline=1
  310.  
  311. " Use a single click to fold/unfold directories and a double click to open
  312. " files
  313. let NERDTreeMouseMode=2
  314.  
  315. " Don't display these kinds of files
  316. let NERDTreeIgnore=[ '\.pyc$', '\.pyo$', '\.py\$class$', '\.obj$',
  317. \ '\.o$', '\.so$', '\.egg$', '^\.git$' ]
  318.  
  319.  
  320. " vim-flake8 default configuration
  321. let g:flake8_max_line_length=120
  322.  
  323. " Conflict markers {{{
  324. " highlight conflict markers
  325. match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
  326.  
  327. " shortcut to jump to next conflict marker
  328. nnoremap <silent> <leader>c /^\(<\\|=\\|>\)\{7\}\([^=].\+\)\?$<CR>
  329. " }}}
  330.  
  331. " should markdown preview get shown automatically upon opening markdown buffer
  332. let g:livedown_autorun = 0
  333.  
  334. " should the browser window pop-up upon previewing
  335. let g:livedown_open = 1
  336.  
  337. " the port on which Livedown server will run
  338. let g:livedown_port = 1337
  339.  
  340. map gm :call LivedownPreview()<CR>
  341.  
  342. let g:toggleTabs = 1
  343.  
  344. " Synatstic Settings
  345. set statusline+=%#warningmsg#
  346. set statusline+=%{SyntasticStatuslineFlag()}
  347. set statusline+=%*
  348.  
  349. let g:syntastic_always_populate_loc_list = 1
  350. let g:syntastic_auto_loc_list = 1
  351. let g:syntastic_check_on_open = 1
  352. let g:syntastic_check_on_wq = 0
  353.  
  354. let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] }
  355. nnoremap <C-w>E :SyntasticCheck<CR> :SyntasticToggleMode<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement