Last active
May 19, 2017 15:53
-
-
Save ericat/2e81347bc1984c9bc608 to your computer and use it in GitHub Desktop.
vim configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be improved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" Plugins | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'digitaltoad/vim-jade' | |
Plugin 'bling/vim-airline' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'tpope/vim-surround' | |
Plugin 'tpope/vim-commentary' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'rking/ag.vim' | |
Plugin 'terryma/vim-multiple-cursors' | |
Plugin 'scrooloose/syntastic' | |
Plugin 'alvan/vim-closetag' | |
Plugin 'mxw/vim-jsx' | |
Plugin 'OrangeT/vim-csharp' | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'editorconfig/editorconfig-vim' | |
call vundle#end() " required | |
filetype plugin indent on " required | |
syntax enable | |
syntax on | |
set encoding=utf-8 | |
colorscheme molokai | |
imap jk <ESC> | |
let mapleader=" " | |
let g:ackprg = 'ag --vimgrep' | |
let g:NERDTreeWinPos = "left" | |
let NERDTreeShowHidden=1 | |
" filenames like *.xml, *.html, *.xhtml, ... | |
let g:closetag_filenames = "*.html,*.xhtml,*.phtml" | |
" Resize panes when vim is resized | |
au VimResized * exe "normal! \<c-w>=" | |
" ---- Generic settings ------- | |
set mouse=a "Enable mouse | |
set path+=**/src/main/**,** " Press gf within quotes in require('') to open that file | |
set suffixesadd+=.js | |
set noswapfile | |
set nobackup " Disable backups | |
set ttyfast " Set faster rendering | |
set list listchars=tab:\·\ ,trail:· " Mark whitespace with character | |
set laststatus=2 " Always display statusline | |
set fillchars+=stl:\ ,stlnc:\ | |
set statusline+=%F " Add path to statusline | |
set statusline+=%#warningmsg# | |
set statusline+=%{SyntasticStatuslineFlag()} | |
set statusline+=%* | |
set clipboard=unnamed | |
set t_ut= " Disable deleted colouring | |
set t_Co=256 " Force 256 colour mode | |
set t_vb= " Turn off bell | |
" ----- Indentation and formatting | |
au FileType gitcommit set tw=72 " Wrapping long commit messages | |
set nowrap " No wrapping for lines longer than window | |
set shiftwidth=2 " Smarttab values | |
set shiftround " Round indent to multiple of shiftwidth | |
set smarttab " <tab> depends on value of shiftwidth | |
set tabstop=2 " Number of spaces <tab> will count for | |
set softtabstop=2 " Number of spaces <tab> counts while editing | |
set expandtab " Use <space>s rather than <tab> | |
set autoindent " Use current line indentation when copying | |
set scrolloff=3 " Minimum lines before/after curso | |
set linebreak " Don't split on words | |
set hidden " Dont complain about buffers | |
set number " Show line number | |
set ruler " Show ruler | |
set splitbelow " Set vertical splits to below | |
set splitright " Set horizontal splits to the right | |
set backspace=indent,eol,start "Backspace was not working anymore | |
autocmd BufWritePre *.js :%s/\s\+$//e "Remove trailing whitespace on save | |
autocmd BufNewFile,BufRead *.pcss set syntax=css | |
set cursorline " Highlight line | |
set autoread " Reload files if they have changed | |
set ttyfast " Set faster rendering | |
set gdefault " Perform global substitutions by default | |
set autowrite | |
set autowriteall | |
" ----- Comfort commands ---- | |
command! -bar -bang Q quit<bang> | |
command! W w | |
command! WQ wq | |
command! Wq wq | |
command! Q q | |
" Insert blank line above/below | |
nmap T O<ESC>j | |
nmap t o<ESC>k | |
" ----- Search settings ------- | |
set wildignore+=node_modules/*,public/css/*,public/lib/**/*,public/js/*,coverage/** | |
set showmatch " Show matching brace briefly | |
set hlsearch " Highlight all matches | |
set incsearch " Show pattern while typing | |
set ignorecase " Ignore the case of normal letters | |
set smartcase " Override ignorecase when searching with uppercase patterns | |
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
set fileformat=unix | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\.git$\|public$|log\|tmp\|target$\|coverage\|node_modules$', | |
\ 'file': '\.so$\|\.dat$|\.DS_Store$|\.log$|\.tar.gz$|.zip$|.swp$|\.lock$' | |
\ } | |
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp' | |
if executable('ag') | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
endif | |
" Highlight the current line | |
hi CursorLine cterm=NONE ctermbg=241 | |
" ----- Theme and style settings ---- | |
augroup CursorLine " CursorLine function highlights line in active pane | |
au! | |
au VimEnter,WinEnter,BufWinEnter * setlocal cursorline | |
au WinLeave * setlocal nocursorline | |
augroup END | |
" NERDTree configuration | |
let g:NERDTreeHijackNetrw=0 " Prohibit NERDTree from spawning new panes | |
nnoremap <C-t> :NERDTreeToggle<CR> | |
vnoremap . :norm.<CR> | |
" ----- Moving between iTerm pane ---- | |
nnoremap <C-h> <C-w>h | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-k> <C-w>k | |
nnoremap <C-l> <C-w>l | |
vnoremap <C-c> "*y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment