Skip to content

Instantly share code, notes, and snippets.

@a-morales
Created January 27, 2014 17:09
Show Gist options
  • Save a-morales/8652817 to your computer and use it in GitHub Desktop.
Save a-morales/8652817 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
Bundle 'gmaric/vundle'
"Vim bundles"
Bundle 'airblade/vim-gitgutter'
Bundle 'derekwyatt/vim-scala'
Bundle 'garbas/vim-snipmate'
Bundle 'sjl/gundo.vim'
Bundle 'honza/vim-snippets'
Bundle 'kien/ctrlp.vim'
Bundle 'MarcWeber/vim-addon-mw-utils'
Bundle 'mhinz/vim-startify'
Bundle 'Raimondi/delimitMate'
Bundle 'scrooloose/syntastic'
Bundle 'kchmck/vim-coffee-script'
Bundle 'scrooloose/nerdtree'
Bundle 'tomtom/tlib_vim'
Bundle 'tpope/vim-commentary'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'Yggdroot/indentLine'
filetype plugin indent on
""""""""""""""""""""""""""
""""My customizations"""""
""""""""""""""""""""""""""
"Setting leader
let mapleader=','
let maplocalleader=','
""""""""""""""""""""""""""
"""""""""Settings"""""""""
""""""""""""""""""""""""""
set list listchars=tab:→\ ,trail:·,extends:❯,precedes:❮
set backspace=indent,eol,start
set showmatch
set smarttab
set nrformats-=octal
set shiftround
set incsearch
set ttimeout
set ttimeoutlen=50
set scrolloff=3
set sidescrolloff=5
set display+=lastline
set encoding=utf-8
set shell=/bin/zsh
set autoread
set fileformats+=mac
set history=1000
set t_Co=256
set complete-=i
set laststatus=2
set ruler
set showcmd
set wildmenu
set expandtab
set shiftwidth=2
set softtabstop=2
set number
set hlsearch
set autoindent
set smartindent
set cursorline
set ttyfast
set colorcolumn=+1
set splitright
set splitbelow
set hidden
set cmdwinheight=4
if !empty(&viminfo)
set viminfo^=!
endif
"load matchit.vim, if a newer version hasn't been installed
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
set backup " enable backups
set noswapfile " it's 2013, Vim.
set undodir=~/.vim/tmp/undo// " undo files
set backupdir=~/.vim/tmp/backup// " backups
set directory=~/.vim/tmp/swap// " swap files
" Make those folders automatically if they don't already exist.
if !isdirectory(expand(&undodir))
call mkdir(expand(&undodir), "p")
endif
if !isdirectory(expand(&backupdir))
call mkdir(expand(&backupdir), "p")
endif
if !isdirectory(expand(&directory))
call mkdir(expand(&directory), "p")
endif
""""""""""""""""""""""""""
""""""Auto Commands"""""""
""""""""""""""""""""""""""
au VimResized * :wincmd =
"only show cursorline in current window in normal mode
augroup cline
au!
au WinLeave,InsertEnter * set nocursorline
au WinEnter,InsertLeave * set cursorline
augroup END
au! bufwritepost .vimrc source $MYVIMRC
""""""""""""""""""""""""""
""""Themes and Colors"""""
""""""""""""""""""""""""""
syntax enable "enable syntax colors"
set background=dark "enable dark colorscheme for background"
highlight ColorColumn ctermbg=darkred "set color of column limit"
""""""""""""""""""""""""""
""""Keyboard Shortcuts""""
""""""""""""""""""""""""""
"remaping ; and :
nnoremap ; :
nnoremap : ;
"navigate between windows with Ctrl-<h,j,k,l>
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
"disable the arrow keys
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
"go to matching brace
nnoremap <tab> %
vnoremap <tab> %
"allows vertical movements one row at a time instead of one line at a time
nnoremap j gj
nnoremap k gk
"my brain on vim
nnoremap <f9> mzggg?G'z
inoremap <f9> <esc>mzggg?G'zi
""""""""""""""""""""""""""
"""leader Key Settings""""
""""""""""""""""""""""""""
"clear highlighted words from search
nnoremap <leader><space> :noh<cr>
"shortcuts to open edit window on current file path
cnoremap %% <C-R>=fnameescape(expand('%:h')).'/'<cr>
map <leader>ew ;e %%
map <leader>es ;sp %%
map <leader>ev ;vsp %%
map <leader>et ;tabe %%
"show window for commands and searches
map <leader>; q: "bring up command window"
map <leader>/ q/ "bring up window for forward history search"
map <leader>? q? "bring up window for backward hsitory search"
map <leader>r ;windo redraw!<cr>
map <leader>H Hzz
map <leader>L Lzz
map <leader>G ;GundoToggle<cr>
map <leader>n ;NERDTreeToggle<cr>
""""""""""""""""""""""""""
"""""Plugin Settings""""""
""""""""""""""""""""""""""
"delimitMate options"
let delimitMate_expand_cr = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment