#!/usr/bin/env bash set +x apt-get install -y powerline #vim-airline vim-airline-themes sed -i -e 's/"syntax on/syntax on/' /etc/vim/vimrc sed -i -e 's/"set background=dark/set background=dark/' /etc/vim/vimrc # Macros # Format json cat > $HOME/.vimrc << 'EOF' " Format json nmap =j :%!python -m json.tool EOF # vimrc additions cat > $HOME/.vimrc << 'EOF' " enable syntax highlighting syntax enable " enable mouse set mouse=a set encoding=utf-8 " Show file options above the command line set wildmenu " Don't offer to open certain files/directories set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png,*.ico set wildignore+=*.pdf,*.psd set wildignore+=node_modules/*,bower_components/* " `gf` opens file under cursor in a new vertical split nnoremap gf :vertical wincmd f" " Display tabs at the beginning of a line in Python mode as bad. au BufRead,BufNewFile *.py,*.pyw match BadWhitespace /^\t\+/ " Make trailing whitespace be flagged as bad. au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/ " Use the below highlight group when displaying bad whitespace is desired. highlight BadWhitespace ctermbg=red guibg=red " add the proper PEP8 indentation au BufNewFile,BufRead *.py \ set tabstop=4 \ set softtabstop=4 \ set shiftwidth=4 \ set textwidth=79 \ set expandtab \ set autoindent \ set fileformat=unix " show a visual line under the cursor's current line set cursorline " show the matching part of the pair for [] {} and () set showmatch " enable all Python syntax highlighting features let python_highlight_all = 1 syntax on " Shortcut to rapidly toggle `set list` nmap l :set list! " Use the same symbols as TextMate for tabstops and EOLs set listchars=tab:▸\ ,eol:¬ " tmux will only forward escape sequences to the terminal if surrounded by a DCS sequence " http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinkbdoZ8eNR1X2UobLTeww1jFrvfJxTMfKSq-L%2B%40mail.gmail.com&forum_name=tmux-users if exists('$TMUX') let &t_SI = "\Ptmux;\\]50;CursorShape=1\x7\\\" let &t_EI = "\Ptmux;\\]50;CursorShape=0\x7\\\" else let &t_SI = "\]50;CursorShape=1\x7" let &t_EI = "\]50;CursorShape=0\x7" endif EOF # Xresources-hybrid-reduced-contrast cat > $HOME/.Xresources << 'EOF' ! Hybrid Terminal Colours. Uses the palette from Tomorrow-Night: ! https://github.com/chriskempson/tomorrow-theme/blob/master/vim/colors/Tomorrow-Night.vim ! and the reduced contrast background color from Codecademy's online editor: ! https://www.codecademy.com/learn ! vim: ft=xdefaults *background: #232C31 *foreground: #C5C8C6 ! black *color0: #2D3C46 *color8: #425059 ! red *color1: #A54242 *color9: #CC6666 ! green *color2: #8C9440 *color10: #B5BD68 ! yellow *color3: #DE935F *color11: #F0C674 ! blue *color4: #5F819D *color12: #81A2BE ! magenta *color5: #85678F *color13: #B294BB ! cyan *color6: #5E8D87 *color14: #8ABEB7 ! white *color7: #6C7A80 *color15: #C5C8C6 EOF cd $HOME || exit apt-get install -y git git clone https://github.com/VundleVim/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim # Prepend to the .vimrc rm $HOME/.vimrc_pending touch $HOME/.vimrc_pending cat > $HOME/.vimrc_pending << 'EOF' set nocompatible " be iMproved, required filetype off " required set clipboard=unnamed set relativenumber set number " set the runtime path to include Vundle and initialize set rtp+=$HOME/.vim/bundle/Vundle.vim call vundle#begin() " alternatively, pass a path where Vundle should install plugins "call vundle#begin('$HOME/some/path/here') " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' " plugin on GitHub repos Plugin 'joonty/vdebug' Plugin 'tpope/vim-fugitive' Plugin 'jreybert/vimagit' Plugin 'wincent/command-t' Plugin 'tmhedberg/SimpylFold' Plugin 'vim-scripts/indentpython.vim' "Plugin 'Valloric/YouCompleteMe' Plugin 'davidhalter/jedi-vim' Plugin 'nvie/vim-flake8' Plugin 'jnurmine/Zenburn' Plugin 'w0ng/vim-hybrid' Plugin 'altercation/vim-colors-solarized' "Plugin 'kien/ctrlp.vim' Plugin 'ctrlpvim/ctrlp.vim' "Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} Plugin 'vim-airline/vim-airline' Plugin 'vim-airline/vim-airline-themes' Plugin 'ryanoasis/vim-devicons' Plugin 'will133/vim-dirdiff' Plugin 'jiangmiao/auto-pairs' Plugin 'mhinz/vim-startify' "Plugin 'mhinz/vim-signify' Plugin 'airblade/vim-gitgutter' Plugin 'edkolev/tmuxline.vim' Plugin 'terryma/vim-multiple-cursors' Plugin 'sudar/vim-arduino-syntax' Plugin 'ekalinin/Dockerfile.vim' Plugin 'mattboehm/vim-unstack' Plugin 'tmux-plugins/vim-tmux' " vim-snipmate Plugin 'MarcWeber/vim-addon-mw-utils' Plugin 'tomtom/tlib_vim' Plugin 'garbas/vim-snipmate' " Optional: Plugin 'honza/vim-snippets' " requires tmux.conf setting: set -g focus-events on or tmux-plugins/tmux-sensible plugin. Plugin 'tmux-plugins/vim-tmux-focus-events' " text objects - https://github.com/kana/vim-textobj-user/wiki Plugin 'kana/vim-textobj-user' Plugin 'bps/vim-textobj-python' " toggleable panels Plugin 'tpope/vim-vinegar' Plugin 'vim-scripts/taglist.vim' Plugin 'majutsushi/tagbar' Plugin 'scrooloose/nerdtree' Plugin 'jistr/vim-nerdtree-tabs' Plugin 'severin-lemaignan/vim-minimap' let g:minimap_highlight='Visual' let NERDTreeQuitOnOpen=1 map :NERDTreeToggle silent! nmap :NERDTreeToggle silent! map :NERDTreeFind let g:NERDTreeMapActivateNode="" let g:NERDTreeMapPreview="" Plugin 'saltstack/salt-vim' Plugin 'plasticboy/vim-markdown' Plugin 'fatih/vim-go' " Python Plugin 'hynek/vim-python-pep8-indent' Plugin 'jmcantrell/vim-virtualenv' Plugin 'fisadev/vim-isort' " Automatically sort python imports " Python mode (indentation, doc, refactor, lints, code checking, motion and " operators, highlighting, run and ipdb breakpoints) Plugin 'python-mode/python-mode' Plugin 'vim-syntastic/syntastic' Plugin 'preservim/nerdcommenter' Plugin 'sbdchd/neoformat' Plugin 'luochen1990/rainbow' let g:rainbow_active = 1 "0 if you want to enable it later via :RainbowToggle " FZF set rtp+=~/.fzf Plugin 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required filetype plugin on . "--------------------------------------- " Syntastic " show list of errors and warnings on the current file nmap e :Errors " turn to next or previous errors, after open errors list nmap n :lnext nmap p :lprevious set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* " check also when just opened the file let g:syntastic_check_on_open = 1 let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_enable_signs = 1 " syntastic checker for javascript. " eslint is the only tool support JSX. " If you don't need write JSX, you can use jshint. " And eslint is slow, but not a hindrance let g:syntastic_javascript_checkers = ['jshint'] " let g:syntastic_javascript_checkers = ['eslint'] " syntastic checker for python. " let g:syntastic_python_checkers = ["pylint"] " let g:syntastic_python_checkers = ["flake8"] let g:syntastic_python_checkers = ['prospector'] " don't put icons on the sign column (it hides the vcs status icons of signify) let g:syntastic_enable_signs = 1 " custom icons (enable them if you use a patched font, and enable the previous " setting) let g:syntastic_error_symbol = '✗' let g:syntastic_warning_symbol = '⚠' let g:syntastic_style_error_symbol = '✗' let g:syntastic_style_warning_symbol = '⚠' "---------------------------------------- if has('gui_running') set background=dark silent! colorscheme hybrid else let g:hybrid_custom_term_colors = 1 let g:hybrid_reduced_contrast = 1 " Remove this line if using the default palette. silent! colorscheme hybrid endif silent! call togglebg#map("") " Airline customizations let g:airline#extensions#tabline#enabled = 1 " Nerdcommenter customizations " Add spaces after comment delimiters by default let g:NERDSpaceDelims = 1 " Use compact syntax for prettified multi-line comments let g:NERDCompactSexyComs = 1 " Align line-wise comment delimiters flush left instead of following code indentation let g:NERDDefaultAlign = 'left' " Set a language to use its alternate delimiters by default let g:NERDAltDelims_java = 1 " Add your own custom formats or override the defaults let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } } " Allow commenting and inverting empty lines (useful when commenting a region) let g:NERDCommentEmptyLines = 1 " Enable trimming of trailing whitespace when uncommenting let g:NERDTrimTrailingWhitespace = 1 " Nerdtree customizations " hide .pyc files let NERDTreeIgnore=['\.pyc$', '\~$'] " Nerdtree toggle keymap nmap \ :NERDTreeToggle " Nerdtree find keymap nnoremap :NERDTreeFind:vertical " YouCompleteMe customizations " close autocomplete window "let g:ycm_autoclose_preview_window_after_completion=1 "map g :YcmCompleter GoToDefinitionElseDeclaration " Python docstrings for folded code. let g:SimplyFold_docstring_preview=1 " Flag unnecessary whitespace au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/lib " toggle between all lines folded and no lines folded. :nnoremap &foldlevel ? 'zM' :'zR' EOF cat $HOME/.vimrc_pending # append the existing vimrc to the plugin additions cat $HOME/.vimrc >> $HOME/.vimrc_pending # copy it back to the vimrc cp $HOME/.vimrc_pending $HOME/.vimrc #mv $HOME/.vimrc_pending $HOME/.vimrc cat $HOME/.vimrc vim +PluginInstall +qall # Install YouCompleteMe support apt-get install -y build-essential cmake exuberant-ctags apt-get install -y python-dev python3-dev # semantic support for C-family #cd $HOME/.vim/bundle/YouCompleteMe/ && ./install.py --clang-completer # Python should work automatically #cd $HOME/.vim/bundle/YouCompleteMe/ && ./install.py # Go support - #cd $HOME/.vim/bundle/YouCompleteMe/ && ./install.py --gocode-code --clang-completer # ycmd update #cd $HOME/.vim/bundle/YouCompleteMe/third_party/ycmd && git submodule update --init --recursive \ #./build.py --all # jedi-vim (since youcompleteme seems to just crash) apt-get install -y python-pip #pip install jedi apt-get install -y vim-python-jedi pylama pylint flake8 #apt-get install -y prospector pip install prospector[with_pyroma]