Skip to content

Instantly share code, notes, and snippets.

@YoonjaeYoo
Forked from lingceng/vimrc (not maintained)
Last active August 29, 2015 14:03
Show Gist options
  • Save YoonjaeYoo/b1a061d4938af631afa2 to your computer and use it in GitHub Desktop.
Save YoonjaeYoo/b1a061d4938af631afa2 to your computer and use it in GitHub Desktop.
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" My Bundles here:
" user CTRL-P to search
" F5 to refresh in search window
Plugin 'kien/ctrlp.vim'
"
" :find user
" :Rcontroller
" gs to go to definition
"
Plugin 'tpope/vim-rails.git'
Plugin 'KurtPreston/vim-autoformat-rails'
"
" code snips
"
Plugin 'snipMate'
"
" tree navigate
"
Plugin 'The-NERD-tree'
"
" coffeescript
"
Plugin 'vim-coffee-script'
"
" show git diff
"
Plugin 'airblade/vim-gitgutter'
" run code inline and on-the-fly
" nmap <leader>r Run entire file (doesn't have to be saved)
" vmap <leader>r Run current or selected line(s)
let mapleader = ","
Plugin 'hlissner/vim-forrestgump'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :BundleInstall - install configured plugins
" :PluginList - list configured plugins
" :PluginInstall(!) - install (update) plugins
" :PluginSearch(!) foo - search (or refresh cache first) for foo
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" if you use <tab> to indent the code
" vim use tabs other than spaces for the indentaion
" expandtab will turn a tab into 'tabstop' spaces
set expandtab
set tabstop=2
" if you use '>' or <c-t> to indent the code, this matters this default to 8
set shiftwidth=2
" you can also set different indent level for other languages
" autocmd FileType c setlocal shiftwidth=4 tabstop=4
autocmd BufWrite * :normal \==
" set tempfile swpfile path
set dir=~/.vim/dir
set backupdir=~/.vim/backupdir
" generate <% %> tag
inoremap <%<TAB> <% %><ESC>hhi
" auto complete tag
" inoremap to avoid recursively map
" <buffer> to avoid mismap between buffer
" au Filetype html,xml,xsl,eruby inoremap <buffer> ><TAB> ><ESC>bywf>a</<ESC>pa><ESC>F>a
inoremap ><TAB> ><ESC>bywf>a</<ESC>pa><ESC>F>a
" for ruby syntax of minitest
" i_CTRL-X_CTRL-U to trigger in ruby file
set completefunc=syntaxcomplete#Complete
" set autoindent
set autoindent
" set number
set number
" run current to end in shell
nmap ,e y$:!<c-r>"
" copy to clipboard
nmap ,y "+y$
" run current line in ruby
"nmap ,r yy:!ruby -we '<c-r>"'
" | is chain to run command
nmap ,r 0v$:w! ~/.vim/backupdir/ruby_snippet.rb \| !irb ~/.vim/backupdir/ruby_snippet.rb
" run selected content in ruby
"vmap ,r y:!ruby -we '<c-r>"'
vmap ,r :w! ~/.vim/backupdir/ruby_snippet.rb \| !irb ~/.vim/backupdir/ruby_snippet.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment