Skip to content

Instantly share code, notes, and snippets.

@phacks
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phacks/0ddb95bf2e1f67aa872f to your computer and use it in GitHub Desktop.
Save phacks/0ddb95bf2e1f67aa872f to your computer and use it in GitHub Desktop.
vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/PLUGINS\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible " be iMproved, required
filetype plugin on " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'tomasr/molokai'
Plugin 'altercation/vim-colors-solarized'
Plugin 'bling/vim-airline'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/nerdcommenter'
Plugin 'mattn/emmet-vim'
Plugin 'sjl/gundo.vim'
Plugin 'rking/ag.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'StanAngeloff/php.vim'
Plugin 'tpope/vim-fugitive'
" Plugin 'scrooloose/syntastic'
Plugin 'joonty/vdebug.git'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-repeat'
Plugin 'rodjek/vim-puppet'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'digitaltoad/vim-jade'
Plugin 'kchmck/vim-coffee-script'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/LOOK & FEEL\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
set background=dark
syntax enable " Enables syntax highlightning
set guifont=Menlo\ Regular " Sets the font to Menlo
" Color scheme set to Molokai
" colorscheme molokai
" let g:molokai_original = 1
" let g:rehash256 = 1
" Color scheme set to Solarized
let g:solarized_termcolors = 256
colorscheme solarized
highlight Comment cterm=italic
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/UI CONFIGURATION\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
set number " Enables lines number
set cursorline " A line indicates where the cursor is
set wildmenu " visual autocomplete for command menu
set showmatch "highlignt matching [{()}]
set scrolloff=3 " Keep 3 lines below and above the cursor
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/SEARCHING\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
set incsearch " Search as characters are entered
set hlsearch " Highlight matches
" Turn off search highlight
nnoremap <leader><leader> :nohlsearch<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/FOLDING\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
set foldenable " Enable folding
set foldlevelstart=10 " Open most folds by default
set foldnestmax=10 " 10 nested fold max
set foldmethod=syntax " Fold based on indent level
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/SPACES & TABS\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
set tabstop=2 " Number of visual spaces by tab
set shiftwidth=2 " Number of spaces in tab when autoindent
set softtabstop=2 " Number of spaces in tab when editing
set smarttab " Smart handling of the <TAB> key
set expandtab " Converts tabs to spaces
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/MOVEMENTS\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" Highlight last inserted text
nnoremap gV `[v`]
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/LEADER SHORTCUTS\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader="," " Leader is comma
" Toggle gundo
nnoremap <leader>u :GundoToggle<CR>
" Edit .vimrc
nnoremap <leader>ev :e ~/.vimrc<CR>
" Open ag.vim (plugin to search code in a project)
nnoremap <leader>a :Ag
" Launch a CtrlP search on files
nnoremap <leader>f :CtrlP<CR>
" Launch a CtrlP search on buffers
nnoremap <leader>y :CtrlPBuffer<CR>
" Launch NERDTree
nnoremap <leader>n :NERDTreeToggle<CR>
nnoremap <leader><space> :nohls<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/REMAPPINGS\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remap jj to exit Insert mode
inoremap jj <ESC>
" Brackets behave like in Sublime
inoremap {<CR> {<CR>}<C-o>O
" The sequence parens + brackets behaves nicely
inoremap ({<CR> ({<CR>});<C-o>O
" Allows to jump to tab with an Azerty keyboard
nmap <C-T> <C-]>
" Remaps K to split a line (opposite of J)
:nnoremap K i<CR><Esc>
" Remaps <leader>t to compile a latex document
nmap <leader>t :w\|:!make test<CR>
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/CTRLP\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" CtrlP settings
let g:ctrlp_match_window = 'bottom,order:ttb' " Order files top to bottom
let g:ctrlp_switch_buffer = 0 " Open files in new buffers
let g:ctrlp_working_path_mode = 0 " Enables the changing of the working dir
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""' " Use ag.vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/CURSOR BEHAVIOR UNDER iTerm 2\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" Change cursor shape between insert and normal mode in iTerm2.app
" tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/SYNTASTIC\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*
" let g:syntastic_always_populate_loc_list = 1
" let g:syntastic_auto_loc_list = 1
" let g:syntastic_check_on_open = 0
" let g:syntastic_check_on_wq = 0
" let g:syntastic_javascript_checkers = ['jshint']
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/MISCELLANEOUS\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" Don't underline between <a> tags when in HTML
hi link htmlLink NONE
let g:neocomplcache_enable_at_startup = 1
set laststatus=2
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:tmuxline_preset = 'nightly_fox'
let g:airline_powerline_fonts = 1
" Fix backspace behavior
set backspace=indent,eol,start
" .md files are recognized as Markdown
au BufRead,BufNewFile *.md set filetype=markdown
" .html.twig files are recognized as HTML Django templates
au BufRead,BufNewFile *.twig set filetype=htmldjango
" .pp files are recognized as Puppet
au BufRead,BufNewFile *.pp set filetype=puppet
" Vagrantfiles are recognized as Ruby files
au BufRead,BufNewFile Vagrantfile set filetype=ruby
" .jade files are recognized as Jade files
au BufRead,BufNewFile *.jade set filetype=jade
" .coffee files are recognized as coffeescript
au BufRead,BufNewFile *.coffee set filetype=coffee
" .cjsx files are recognized as coffeescript
au BufRead,BufNewFile *.cjsx set filetype=coffee
" Set listchars
set listchars=nbsp:¤,tab:>-,trail:¤,extends:>,precedes:<,eol:¶,trail:·
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" ___/NERDCommenter\___
"""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets an extra space in before comments
let NERDSpaceDelims=1
" Disable auto-comment, i.e. new line does not trigger the comment char sequence
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment