#!/usr/bin/env bash set -x apt install -y powerline grip pandoc pandoc #vim-airline vim-airline-themes DEST=${1:-/etc/skel} 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 # Directories for swap, backup and undo mkdir -p ${HOME}/.vim/swap mkdir -p ${HOME}/.vim/backup mkdir -p ${HOME}/.vim/undo # Format json cat > ${DEST}/.vimrc << 'EOF' " Format json nmap =j :%!python -m json.tool EOF # vimrc additions cat > ${DEST}/.vimrc << 'EOF' " enable syntax highlighting syntax enable " persistant undo file in a single location set undodir=${HOME}/.vim/undo// " Maintain undo history between sessions set undofile " Put backup files in a single location with timestamped names "set backupdir=${HOME}/.vim/backup// "au BufWritePre * let &bex = substitute(expand('%:p:h'), '/', ':', 'g') . strftime(';%FT%T') set nobackup " Put swap files in a single location set directory=${HOME}/.vim/swap// " 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 > ${DEST}/.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 ${DEST} || exit apt install -y git git clone https://github.com/VundleVim/Vundle.vim.git ${DEST}/.vim/bundle/Vundle.vim # Prepend to the .vimrc if [ -f ${DEST}/.vimrc_pending ];then rm ${DEST}/.vimrc_pending fi touch ${DEST}/.vimrc_pending cat > $DEST/.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 'voldikiss/vim-floaterm' Plugin 'tpope/vim-fugitive' Plugin 'jreybert/vimagit' Plugin 'wincent/command-t' Plugin 'tmhedberg/SimpylFold' Plugin 'vim-scripts/indentpython.vim' "Plugin 'Valloric/YouCompleteMe' 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 'liuchengxu/vim-which-key' "Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} Plugin 'vim-airline/vim-airline' Plugin 'vim-airline/vim-airline-themes' Plugin 'will133/vim-dirdiff' Plugin 'jiangmiao/auto-pairs' Plugin 'mhinz/vim-startify' "Plugin 'mhinz/vim-signify' Plugin 'airblade/vim-gitgutter' Plugin 'airblade/vim-rooter' 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 'preservim/nerdtree' Plugin 'ryanoasis/vim-devicons' Plugin 'tiagofumo/vim-nerdtree-syntax-highlight' Plugin 'tsony-tsonev/nerdtree-git-plugin' Plugin 'jistr/vim-nerdtree-tabs' Plugin 'severin-lemaignan/vim-minimap' let g:NERDTreeGitStatusWithFlags = 1 let g:NERDTreeIndicatorMapCustom = { \ "Modified" : "✹", \ "Staged" : "✚", \ "Untracked" : "✭", \ "Renamed" : "➜", \ "Unmerged" : "═", \ "Deleted" : "✖", \ "Dirty" : "✗", \ "Clean" : "✔︎", \ 'Ignored' : '☒', \ "Unknown" : "?" \ } let g:minimap_highlight='Visual' let NERDTreeQuitOnOpen=1 let NERDTreeMinimalUI = 1 let NERDTreeDirArrows = 1 " Nerdtree toggle keymap nmap \ :NERDTreeToggle " Nerdtree find keymap nnoremap :NERDTreeFind:vertical let g:NERDTreeMapActivateNode="" let g:NERDTreeMapPreview="" Plugin 'godlygeek/tabular' Plugin 'plasticboy/vim-markdown' Plugin 'imcco/markdown-preview.nvim' let vim_markmdown_preview_github=1 "let vim_markmdown_preview_pandoc=1 let vim_markdown_preview_toggle=1 let vim_markdown_preview_hotkey='' Plugin 'saltstack/salt-vim' Plugin 'fatih/vim-go' " CtrlP let g:ctrlp_map = '' let g:ctrlp_cmd = 'CtrlP' " 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' " flutter/dart Plugin 'dart-lang/dart-vim-plugin' Plugin 'natebosch/vim-lsc' Plugin 'natebosch/vim-lsc-dart' let g:lsc_auto_map = v:true Plugin 'thosakwe/vim-flutter' call FlutterMenu() " Some of these key choices were arbitrary; " it's just an example. "nnoremap fa :FlutterRun "nnoremap fq :FlutterQuit "nnoremap fr :FlutterHotReload "nnoremap fR :FlutterHotRestart "nnoremap fD :FlutterVisualDebug " COC intellisense engine https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim Plugin 'neoclide/coc.nvim' Plugin 'tjdevries/coc-zsh' " Neomake is a plugin for Vim/Neovim to asynchronously run programs. Plugin 'neomake/neomake' " Rust Plugin 'rust-lang/rust.vim' 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 let g:airline_powerline_fonts = 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 " Use one space after # comment character in python, " see http://tinyurl.com/y4hm29o3 let g:NERDAltDelims_python = 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 " 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 # append the existing vimrc to the plugin additions cat ${DEST}/.vimrc >> ${DEST}/.vimrc_pending # copy it back to the vimrc cp ${DEST}/.vimrc_pending ${DEST}/.vimrc #mv ${DEST}/.vimrc_pending ${DEST}/.vimrc # Install Vundle plugins HOME=${DEST} vim -V -E -s -c "source ${DEST}/.vimrc" -c "PluginInstall" -c "PluginUpdate" -c "qa!" # Install Coc plugins FIXME #HOME=${DEST} vim -V -E -s -c "source ${DEST}/.vimrc" -c "CocInstall coc-java coc-go coc-python coc-flutter coc-css coc-cssmodules coc-xml coc-json coc-yaml coc-html coc-git coc-docker" -c "qa\!" #HOME=${DEST} vim -V -E -s /tmp/tempdir <<-EOF # :source ${DEST}/.vimrc # :call coc#util#install() # :CocStart # :CocInstall coc-java coc-go coc-python coc-flutter coc-css coc-cssmodules coc-xml coc-json coc-yaml coc-html coc-git coc-docker # :qa! #EOF # Add platformio support to Coc # :CocConfig #{ # "ccls": { # "enable": false, # "command": "ccls", # "filetypes": ["c", "cpp", "objc", "objcpp"], # "rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"], # "initializationOptions": { # "cache": { # "directory": "/tmp/ccls" # } # } # } # } #} # Install YouCompleteMe support apt install -y build-essential cmake exuberant-ctags apt 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 install -y python-pip apt install -y pylama pylint flake8 # available in unstable of old-stable only #apt install -y prospector # FIXME: Install prospector # pip install prospector[with_pyroma] # Fails with: # Failed building wheel for prospector # Failed building wheel for dodgy # Failed building wheel for pylint-celery # Failed building wheel for pylint-django # Failed building wheel for pylint-flask # Failed building wheel for pylint-plugin-utils # Failed building wheel for requirements-detector # Failed building wheel for setoptconf # dodgy - searches for dodgy looking lines in Python code # python3-pylint-celery - Pylint plugin for code using the Celery library (Python3) # python3-pylint-django - Pylint plugin for analysing code using Django (Python 3) # python3-pylint-flask - pip install pylint-flask - Pylint plugin for analysing code when using Flask # python3-pylint-plugin-utils - Utilities and helpers for writing Pylint plugins (Python 3) # python3-requirements-detector - finds and lists the requirements of a Python project # python3-setoptconf - retrieve Python3 program settings from a variety of sources