Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
321 lines (254 sloc) 10 KB
set nocompatible
filetype off
call plug#begin('~/.vim/plugged')
" Colorschemes
Plug 'GertjanReynaert/cobalt2-vim-theme'
Plug 'vim-airline/vim-airline-themes'
Plug 'altercation/vim-colors-solarized'
Plug 'mhartington/oceanic-next'
" Syntax and colorschemes
Plug 'tpope/vim-git', { 'for': 'git' }
Plug 'cakebaker/scss-syntax.vim', { 'for': 'scss' }
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
Plug 'othree/javascript-libraries-syntax.vim', { 'for': 'js' }
" Completion
" Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets' " For ultrasnip
" Syntastic: Code linting errors
Plug 'scrooloose/syntastic', { 'for': ['php', 'python', 'javascript', 'css', 'scss'] }
" Pairs of handy bracket mappings
Plug 'tpope/vim-unimpaired'
" Editor
Plug 'bling/vim-airline'
Plug 'editorconfig/editorconfig-vim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'airblade/vim-gitgutter'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'scrooloose/nerdtree'
Plug 'jiangmiao/auto-pairs'
" Searching
Plug 'dyng/ctrlsf.vim'
" Vastly improved Javascript indentation and syntax support in Vim
Plug 'pangloss/vim-javascript'
" Rename files from within vim
Plug 'tpope/vim-eunuch'
call plug#end()
" Disabled commands to help with RSI
nmap $ 0
syntax enable
set t_Co=256
set background=dark
colorscheme solarized
filetype plugin indent on
set history=700 " Sets how many lines of history VIM has to remember
set autoread " Set to auto read when a file is changed from the outside
let mapleader = ","
let g:mapleader = ","
" Fast saving + switching
nmap <leader>w :w!<cr>
nnoremap <leader>q :bp<cr>:bd #<cr>
nmap <leader>x :qa!<cr>
noremap <Leader><Leader> <C-^> " Fast buffer switch
set timeoutlen=300 ttimeoutlen=50 " Fast mode switching
if has('gui')
set guifont=Inconsolata-dz\ for\ Powerline:h16
set go-=T " No toolbar
set columns=180 " Larger window by default
set lines=50
set mousehide " Hide cursor whilst typing
if has('gui_macvim')
set transparency=0
" Press Ctrl-Tab to switch between open tabs (like browser tabs) to
" the right side. Ctrl-Shift-Tab goes the other way.
noremap <C-Tab> :tabnext<CR>
noremap <C-S-Tab> :tabprev<CR>
" Switch to specific tab numbers with Command-number
noremap <D-1> :tabn 1<CR>
noremap <D-2> :tabn 2<CR>
noremap <D-3> :tabn 3<CR>
noremap <D-4> :tabn 4<CR>
noremap <D-5> :tabn 5<CR>
noremap <D-6> :tabn 6<CR>
noremap <D-7> :tabn 7<CR>
noremap <D-8> :tabn 8<CR>
noremap <D-9> :tabn 9<CR>
" Command-0 goes to the last tab
noremap <D-0> :tablast<CR>
set so=7 " Set 7 lines to the cursor - when moving vertically using j/k
set wildmenu " Turn on the WiLd menu, better command completion
set wildignore=*.o,*~,*.pyc " Ignore compiled files
set wildignore+=**/node_modules
set wildignore+=**/bower_components
set wildmode=longest,list,full
set ruler " Always show current position
set cmdheight=1 " Height of the command bar
set laststatus=2 " Always show the status line
set hid " A buffer becomes hidden when it is abandoned
set backspace=eol,start,indent " Configure backspace so it acts as it should act
set whichwrap+=<,>,h,l
set ignorecase " Ignore case when searching
set smartcase " When searching try to be smart about cases
set hlsearch " Highlight search results
set incsearch " Makes search act like search in modern browsers
set lazyredraw " Don't redraw while executing macros (good performance config)
set magic " For regular expressions turn magic on
set showmatch " Show matching brackets when text indicator is over them
set mat=2 " How many tenths of a second to blink when matching brackets
set fillchars+=vert:\ " Window split styling
set cursorline
set scrolloff=5
autocmd WinLeave * setlocal nocursorline
autocmd WinEnter * setlocal cursorline
set ffs=unix,dos,mac " Use Unix as the standard file type
" Want utf8 at all times
set termencoding=utf-8
set encoding=utf-8
set fileencoding=utf-8
set nobackup " Turn backup off, since most stuff is in SVN, git et.c anyway...
set nowb
set noswapfile
if exists('+undofile')
set undofile
set undodir=~/.vim/.cache/undo
set expandtab " Use spaces instead of tabs
set smarttab " Be smart when using tabs ;)
set shiftwidth=2 " Setup default ts
set tabstop=2 " Tabs are this many spaces
set softtabstop=2
set bs=2
set clipboard=unnamed " Use the system clipboard to do our stuff, proper integration
set lbr " Linebreak on 500 characters
set tw=500
set ai " Auto indent
set si " Smart indent
set wrap " Wrap lines
set mouse=nicr " Remove ME
set mousehide
set relativenumber
set number " line numbers
set list
set listchars=tab:│\ ,trail:•,extends:❯,precedes:
set linebreak
let &showbreak=''
set iskeyword-=_ " Word breaks around underscores
set scrolljump=3 "minimum number of lines to scroll
set ttyfast
set viewoptions=folds,options,cursor,unix,slash "unix/windows compatibility
" => Moving around, tabs, windows and buffers
" Retain visual selection after identing
vnoremap < <gv
vnoremap > >gv
" Treat long lines as break lines (useful when moving around in them)
map j gj
map k gk
" Home row jump to start and end of line
noremap H ^
noremap L $
" Remap VIM 0 to first non-blank character
map 0 ^
" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
map <space> /
map <c-space> ?
" Disable highlight when <leader><cr> is pressed
map <silent> <leader><cr> :noh<cr>
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Unmap arrow keys
noremap <Left> :bprev <CR>
noremap <Right> :bnext<CR>
" Specify the behavior when switching between buffers
set switchbuf=useopen,usetab,newtab
set stal=2
" => Status line
set laststatus=2 " Always show the status line
" => Editing mappings
" Remap VIM 0 to first non-blank character
map 0 ^
" => Spell checking
" Pressing ,ss will toggle and untoggle spell checking
map <leader>ss :setlocal spell!<cr>
" TODO: Revise paste options
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<cr>
" Paste toggles
nnoremap <F7> :set invpaste paste?<Enter>
imap <F7> <C-O><F7>
set pastetoggle=<F7> " Hit f7 before pasting into terminal
" => File Browsing
let g:NERDTreeWinSize = 24
let g:NERDTreeMinimalUI = 1
let NERDTreeIgnore=['\~$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr', '\.pyc$', 'node_modules', 'bower_components']
:nmap ,e :NERDTreeToggle<CR>
highlight Pmenu ctermbg=238 gui=bold
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$|\node_modules|\bower_components'
let g:ctrlp_working_path_mode = 'ra' " search for nearest ancestor like .git, .hg, and the directory of the current file
let g:ctrlp_match_window_bottom = 1 " show the match window at the top of the screen
let g:ctrlp_max_height = 8 " maxiumum height of match window
let g:ctrlp_switch_buffer = 'et' " jump to a file if it's open already
let g:ctrlp_use_caching = 1 " enable caching
let g:ctrlp_clear_cache_on_exit=0 " speed up by not removing clearing cache evertime
let g:ctrlp_show_hidden = 1 " show me dotfiles
let g:ctrlp_mruf_max = 250 " number of recently opened files
" Searching
let g:ctrlsf_winsize = '50%'
let g:ctrlsf_default_root = 'project'
nmap <C-F>f <Plug>CtrlSFPrompt
vmap <C-F>f <Plug>CtrlSFVwordPath
vmap <C-F>F <Plug>CtrlSFVwordExec
nmap <C-F>n <Plug>CtrlSFCwordPath
nmap <C-F>p <Plug>CtrlSFPwordPath
nnoremap <C-F>o :CtrlSFOpen<CR>
nnoremap <C-F>t :CtrlSFToggle<CR>
inoremap <C-F>t <Esc>:CtrlSFToggle<CR>
nmap <C-F>l <Plug>CtrlSFQuickfixPrompt
vmap <C-F>l <Plug>CtrlSFQuickfixVwordPath
vmap <C-F>L <Plug>CtrlSFQuickfixVwordExec
" => Syntastic
let g:syntastic_check_on_open=1
let g:syntastic_javascript_checkers = ['jshint']
let g:syntastic_java_javac_config_file_enabled = 1
let g:syntastic_always_populate_loc_list=0
let g:syntastic_html_tidy_ignore_errors=[" proprietary attribute \"ng-", " is not recognized!"]
let g:syntastic_auto_loc_list = 0
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_enable_signs = 1
map <leader>x :Errors<CR>
" => Airline
let g:bufferline_echo=0
let g:airline_powerline_fonts = 0 " Powerline symbols
let g:airline_theme='papercolor'
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#syntastic#enabled = 1
" => Autocompletion
let g:used_javascript_libs = 'angularjs,jasmine,underscore'
" Markdown
let g:vim_markdown_folding_disabled = 1