Created
March 20, 2017 21:46
-
-
Save lacostenycoder/779a78eb32ba7607440eb9bdaf4dfb81 to your computer and use it in GitHub Desktop.
Nice themed ruby rails vim setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved | |
" For vundle | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#rc() | |
call vundle#begin() | |
" Dependencies of snipmate | |
Bundle "MarcWeber/vim-addon-mw-utils" | |
Bundle "tomtom/tlib_vim" | |
Bundle "honza/vim-snippets" | |
" Git tools | |
Bundle 'tpope/vim-fugitive' | |
" Dependency managment | |
Bundle 'gmarik/vundle' | |
" Rails :/ | |
Bundle 'tpope/vim-rails.git' | |
" Snippets for our use :) | |
Bundle 'garbas/vim-snipmate' | |
" Commenting and uncommenting stuff | |
Bundle 'tomtom/tcomment_vim' | |
" Molokai theme | |
Bundle 'tomasr/molokai' | |
" Vim Ruby | |
Bundle 'vim-ruby/vim-ruby' | |
" Surround your code :) | |
Bundle 'tpope/vim-surround' | |
" Every one should have a pair (Autogenerate pairs for "{[( ) | |
Bundle 'jiangmiao/auto-pairs' | |
" Tab completions | |
Bundle 'ervandew/supertab' | |
" Fuzzy finder for vim (CTRL+P) | |
Bundle 'kien/ctrlp.vim' | |
" For tests | |
Bundle 'janko-m/vim-test' | |
" Navigation tree | |
Bundle 'scrooloose/nerdtree' | |
" Dispatching the test runner to tmux pane | |
Bundle 'tpope/vim-dispatch' | |
Bundle 'plasticboy/vim-markdown' | |
Bundle 'dkprice/vim-easygrep.git' | |
call vundle#end() | |
set tags=./tags; " Set tags directory | |
set autoindent " Auto indention should be on | |
filetype plugin indent on | |
" Ruby stuff: Thanks Ben :) | |
" ================ | |
syntax on " Enable syntax highlighting | |
filetype plugin indent on " Enable filetype-specific indenting and plugins | |
augroup myfiletypes | |
" Clear old autocmds in group | |
autocmd! | |
" autoindent with two spaces, always expand tabs | |
autocmd FileType ruby,eruby,yaml,markdown set ai sw=2 sts=2 et | |
augroup END | |
" ================ | |
" Syntax highlighting and theme | |
syntax enable | |
" Configs to make Molokai look great | |
set background=dark | |
let g:molokai_original=1 | |
let g:rehash256=1 | |
set t_Co=256 | |
colorscheme molokai | |
hi Normal ctermfg=252 ctermbg=Black | |
" colorscheme wintersday | |
" Show trailing whitespace and spaces before a tab: | |
:highlight ExtraWhitespace ctermbg=red guibg=red | |
:autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\\t/ | |
" Lovely linenumbers | |
set nu | |
" My leader key | |
let mapleader="," | |
" Searching | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
" Remove highlights with leader + enter | |
nmap <Leader><CR> :nohlsearch<cr> | |
" Buffer switching | |
map <leader>p :bp<CR> " \p previous buffer | |
map <leader>n :bn<CR> " \n next buffer | |
map <leader>d :bd<CR> " \d delete buffer | |
map <Leader>c :call <CR> | |
nmap <silent> <leader>c :TestFile<CR> | |
nmap <silent> <leader>s :TestNearest<CR> | |
map <leader>t :A<CR> " \t to jump to test file | |
map <leader>r :r<cr> " \t to jump to related file | |
set laststatus=2 | |
" Don't be a noob, join the no arrows key movement | |
"inoremap <Up> <NOP> | |
"inoremap <Down> <NOP> | |
"inoremap <Left> <NOP> | |
"inoremap <Right> <NOP> | |
"noremap <Up> <NOP> | |
"noremap <Down> <NOP> | |
"noremap <Left> <NOP> | |
"noremap <Right> <NOP> | |
" Removing escape | |
ino jj <esc> | |
cno jj <c-c> | |
vno v <esc> | |
" highlight the current line | |
set cursorline | |
" Highlight active column | |
set cuc cul" | |
" Tab completion | |
set wildmode=list:longest,list:full | |
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/* | |
"""""""""""""""""""""""""""""""""""""""" | |
" BACKUP / TMP FILES | |
"""""""""""""""""""""""""""""""""""""""" | |
if isdirectory($HOME . '/.vim/backup') == 0 | |
:silent !mkdir -p ~/.vim/backup >/dev/null 2>&1 | |
endif | |
set backupdir-=. | |
set backupdir+=. | |
set backupdir-=~/ | |
set backupdir^=~/.vim/backup/ | |
set backupdir^=./.vim-backup/ | |
set backup | |
" Save your swp files to a less annoying place than the current directory. | |
" " If you have .vim-swap in the current directory, it'll use that. | |
" " Otherwise it saves it to ~/.vim/swap, ~/tmp or . | |
if isdirectory($HOME . '/.vim/swap') == 0 | |
:silent !mkdir -p ~/.vim/swap >/dev/null 2>&1 | |
endif | |
set directory=./.vim-swap// | |
set directory+=~/.vim/swap// | |
set directory+=~/tmp// | |
set directory+=. | |
" viminfo stores the the state of your previous editing session | |
set viminfo+=n~/.vim/viminfo | |
if exists("+undofile") | |
" undofile - This allows you to use undos after exiting and restarting | |
" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo | |
" :help undo-persistence | |
" This is only present in 7.3+ | |
if isdirectory($HOME . '/.vim/undo') == 0 | |
:silent !mkdir -p ~/.vim/undo > /dev/null 2>&1 | |
endif | |
set undodir=./.vim-undo// | |
set undodir+=~/.vim/undo// | |
set undofile | |
endif | |
" Ruby hash syntax conversion | |
nnoremap <F12> :%s/:\([^ ]*\)\(\s*\)=>/\1:/g<return> | |
nmap <Leader><CR> :nohlsearch<cr> | |
map <leader>q :NERDTreeToggle<CR> | |
set clipboard=unnamed | |
if has('nvim') | |
let test#strategy = "neovim" | |
else | |
let test#strategy = "dispatch" | |
endif | |
" from original .vimrc | |
set hlsearch | |
set ruler | |
set laststatus=2 | |
nnoremap <C-L> :nohl<CR><C-L> | |
hi StatusLine ctermfg = darkblue | |
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
"vmap <C-c> y:call system("pbcopy", getreg("\""))<CR> | |
"nmap <C-v> :call setreg("\"",system("pbpaste"))<CR>p | |
set clipboard+=unnamed | |
runtime macros/matchit.vim | |
" Turn on the WiLd menu | |
set wildmenu | |
" Ignore compiled files | |
set wildignore=*.o,*~,*.pyc | |
" Ignore case when searching | |
set ignorecase | |
" When searching try to be smart about cases | |
set smartcase | |
" Makes search act like search in modern browsers | |
set incsearch | |
" more cool stuffs here https://amix.dk/vim/vimrc.html | |
let g:AutoPairsFlyMode = 1 | |
" set better split nav | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
" more natural split | |
set splitbelow | |
set splitright | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment