Skip to content

Instantly share code, notes, and snippets.

@jvanlier
Last active November 19, 2020 08:47
Show Gist options
  • Save jvanlier/dac782209f9c7eee47534eb375a83fc0 to your computer and use it in GitHub Desktop.
Save jvanlier/dac782209f9c7eee47534eb375a83fc0 to your computer and use it in GitHub Desktop.
Dotfiles

todo

Put in a repo and make bootstrap scripts for mac and linux.

zsh

First, install zsh using package manager (e.g. apt install zsh). Then set as default (password prompt):

$ chsh -s /bin/zsh

Then oh my zsh and zsh-autosuggestions:

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

Now place the .zshrc in ~/.zshrc:

$ source ~/.zshrc

vim

Place the .vimrc in ~/.vimrc, then:

 $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim  
 $ vim
 :PluginInstall
 :q!
 $ cd ~/.vim/bundle/YouCompleteMe
 $ python3 setup.py  # requires cmake

preferred terminal font

Source Code Pro for Powerline, Regular, 12

Git repo

let g:ycm_server_python_interpreter = 'python3'
syntax on
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'easymotion/vim-easymotion'
Plugin 'vim-scripts/indentpython.vim'
" Check Python syntax on each save:
Plugin 'vim-syntastic/syntastic'
" PEP-8 checking; press F7 to run it:
Plugin 'nvie/vim-flake8'
" Nice color scheme:
Plugin 'jnurmine/Zenburn'
" Super searching with CTRL-P:
Plugin 'kien/ctrlp.vim'
" Bottom bar:
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
"Plugin 'hashrocket/vim-macdown'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
"Easy motion from <Leader><Leader> to just <Leader>, which is \ by default.
map <Leader> <Plug>(easymotion-prefix)
" https://realpython.com/vim-and-python-a-match-made-in-heaven/
"split navigations using control key:
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>
" Proper PEP-8 identation but with 100 chars:
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=100 |
\ set colorcolumn=100 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix |
au BufNewFile,BufRead *.md
\ set linebreak
au BufNewFile,BufRead *.tex
\ set linebreak
au BufNewFile,BufRead *.html
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set expandtab |
\ set autoindent |
" Flag unneccesary whitespace:
let python_highlight_all=1
" YCM shortcut: goto declaration quickly with backslash-g
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
colorscheme zenburn
set nu
set ruler
let &t_SI.="\e[6 q"
let &t_SR.="\e[4 q"
let &t_EI.="\e[1 q"
" By default vim doesn't show the status line if there's only one buffer.
" Override this:
set laststatus=2
" Make backspace on mac work like most other programs:
set backspace=2
export ZSH="${HOME}/.oh-my-zsh"
ZSH_THEME="agnoster"
# Disable auto-setting terminal title:
DISABLE_AUTO_TITLE="true"
# Display red dots whilst waiting for completion:
COMPLETION_WAITING_DOTS="true"
plugins=(
git
zsh-autosuggestions
vi-mode
)
source $ZSH/oh-my-zsh.sh
# User configuration
#
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
alias icloud="/Users/jvlier/Library/Mobile\ Documents/com~apple~CloudDocs"
alias up="cd .."
alias cd..="cd .."
# For vi-mode, switch to block cursor in command mode. And vertical bar for insert
# mode. Sources:
# https://emily.st/2013/05/03/zsh-vi-cursor/
# https://github.com/neovim/neovim/issues/2583
function zle-keymap-select zle-line-init
{
case $KEYMAP in
vicmd) echo -ne '\e[1 q';; # block cursor
viins|main) echo -ne '\e[6 q';; # line cursor
esac
zle reset-prompt
zle -R
}
# Since we always toggle back to insert mode after pressing enter, change to block
# unconditionally:
function zle-line-finish
{
echo -ne '\e[1 q'; # block cursor
}
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select
# Locale (was needed on MacOS at one point, doesn't seem to hurt elsewhere):
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Needed to support zenburn vim theme on Linux:
export TERM='xterm-256color'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment