Skip to content

Instantly share code, notes, and snippets.

@henriquemenezes
Last active August 11, 2020 14:47
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save henriquemenezes/31a477c9ffe2aa5ef5c7 to your computer and use it in GitHub Desktop.
.vimrc
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim " set the runtime path to include Vundle
call vundle#begin() " and initialize
" Keep Plugin commands between vundle#begin/end.
Plugin 'VundleVim/Vundle.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'tomasr/molokai'
Plugin 'tpope/vim-rails'
Plugin 'fatih/vim-go'
Plugin 'moll/vim-bbye'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'vim-scripts/grep.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" Encoding
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8
" Fix backspace problem
set backspace=indent,eol,start
" Tabs. May be overriten by autocmd rules
set tabstop=4 " tab spaces
set softtabstop=0
set shiftwidth=4 " shift spaces
set expandtab
" Map leader to ,
let mapleader=','
" Enable Syntax Highlighting
syntax enable
colorscheme molokai
let g:molokai_original = 1
" show line numbers
set number
set relativenumber
set ruler
set cursorline
" Vim multiple cursors
let g:multi_cursor_use_default_mapping=0
let g:multi_cursor_start_word_key = '<C-d>'
let g:multi_cursor_select_all_word_key = '<A-d>'
let g:multi_cursor_start_key = 'g<C-d>'
let g:multi_cursor_select_all_key = 'g<A-d>'
let g:multi_cursor_next_key = '<C-d>'
let g:multi_cursor_prev_key = '<C-p>'
let g:multi_cursor_skip_key = '<C-x>'
let g:multi_cursor_quit_key = '<Esc>'
" NERDTree
nnoremap <silent> <C-n> :NERDTreeToggle<CR>
nnoremap <leader>F :NERDTreeFind<CR>
" Airline
let g:airline#extensions#tabline#enabled = 1 " enable airline extension
let g:airline_powerline_fonts = 1 " integrate with powerline fonts
let g:airline#extensions#tabline#formatter = 'unique_tail' " short filename in tab bar
" Automatically change the current directory
autocmd BufEnter * silent! lcd %:p:h
" Enable hiden buffers
set hidden
" File type
if has("autocmd")
autocmd BufNewFile,BufReadPost *.as set filetype=actionscript
autocmd BufNewFile,BufReadPost *.mxml set filetype=mxml
autocmd BufNewFile,BufReadPost *.jsfl set filetype=javascript
autocmd BufNewFile,BufReadPost *.json set filetype=json
autocmd BufNewFile,BufReadPost *.less set filetype=less
autocmd BufNewFile,BufReadPost *.sass set filetype=sass
autocmd BufNewFile,BufReadPost *.scss set filetype=scss
autocmd BufNewFile,BufReadPost *.coffee set filetype=coffee
autocmd BufNewFile,BufReadPost *.ts set filetype=typescript
autocmd BufNewFile,BufReadPost *.jad set filetype=java
endif
" File indent
" sw - Set shiftwidth - Indent shifts by # spaces
" sts - Set softtabstop - Indent tabs by # spaces
" ts - Set tabstop - Indent tabs by # spaces
" et - Set expandtab - Use spaces instead of tabs
" si - Set smartindent - File type based indentation
if has("autocmd")
filetype plugin on
filetype indent on
autocmd FileType apache setlocal sw=4 sts=4 ts=4 et si
autocmd FileType actionscript setlocal sw=4 sts=4 ts=4 et si
autocmd FileType c setlocal sw=4 sts=4 ts=4 et si
autocmd FileType cpp setlocal sw=4 sts=4 ts=4 et si
autocmd FileType coffee setlocal sw=2 sts=2 ts=2 et si
autocmd FileType cs setlocal sw=4 sts=4 ts=4 et si
autocmd FileType css setlocal sw=2 sts=2 ts=2 et si
autocmd FileType diff setlocal sw=4 sts=4 ts=4 et si
autocmd FileType html setlocal sw=4 sts=4 ts=4 et si
autocmd FileType java setlocal sw=4 sts=4 ts=4 noet si
autocmd FileType javascript setlocal sw=2 sts=2 ts=2 et si
autocmd FileType json setlocal sw=2 sts=2 ts=2 et si
autocmd FileType less setlocal sw=2 sts=2 ts=2 et si
autocmd FileType lua setlocal sw=2 sts=2 ts=2 et si
autocmd FileType mxml setlocal sw=4 sts=4 ts=4 et si
autocmd FileType perl setlocal sw=4 sts=4 ts=4 et si
autocmd FileType php setlocal sw=4 sts=4 ts=4 et si
autocmd FileType python setlocal sw=4 sts=4 ts=4 et si
autocmd FileType ruby setlocal sw=2 sts=2 ts=2 et si
autocmd FileType haml setlocal sw=2 sts=2 ts=2 et si
autocmd FileType sass setlocal sw=2 sts=2 ts=2 et si
autocmd FileType scss setlocal sw=2 sts=2 ts=2 et si
autocmd FileType sh setlocal sw=2 sts=2 ts=2 et si
autocmd FileType sql setlocal sw=4 sts=4 ts=4 et si
autocmd FileType typescript setlocal sw=4 sts=4 ts=4 et si
autocmd FileType vb setlocal sw=4 sts=4 ts=4 et si
autocmd FileType vim setlocal sw=2 sts=2 ts=2 et si
autocmd FileType wsh setlocal sw=4 sts=4 ts=4 et si
autocmd FileType xhtml setlocal sw=4 sts=4 ts=4 et si
autocmd FileType xml setlocal sw=4 sts=4 ts=4 et si
autocmd FileType yaml setlocal sw=2 sts=2 ts=2 et si
autocmd FileType zsh setlocal sw=2 sts=2 ts=2 et si
autocmd FileType scala setlocal sw=4 sts=4 ts=4 noet si
endif
" Copy, Paste and Cut
vnoremap <C-c> "+y
vnoremap <C-x> "+d
inoremap <C-v> <ESC>"+pa
vnoremap YY "+y
vnoremap XX "+x
noremap <leader>p "+gP
" Buffers
nnoremap <leader>q :Bdelete<CR>
nnoremap <Tab> :bn<CR>
nnoremap <S-Tab> :bp<CR>
" Tabs
nnoremap [t gT
nnoremap ]t gt
" grep.vim
nnoremap <leader>f :Rgrep<CR>
let Grep_Default_Options = '-IR'
let Grep_Skip_Files = '*.log *.db'
let Grep_Skip_Dirs = '.git node_modules'
" Ignore files and directories for ctrlp
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
let g:ctrlp_custom_ignore = '\v[\/](node_modules|bower_components|target|dist|build)|(\.(swp|ico|git|hg|svn))$'

Install powerline fonts

# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

In .vimrc enable powerline fonts:

let g:airline_powerline_fonts = 1

iTerm2 Setup

iTerm2 > Preferences > Profiles > Text:

  • Check Use a different font for non-ASCII text
  • Change Font for Font and Non-ASCII FONT to 14pt Incosolata for Powerline or 12pt Meslo LG S for Powerline

zsh theme

Change zsh theme to agnoster and set

  • Optionally set DEFAULT_USER to your regular username followed by prompt_context(){} in ~/.zshrc to hide the "user@hostname" info when you’re logged in as yourself on your local machine.
ZSH_THEME="agnoster"
export DEFAULT_USER=$USER
prompt_context(){}

iTerm2 > Preferences > Profiles > Colors > Colors Presets:

  • Select Solarized Dark

Install vim plugins

Set up Vundle:

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Install Plugins:

Launch vim and run :PluginInstall

To install from command line: vim +PluginInstall +qall

Reference

@luizpaulogodoy
Copy link

" Search Highlighting
set hlsearch
set incsearch
set ignorecase
set smartcase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment