Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set nocompatible
- set ttyfast
- let mapleader = " "
- noremap ; :
- if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
- syntax on
- set hlsearch
- endif
- call plug#begin('~/.vim/bundle')
- " Statusline and colors
- Plug 'nanotech/jellybeans.vim'
- " Ruby && RoR
- Plug 'tpope/vim-rails'
- Plug 'tpope/vim-bundler'
- Plug 'tpope/vim-endwise'
- Plug 'vim-ruby/vim-ruby'
- Plug 'skalnik/vim-vroom'
- Plug 'thoughtbot/vim-rspec'
- " Elixir
- Plug 'elixir-lang/vim-elixir'
- Plug 'mattreduce/vim-mix'
- " JS
- Plug 'kchmck/vim-coffee-script'
- Plug 'pangloss/vim-javascript'
- Plug 'mxw/vim-jsx'
- " Editing utils
- Plug 'skwp/greplace.vim'
- Plug 'pbrisbin/vim-mkdir'
- Plug 'tpope/vim-surround'
- Plug 'tpope/vim-commentary'
- Plug 'junegunn/vim-easy-align'
- Plug 'scrooloose/syntastic'
- Plug 'tpope/vim-fugitive'
- " Fuzzy finder
- Plug 'ctrlpvim/ctrlp.vim'
- " Shell interaction
- Plug 'christoomey/vim-tmux-navigator'
- Plug 'tpope/vim-dispatch'
- Plug 'tpope/vim-eunuch'
- call plug#end()
- runtime! macros/matchit.vim
- filetype plugin indent on
- " use the silver searcher https://github.com/ggreer/the_silver_searcher
- if executable('ag')
- set grepprg=ag\ --nogroup\ --nocolor
- let g:ctrlp_user_command = 'ag %s -l --nocolor -U -g ""'
- let g:ctrlp_match_window = 'bottom,order:ttb'
- let g:ctrlp_use_caching = 0
- endif
- set nobackup
- set nowritebackup
- set noswapfile
- set backspace=2
- set history=50
- set ruler
- set ttimeout
- set ttimeoutlen=100
- :let @/ = ""
- set ignorecase
- set gdefault
- set smartcase
- set incsearch
- set laststatus=2
- set hidden
- set lazyredraw
- set clipboard=unnamed
- set autoread
- :set mouse=a
- set tabstop=2
- set shiftwidth=2
- set shiftround
- set expandtab
- set nofoldenable
- set fdm=marker
- set textwidth=80
- set colorcolumn=+1
- set number numberwidth=5
- set linespace=2
- set display+=lastline
- set list
- set listchars=tab:»·,trail:·,nbsp:·
- set splitbelow splitright
- set winheight=10
- set winminheight=10
- set winwidth=90
- set winheight=999
- set diffopt+=vertical
- set nocursorcolumn
- set nocursorline
- set formatoptions-=or
- set wildmenu
- set wildmode=list:longest,list:full
- set wildignore=*.swp,*.bak,*.pyc,*.class,*.jar,*.gif,*.png,*.jpg,
- \**/.git/*,**/.bundle/*,**/bin/*,**/.svn/*,**/tmp/*
- set pastetoggle=<F9>
- set t_Co=256
- set background=dark
- colorscheme jellybeans
- let g:javascript_enable_domhtmlcss = 1
- let g:jsx_ext_required = 0
- let g:mta_filetypes = {
- \ 'html' : 1,
- \ 'xhtml' : 1,
- \ 'xml' : 1,
- \ 'jinja' : 1,
- \ 'jsx' : 1,
- \ 'javascript' : 1,
- \ 'javascript.jsx' : 1,
- \ 'eruby' : 1,
- \}
- let g:vroom_use_colors = 1
- let g:vroom_map_keys = 0
- let g:vroom_clear_screen = 1
- let g:vroom_write_all = 1
- " Switch between the last two files
- nnoremap <leader><leader> <c-^>
- " Normal moving through long wrapped lines
- nnoremap <nowait> j gj
- nnoremap <nowait> k gk
- " Quicker window movement (exclude 'w' from mappings)
- nnoremap <C-j> <C-w>j
- nnoremap <C-k> <C-w>k
- nnoremap <C-h> <C-w>h
- nnoremap <C-l> <C-w>l
- " Get off my lawn
- nnoremap <Left> :echoe "Use h"<CR>
- nnoremap <Right> :echoe "Use l"<CR>
- nnoremap <Up> :echoe "Use k"<CR>
- nnoremap <Down> :echoe "Use j"<CR>
- " Don't need to escape chars when searching
- nnoremap / /\v
- vnoremap / /\v
- " Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
- vmap <Enter> <Plug>(EasyAlign)
- " Start interactive EasyAlign for a motion/text object (e.g. gaip)
- nmap ga <Plug>(EasyAlign)
- " Toggle NERDTree
- noremap <Leader>m :Lexplore<CR>
- " Rspec-vim mappings
- map <Leader>rc :call RunCurrentSpecFile()<CR>
- map <Leader>rs :call RunNearestSpec()<CR>
- map <Leader>rl :call RunLastSpec()<CR>
- " Vroom (minitest) mappings
- " map <Leader>mc :VroomRunTestFile<CR>
- " map <Leader>ms :VroomRunNearestTest<CR>
- " map <Leader>ml :VroomRunLastTest<CR>
- " Use leader + T for ctrlp
- nnoremap <Leader>t :CtrlP<CR>
- " remap vim conf file sourcing to <leader>so
- nnoremap <Leader>so :source ~/.vimrc<CR> :echom ".vimrc reloaded."<CR>
- " Clear last search highlights
- nnoremap <Leader><CR> :nohlsearch<CR>
- " Bind Q to q
- command! Q q
- " Move to beginning/end of the line
- nnoremap <Leader>B ^
- nnoremap <Leader>E $
- " Select all
- map <Leader>sa ggVG
- " Duplicate selected content - thanks to Joe Ferris
- vmap D y'>p
- " Autocomplete on <TAB>
- imap <Tab> <C-P>
- " automatically rebalance windows on vim resize
- autocmd VimResized * wincmd =
- " zoom a vim pane, <C-w>= to re-balance
- nnoremap <leader>- :wincmd _<cr>:wincmd \|<cr>
- nnoremap <leader>= :wincmd =<cr>
- " will insert tab at beginning of line and use completion if not at beginning
- function! InsertTabWrapper()
- let col = col('.') - 1
- if !col || getline('.')[col - 1] !~ '\k'
- return "\<tab>"
- else
- return "\<c-p>"
- endif
- endfunction
- inoremap <Tab> <c-r>=InsertTabWrapper()<cr>
- inoremap <S-Tab> <c-n>
- " Some Ruby settings - thanks to r00k
- augroup myfiletypes
- autocmd!
- " autoindent with two spaces and always expand tabs
- autocmd FileType ruby,eruby,yaml setlocal ai sw=2 sts=2 et
- autocmd FileType ruby,eruby,yaml setlocal path+=lib
- " make question marks part of words
- autocmd FileType ruby,eruby,yaml setlocal iskeyword+=?
- augroup END
- augroup vimrcEx
- autocmd!
- " When editing a file, always jump to the last known cursor position.
- " Don't do it for commit messages, when the position is invalid, or when
- " inside an event handler (happens when dropping a file on gvim).
- autocmd BufReadPost *
- \ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
- \ exe "normal g`\"" |
- \ endif
- " Set syntax highlighting for specific file types
- autocmd BufRead,BufNewFile Appraisals set filetype=ruby
- autocmd BufRead,BufNewFile *.md set filetype=markdown
- " Enable spellchecking for Markdown
- autocmd FileType markdown setlocal spell
- " Automatically wrap at 80 characters for Markdown
- autocmd BufRead,BufNewFile *.md setlocal textwidth=80
- " Automatically wrap at 72 characters and spell check git commit messages
- autocmd FileType gitcommit setlocal textwidth=72
- autocmd FileType gitcommit setlocal spell
- " Allow stylesheets to autocomplete hyphenated words
- autocmd FileType css,scss,sass setlocal iskeyword+=-
- " Save all buffs on focus lost
- autocmd BufLeave,FocusLost * silent! wall
- " strip whitespace on save
- autocmd BufWritePre * :%s/\s\+$//e
- augroup END
- function! RenameFile()
- let old_name = expand('%')
- let new_name = input('New file name: ', expand('%'), 'file')
- if new_name != '' && new_name != old_name
- exec ':saveas ' . new_name
- exec ':silent !rm ' . old_name
- redraw!
- endif
- endfunction
- map <Leader>rn :call RenameFile()<cr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement