Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save orafaelfragoso/e6dff3dae6d5aec74df788949f307252 to your computer and use it in GitHub Desktop.
Save orafaelfragoso/e6dff3dae6d5aec74df788949f307252 to your computer and use it in GitHub Desktop.
Updated Vim File
""""""""""""""""
" VUNDLE BEGIN "
""""""""""""""""
set nocompatible " Disable vi-compatibility
filetype off
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'mhinz/vim-startify'
Plugin 'tpope/vim-surround'
Plugin 'kien/ctrlp.vim'
Plugin 'mattn/emmet-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
call vundle#end() " required
filetype plugin indent on " required
""""""""""""""
" VUNDLE END "
""""""""""""""
"""""""""""""""""""""""
" CTRLP CONFIGURATION "
"""""""""""""""""""""""
set wildignore+=/.git/,/.hg/,/.svn/
let g:ctrlp_custom_ignore = {
\ 'dir': 'node_modules\|DS_Store\|git\|bower_components',
\ 'file': '\v\.(exe|so|dll)$',
\ }
"""""""""""""""""""""""""""
" END CTRLP CONFIGURATION "
"""""""""""""""""""""""""""
set t_Co=256
syntax on
colorscheme onedark
set guifont=menlo:h16
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
set linespace=15
set showmode " always show what mode we're currently editing in
set nowrap " don't wrap lines
set tabstop=2 " a tab is four spaces
set smarttab
set tags=tags
set softtabstop=2 " when hitting <BS>, pretend like a tab is removed, even if spaces
set expandtab " expand tabs by default (overloadable per file type later)
set shiftwidth=2 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set number " always show line numbers
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
set timeout timeoutlen=200 ttimeoutlen=100
set visualbell " don't beep
set noerrorbells " don't beep
set autowrite "Save on buffer switch
set mouse=a
set paste
set noswapfile
" Aliases
" With a map leader it's possible to do extra key combinations
" like <leader>w saves the current file
let mapleader = ","
let g:mapleader = ","
" Fast saves
nmap <leader>w :w!<cr>
" Down is really the next line
nnoremap j gj
nnoremap k gk
"Easy escaping to normal model
imap jj <esc>
"Auto change directory to match current file ,cd
nnoremap ,cd :cd %:p:h<CR>:pwd<CR>
"easier window navigation
nmap <C-h> <C-w>h
nmap <C-j> <C-w>j
nmap <C-k> <C-w>k
nmap <C-l> <C-w>l
"Resize vsplit
nmap <C-v> :vertical resize +5<cr>
nmap 25 :vertical resize 40<cr>
nmap 50 <c-w>=
nmap 75 :vertical resize 120<cr>
nmap <C-b> :NERDTreeToggle<cr>
"Load the current buffer in Chrome
nmap ,c :!open -a Google\ Chrome<cr>
"Show (partial) command in the status line
set showcmd
" Create split below
nmap :sp :rightbelow sp<cr>
" Quickly go forward or backward to buffer
nmap :bp :BufSurfBack<cr>
nmap :bn :BufSurfForward<cr>
highlight Search cterm=underline
autocmd cursorhold * set nohlsearch
autocmd cursormoved * set hlsearch
" Remove search results
command! H let @/=""
" If you prefer the Omni-Completion tip window to close when a selection is
" made, these lines close it on movement in insert mode or when leaving
" insert mode
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Open splits
nmap vs :vsplit<cr>
nmap sp :split<cr>
" Create/edit file in the current directory
nmap :ed :edit %:p:h/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment