Skip to content

Instantly share code, notes, and snippets.

@dgonzo
Last active September 6, 2016 02:52
Show Gist options
  • Save dgonzo/6b63dd6e66784058f4ce3d4fb5d2932e to your computer and use it in GitHub Desktop.
Save dgonzo/6b63dd6e66784058f4ce3d4fb5d2932e to your computer and use it in GitHub Desktop.
System setup
root = true
# General
indent_style = space
indent_size = 2
tab_width = 2
# end_of_line
# insert_final_newline
trim_trailing_whitespace = true
max_line_length = 100
charset = utf-8
[Makefile]
indent_style = tab
" Install dependencies
" vim needs to be compiled from source because xenial comes with python3 by
" default and toggling between two versions of vim is fraught with peril and
" frustration. To compile vim use the vimpy2py3.sh file in this gist:
" wget https://gist.githubusercontent.com/dgonzo/6b63dd6e66784058f4ce3d4fb5d2932e/raw/e1710fb7f6eae8c1c26146f1e30d052fd831a2fb/vimpy2p3.sh
" and run with bash vimpy2py3.sh
" apt-get install python3-dev python-dev build essentials cmake exuberant-ctags
" Set up pyenv so you can declare per-project/per-directory pythons as needed:
" curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
" pyenv update
" pyenv virtualenv venv2 --python=/usr/bin/python2.7 # adds system py2.7 as a useable venv base
" pyenv virtualenv venv3 --python=/usr/bin/python3.5 # adds system py3.5 as a useable venv base
" Set up vim-plug
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" Update your gloabl vimrc: /etc/vim/vimrc with the following changes
" uncomment reopening file
" uncomment the highly recommended changes
" Powerline fonts
" easiest way is to just clone [email protected]:powerline/fonts.git and then run
" install.sh from that repo
" begin vim-plug
call plug#begin()
Plug 'Valloric/YouCompleteMe', { 'do': 'python3 ./install.py' }
Plug 'lambdalisue/vim-pyenv', { 'for': ['python', 'python3'] }
Plug 'tmhedberg/SimpylFold'
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-commentary'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'editorconfig/editorconfig-vim'
" user's editorconfig: ~/.editorconfig can be overridden with project-level
" .editorconfigs
Plug 'tpope/vim-fugitive'
" if you want to use this plugin:
" sudo apt-get install ruby rubygems vim-nox && sudo /usr/bin/gem install json_pure
Plug 'junegunn/vim-github-dashboard'
Plug 'scrooloose/syntastic'
Plug 'nvie/vim-flake8', { 'for': ['python', 'python3'] }
Plug 'altercation/vim-colors-solarized'
Plug 'myusuf3/numbers.vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'xolox/vim-easytags' | Plug 'xolox/vim-misc'
" add plugin to &runtimepath
call plug#end()
" colors
if has('gui_running')
set background=dark
colorscheme solarized
" use a powerlinen patched font
" https://github.com/powerline/fonts/tree/master/samples
" airline
let g:airline_theme = 'solarized'
else
set background=dark
colorscheme default
let g:airline_theme = 'distinguished'
endif
call togglebg#map("<F5>")
" syntax general
syntax enable
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" python
let g:ycm_python_binary_path=substitute(system("which python"), "\n$", "", "")
let $PYTHONPATH=getcwd() . ":" . $PYTHONPATH
" python syntax
autocmd BufWritePost *.py call Flake8() " run flake8 on save -- alternatively disable and F7 will run check
" you can change this to suit just how pep8 compliant you want your code to be
let flake8_error_marker='EE' " set error marker
let flake8_warning_marker='' " disable warning markers
let flake8_pyflake_marker='' " disable PyFlakes warnings
let flake8_complexity_maker='' " disable McCabe complexity warnings
let flake8_naming_marker='' " disable naming warnings
" layout
set splitbelow
set splitright
"split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enable folding
set foldmethod=indent
set foldlevel=99
let g:SimplyFold_docstring_preview=1
" wildignore applies to nerdtree and ctrlp
set wildignore+=*/tmp/*,*.swp,*.zip,*.so,*.pyc,*.pyo
" NERDTree
" Open cwd by default use with just vim not vim .
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
map <C-l> :NERDTreeToggle<CR>
" close if NERDTree is the only remaining window
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let NERDTreeIgnore=['__pycache__$', '\~$']
" ctrlp
let g:ctrlp_working_path_mod = 'ra'
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
" editorconfig
let g:EditorConfig_exclude_patters = ['fugitive://.*']
" YCM
let g:ycm_autoclose_preview_window_after_completion=1
map <leader>g : YcmCompleter GoToDefinitionElseDeclaration<CR>
" numbers
set number
let g:numbers_exclued = ['nerdtree']
nnoremap <F3> :NumbersToggle<CR>
" airline
set laststatus=2
let g:airline_powerline_fonts = 1
set guifont=Hack
# ~/.ssh/config
Host bitbucket.com
HostName bitbucket.org
PreferredAuthentications publickey
IdentityFile ~/.ssh/gonzo
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gonzo
#!/bin/bash
#==============================================================================
# An install script of GVim in Ubuntu/Debian
#==============================================================================
# Modified: 9/5/16 by dg
# Original: https://gist.githubusercontent.com/lambdalisue/102a1f9985b243cd0e71/raw/2a7a10434db555df172b4af550b3e25e01094bd7/install_gvim.sh
# Enable source code: 'Software & Updates' > enable 'Source code'
echo "Installing required packages ..."
sudo apt-get install -yq build-essential curl checkinstall
sudo apt-get install -yq \
libncurses5-dev \
libbonoboui2-dev \
libcario2-dev libxpm-dev \
libx11-dev libxt-dev \
libgnome2-dev libgnomeui-dev \
libgtk2.0-dev libatk1.0-dev
sudo apt-get install -yq \
lua5.2 liblua5.2-dev \
luajit libluajit-5.1
sudo apt-get install -yq \
libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev llvm
sudo apt-get build-dep vim-gtk
PYTHON2=$(pyenv install -l | \
grep -E "^ 2\.[0-9]+\.[0-9]+$" | \
tail -1 | sed -e 's/^[ ]*//')
PYTHON3=$(pyenv install -l | \
grep -E "^ 3\.[0-9]+\.[0-9]+$" | \
tail -1 | sed -e 's/^[ ]*//')
echo "Installing Python $PYTHON2 and $PYTHON3 ..."
CONFIGURE_OPTS="--enable-shared --enable-unicode-ucs4" \
pyenv install $PYTHON2
CONFIGURE_OPTS="--enable-shared" \
pyenv install $PYTHON3
echo "Downloading Vim repository ..."
if [[ -d vim ]]; then
rm -rf vim
fi
git clone --depth=1 https://github.com/vim/vim
cd vim
pyenv local ${PYTHON2} ${PYTHON3}
echo "Configure Vim installation ..."
make distclean
#./configure \
PREFIX="${HOME}/.anyenv/envs/pyenv/versions"
LDFLAGS="-Wl,-rpath=${PREFIX}/${PYTHON2}/lib:${PREFIX}/${PYTHON3}/lib" ./configure \
--enable-fail-if-missing \
--with-features=huge \
--enable-multibyte \
--with-luajit \
--enable-luainterp \
--enable-rubyinterp \
--enable-pythoninterp=dynamic \
--enable-python3interp=dynamic \
--enable-multibyte \
--enable-fontset \
--enable-cscope \
--enable-gui=gtk2 | tee ../install_gvim.configure.log
echo
echo "Confirm 'install_gvim.configure.log' if the following lines are correct"
echo
echo " checking whether we can do without RTLD_GLOBAL for Python... yes"
echo " checking whether we can do without RTLD_GLOBAL for Python3... yes"
echo
echo "Otherwise you cannot switch python and python3 in a same Vim session."
echo "Then execute the following:"
echo
echo " make -j $((`nproc`*2))"
echo " sudo checkinstall"
echo " follow the default prompts for check install and add a description like: vim with py2 and py3 dynamic bindings"
echo " if you want to add gvim to your applications directory and create a launcher:"
echo " sudo apt-get install gnome-panel"
echo " sudo gnome-desktop-item-edit /usr/share/applications --create-new"
echo " Name: GVim"
echo " Command: gvim"
echo " you can add an icon from here: http://cloudfour.github.io/slides-svg-101/lib/images/icon-vim.png"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment