Created
September 25, 2014 16:28
-
-
Save montlebalm/b0de87c9b514b46f04dd to your computer and use it in GitHub Desktop.
Get it on. Vim till the break of dawn.
This file contains hidden or 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 | |
filetype off | |
filetype plugin indent off | |
" ----------------------------------------------------------------------------- | |
" Plugins | |
" ----------------------------------------------------------------------------- | |
" Set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/vundle.vim/ | |
call vundle#begin() | |
" Vundle | |
Plugin 'gmarik/vundle.vim' | |
" General | |
Plugin 'kien/ctrlp.vim.git' | |
Plugin 'Valloric/YouCompleteMe.git' | |
Plugin 'rking/ag.vim.git' | |
Plugin 'tomtom/tcomment_vim.git' | |
Plugin 'tpope/vim-repeat' | |
Plugin 'ervandew/supertab' | |
Plugin 'godlygeek/tabular' | |
" GUI | |
Plugin 'scrooloose/nerdtree.git' | |
Plugin 'scrooloose/syntastic.git' | |
Plugin 'airblade/vim-gitgutter.git' | |
Plugin 'bling/vim-airline.git' | |
Plugin 'jlanzarotta/bufexplorer.git' | |
Plugin 'nathanaelkane/vim-indent-guides.git' | |
Plugin 'chriskempson/base16-vim.git' | |
Plugin 'gorodinskiy/vim-coloresque.git' | |
" Markdown | |
Plugin 'plasticboy/vim-markdown.git' | |
" Styling | |
Plugin 'groenewege/vim-less.git' | |
Plugin 'hail2u/vim-css3-syntax.git' | |
Plugin 'cakebaker/scss-syntax.vim.git' | |
" JavaScript | |
Plugin 'briancollins/vim-jst.git' | |
Plugin 'pangloss/vim-javascript.git' | |
Plugin 'jelera/vim-javascript-syntax.git' | |
Plugin 'kchmck/vim-coffee-script.git' | |
Plugin 'elzr/vim-json.git' | |
Plugin 'moll/vim-node.git' | |
Plugin 'dsawardekar/ember.vim.git' | |
Plugin 'mxw/vim-jsx.git' | |
" HTML/Templating | |
Plugin 'amirh/HTML-AutoCloseTag.git' | |
Plugin 'tpope/vim-haml.git' | |
Plugin 'digitaltoad/vim-jade.git' | |
Plugin 'mustache/vim-mustache-handlebars.git' | |
Plugin 'vim-scripts/html-improved-indentation.git' | |
Plugin 'othree/html5.vim.git' | |
" Ruby | |
Plugin 'tpope/vim-rails.git' | |
Plugin 'vim-ruby/vim-ruby' | |
" Brief help | |
" :PluginList - list configured bundles | |
" :PluginInstall(!) - install (update) bundles | |
" :PluginSearch(!) foo - search (or refresh cache first) for foo | |
" :PluginClean(!) - confirm (or auto-approve) removal of unused bundles | |
call vundle#end() | |
" ----------------------------------------------------------------------------- | |
" Key Mappings | |
" ----------------------------------------------------------------------------- | |
" Remap for easier commands | |
nnoremap ; : | |
" Make j and k act normally for wrapped lines | |
nnoremap j gj | |
nnoremap k gk | |
" Window navigation | |
map <c-j> <c-w>j | |
map <c-k> <c-w>k | |
map <c-l> <c-w>l | |
map <c-h> <c-w>h | |
" Remap <leader> | |
let mapleader=' ' | |
nnoremap <space> <nop> | |
" Remap <esc> | |
imap jk <esc> | |
" Yank from the cursor to the end of the line, to be consistent with C and D. | |
nnoremap Y y$ | |
" Visual shifting (does not exit Visual mode) | |
vnoremap < <gv | |
vnoremap > >gv | |
" Allow using the repeat operator with a visual selection | |
vnoremap . :normal .<CR> | |
" Resize splits equally | |
map <leader>= <c-W>= | |
" Easier newlines | |
nmap <S-Enter> O<Esc> | |
nmap <CR> o<Esc> | |
" ----------------------------------------------------------------------------- | |
" General | |
" ----------------------------------------------------------------------------- | |
" Easier scrolling | |
set nostartofline | |
" Lower timeout after typing leader | |
set ttimeout | |
set ttimeoutlen=100 | |
" Abbrev. of messages (avoids 'hit enter') | |
set shortmess+=filmnrxoOtT | |
" History | |
set history=1000 | |
" Match brackets | |
set showmatch | |
" Better default splits | |
set splitbelow | |
set splitright | |
" Allow mouse | |
set mouse=a | |
set mousehide | |
" Set wrap width | |
set nowrap | |
set textwidth=0 | |
set wrapmargin=0 | |
" Disable beeps | |
set noerrorbells visualbell t_vb= | |
" OSX backspace fix | |
set backspace=indent,eol,start | |
set modelines=0 | |
fixdel | |
" Backup | |
set noswapfile | |
set backup | |
set backupdir=~/.vim/.backup | |
set directory=~/.vim/.tmp | |
" Better undos | |
if has('persistent_undo') | |
set undofile | |
set undodir=~/.vim/.undo | |
set undolevels=200 | |
set undoreload=200 | |
endif | |
" Tabs | |
set tabstop=2 | |
set softtabstop=2 | |
set shiftwidth=2 | |
set expandtab | |
set smarttab | |
set nojoinspaces | |
" Indention | |
set smartindent autoindent | |
" Searching | |
set ignorecase smartcase | |
set incsearch hlsearch | |
set gdefault | |
" Code folding | |
set nofoldenable | |
set foldmethod=indent | |
set foldnestmax=10 | |
" Better command-line completion | |
set wildmenu | |
set wildmode=list:longest | |
set wildignore=*.swp,*.bak,*.pyc,*.class | |
set complete-=i | |
" Better Unix / Windows compatibility | |
set viewoptions=folds,options,cursor,unix,slash | |
" Don't redraw when executing macros | |
set lazyredraw | |
" Highlight current line | |
set number | |
set cursorline | |
highlight clear SignColumn | |
highlight clear LineNrlet | |
" Increase how many lines are jumped when cursor goes offscreen | |
set scrolljump=5 | |
" Highlight problematic whitespace | |
set list | |
set listchars=tab:›\ ,trail:•,extends:>,nbsp:. | |
" Status bar | |
set laststatus=2 | |
set showmode | |
" Default encoding | |
set enc=utf-8 | |
" Easier h/l movement | |
set whichwrap=h,l,~,[,] | |
" ----------------------------------------------------------------------------- | |
" Vim CSS3 Syntax | |
" ----------------------------------------------------------------------------- | |
if has("autocmd") | |
autocmd! | |
autocmd FileType css setlocal iskeyword+=- | |
endif | |
" ----------------------------------------------------------------------------- | |
" Auto Commands | |
" ----------------------------------------------------------------------------- | |
if has("autocmd") | |
autocmd! | |
" Turn on spell check for certain filetypes automatically | |
autocmd BufRead,BufNewFile *.md,*.markdown setlocal spell spelllang=en_us | |
autocmd BufRead,BufNewFile *.txt setlocal spell spelllang=en_us | |
autocmd FileType gitcommit setlocal spell spelllang=en_us | |
" Autowrap text to 80 chars for certain filetypes | |
autocmd BufRead,BufNewFile *.md,*.markdown setlocal textwidth=80 | |
autocmd BufRead,BufNewFile *.txt setlocal textwidth=80 | |
autocmd FileType gitcommit setlocal textwidth=80 | |
endif | |
" ----------------------------------------------------------------------------- | |
" Sass | |
" ----------------------------------------------------------------------------- | |
au BufRead,BufNewFile *.scss set filetype=scss.css | |
" ----------------------------------------------------------------------------- | |
" Airline | |
" ----------------------------------------------------------------------------- | |
let g:airline_section_warning='' | |
let g:airline_powerline_fonts=1 | |
let g:airline_enable_branch=0 | |
let g:airline_enable_syntastic=0 | |
let g:airline_theme='solarized' | |
let g:airline#extensions#syntastic#enabled=0 | |
let g:airline_mode_map = { | |
\ '__' : '-', | |
\ 'n' : 'N', | |
\ 'i' : 'I', | |
\ 'R' : 'R', | |
\ 'c' : 'C', | |
\ 'v' : 'V', | |
\ 'V' : 'V', | |
\ '' : 'V', | |
\ 's' : 'S', | |
\ 'S' : 'S', | |
\ '' : 'S', | |
\ } | |
let g:airline_left_sep = '' | |
let g:airline_left_alt_sep = '' | |
let g:airline_right_sep = '' | |
let g:airline_right_alt_sep = '' | |
" ----------------------------------------------------------------------------- | |
" Vim-JavaScript | |
" ----------------------------------------------------------------------------- | |
let g:javascript_enable_domhtmlcss=1 | |
" ----------------------------------------------------------------------------- | |
" JsFmt | |
" ----------------------------------------------------------------------------- | |
" JavaScript formatting. | |
" Install https://github.com/rdio/jsfmt - npm install -g jsfmt | |
function! Jsformat() | |
let regel=line(".") | |
%!jsfmt --format=true | |
call cursor(regel, 1) | |
endfunction | |
autocmd BufRead,BufNewFile *.js setfiletype javascript | |
autocmd Filetype javascript command! Fmt call Jsformat() | |
" ----------------------------------------------------------------------------- | |
" CtrlP | |
" ----------------------------------------------------------------------------- | |
let g:ctrlp_map = '<c-p>' | |
let g:ctrlp_cmd = 'CtrlP' | |
let g:ctrlp_working_path_mode = 'ra' | |
" ----------------------------------------------------------------------------- | |
" Ag, The Silver Searcher | |
" ----------------------------------------------------------------------------- | |
" Better Ack shortcut | |
nnoremap <leader>f :Ag!<space>-i<space>-Q<space> | |
" ----------------------------------------------------------------------------- | |
" Syntastic | |
" ----------------------------------------------------------------------------- | |
let g:syntastic_javascript_checkers=['eslint', 'jsxhint'] | |
let g:syntastic_scss_checkers=['scss-lint'] | |
let g:syntastic_check_on_open=1 | |
let g:syntastic_quiet_messages={'level': 'warnings'} | |
let g:syntastic_enable_signs=1 | |
let g:syntastic_error_symbol='×' | |
let g:syntastic_warning_symbol='?' | |
"let g:syntastic_error_symbol='✗' | |
"let g:syntastic_warning_symbol='⚠' | |
let g:syntastic_html_tidy_ignore_errors=[ | |
\'proprietary attribute "ng-', | |
\'trimming empty' | |
\] | |
" ----------------------------------------------------------------------------- | |
" YouCompleteMe | |
" ----------------------------------------------------------------------------- | |
let g:ycm_collect_identifiers_from_comments_and_strings=1 | |
let g:acp_enableAtStartup=0 | |
let g:ycm_collect_identifiers_from_tags_files=1 | |
" Enable omni completion. | |
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS | |
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags | |
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS | |
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete | |
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags | |
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete | |
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc | |
" For snippet_complete marker. | |
set conceallevel=2 concealcursor=i | |
" ----------------------------------------------------------------------------- | |
" NERDTree | |
" ----------------------------------------------------------------------------- | |
let NERDTreeIgnore=['\.rbc$', '\~$', '\.dSYM$', '\.DS_Store'] | |
let NERDTreeMinimalUI=1 | |
let NERDTreeDirArrows=1 | |
let NERDTreeChDirMode=1 | |
let NERDTreeMouseMode=1 | |
let NERDTreeShowHidden=1 | |
map <leader>n :NERDTreeToggle<CR> | |
if has("autocmd") | |
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif | |
endif | |
if isdirectory(argv(0)) | |
bd | |
autocmd vimenter * exe "cd" argv(0) | |
autocmd VimEnter * NERDTree | |
endif | |
" ----------------------------------------------------------------------------- | |
" AutoCloseTag | |
" ----------------------------------------------------------------------------- | |
au FileType xhtml,xml ru ftplugin/html/autoclosetag.vim | |
nmap <Leader>ac <Plug>ToggleAutoCloseMappings | |
" ----------------------------------------------------------------------------- | |
" Indent Guides | |
" ----------------------------------------------------------------------------- | |
let g:indent_guides_start_level = 2 | |
let g:indent_guides_guide_size = 1 | |
let g:indent_guides_enable_on_vim_startup = 1 | |
" ----------------------------------------------------------------------------- | |
" Ctags | |
" ----------------------------------------------------------------------------- | |
set tags=./tags;/,~/.vimtags | |
" Make tags placed in .git/tags file available in all levels of a repository | |
let gitroot = substitute(system('git rev-parse --show-toplevel'), '[\n\r]', '', 'g') | |
if gitroot != '' | |
let &tags = &tags . ',' . gitroot . '/.git/tags' | |
endif | |
" ----------------------------------------------------------------------------- | |
" Footer | |
" ----------------------------------------------------------------------------- | |
filetype plugin indent on | |
syntax on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment