Skip to content

Instantly share code, notes, and snippets.

@timc3
Last active December 6, 2015 10:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timc3/ee2f78480a3da1419662 to your computer and use it in GitHub Desktop.
Save timc3/ee2f78480a3da1419662 to your computer and use it in GitHub Desktop.
"NeoBundle Scripts-----------------------------
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" Add or remove your Bundles here:
NeoBundle 'Shougo/neosnippet.vim'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'tpope/vim-fugitive'
NeoBundle 'ctrlpvim/ctrlp.vim'
NeoBundle 'flazz/vim-colorschemes'
NeoBundle 'bingaman/vim-sparkup'
NeoBundle 'groenewege/vim-less.git'
NeoBundle 'groenewege/vim-less.git'
NeoBundle 'scrooloose/syntastic'
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'Shougo/neocomplcache'
NeoBundle 'Shougo/neosnippet'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'honza/vim-snippets'
NeoBundle 'nvie/vim-flake8'
" You can specify revision/branch/tag.
NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' }
" Required:
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
"End NeoBundle Scripts-------------------------
"
"
" Check Python files for PEP8
autocmd BufWritePost *.py call Flake8()
" History is 1000 lines
set history=1000
" Set tabs at 4 spaces
set tabstop=4
set shiftwidth=4
set softtabstop=4
" use spaces instead of tabs
set expandtab
set autoindent
set smartindent
set smarttab
" Set the leader character to something sensible
let mapleader = ","
let g:mapleader = ","
" Enable filetype plugins
filetype plugin on
filetype indent on
filetype on
syntax on
" Ignore these files
set wildignore=*.swp,*.bak,*.pyc,*.so,*.swp,*.zip
let NERDTreeIgnore = ['\.pyc$']
" Set to auto read when a file is changed from the outside
set autoread
" Stop scanning allsorts of files:
set complete-=i
" Set 7 lines to the cursor - when moving vertically using j/k so there is
" always something above or below
set so=7
" Set the numbers always on
set nu
" Always show the rules
set ruler
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" Use visualbell instead of the nasty sound
set visualbell
set textwidth=0
set wrapmargin=0
set tw=0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Misc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<cr>
" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
set viminfo^=%
set foldmethod=indent
set foldlevelstart=20
"""""""""""""""""""""""""""""""""""""""""""""""""""
" Files
"""""""""""""""""""""""""""""""""""""""""""""""""""
" Swap files create in temporary directories instead of the local directory
" set backup
" set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" set backupskip=/tmp/*,/private/tmp/*
" set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
" set writebackup
set noswapfile
set nobackup
au BufNewFile,BufRead *.less set filetype=less
au BufNewFile,BufRead *.js set filetype=javascript.javascript-jquery
au BufNewFile,BufRead *.jsonp set filetype=json
au BufNewFile,BufRead *.html set filetype=htmldjango.html.javascript.javascript-jquery
au BufNewFile,BufRead *.py set filetype=python.django
au BufRead,BufNewFile *.go set filetype=go
autocmd FileType go autocmd BufWritePre <buffer>
autocmd FileType python set omnifunc=pythoncomplete#Complete
" No wrapping for python
autocmd FileType python setlocal nowrap
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
" Coffeescript and Javascript I want at 2 space indentation
autocmd FileType javascript setlocal softtabstop=2 shiftwidth=2 tabstop=4
autocmd FileType json setlocal softtabstop=2 shiftwidth=2 tabstop=4
autocmd FileType jsonp setlocal softtabstop=2 shiftwidth=2 tabstop=4
autocmd FileType coffee setlocal softtabstop=2 shiftwidth=2 tabstop=4
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType less setlocal softtabstop=2 shiftwidth=2 tabstop=4
autocmd FileType html,markdown,ctp set omnifunc=htmlcomplete#CompleteTags
autocmd FileType rst setlocal spell spelllang=en_gb
let g:syntastic_python_checkers = ['pyflakes']
let g:syntastic_pythondjango_checkers = ['pyflakes']
" NERDTree setup
" Fix the width of NERDTree.
" Map NERDTreeToggle to convenient key
let g:NERDTreeWinSize = 48
nmap <leader>n :NERDTreeToggle<cr>
let g:ctrlp_max_files=20000
let g:ctrlp_max_height=25
"
"Note: This option must set it in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
let g:neocomplcache_enable_smart_case = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
" Plugin key-mappings.
imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)
" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: "\<TAB>"
" For snippet_complete marker.
if has('conceal')
set conceallevel=2 concealcursor=i
endif
" Enable snipMate compatibility feature.
let g:neosnippet#enable_snipmate_compatibility = 1
" Tell Neosnippet about the other snippets
let g:neosnippet#snippets_directory='~/.vim/bundle/vim-snippets/snippets'
" Set 256 Colors:
set t_Co=256
" Use ESLint for JavaScript - only checks for local eslintrc though..
:if !empty(glob("~/.eslintrc"))
: let g:syntastic_javascript_checkers = ['eslint']
:endif
let g:syntastic_javascript_checkers=['jscs']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment