Marcel Schneider 7 years ago
parent
commit
b15e8ce351
  1. 26
      bin/battery_indicator.sh
  2. 23
      install.sh
  3. 3
      tmux/theme.sh
  4. 7
      tmux/tmux.conf.symlink
  5. 11
      vim/ftplugin/go.vim
  6. 19
      vim/neosnippets/go.snip
  7. 57
      vimrc.symlink
  8. 2
      zsh/aliases.zsh
  9. 10
      zsh/custom.zsh

26
bin/battery_indicator.sh

@ -0,0 +1,26 @@
#!/bin/bash
# modified from http://ficate.com/blog/2012/10/15/battery-life-in-the-land-of-tmux/
HEART='♥ '
if [[ `uname` == 'Linux' ]]; then
current_charge=$(cat /proc/acpi/battery/BAT1/state | grep 'remaining capacity' | awk '{print $3}')
total_charge=$(cat /proc/acpi/battery/BAT1/info | grep 'last full capacity' | awk '{print $4}')
else
battery_info=`ioreg -rc AppleSmartBattery`
current_charge=$(echo $battery_info | grep -o '"CurrentCapacity" = [0-9]\+' | awk '{print $3}')
total_charge=$(echo $battery_info | grep -o '"MaxCapacity" = [0-9]\+' | awk '{print $3}')
fi
charged_slots=$(echo "((($current_charge/$total_charge)*10)/3)+1" | bc -l | cut -d '.' -f 1)
if [[ $charged_slots -gt 3 ]]; then
charged_slots=3
fi
echo -n '#[fg=colour196]'
for i in `seq 1 $charged_slots`; do echo -n "$HEART"; done
if [[ $charged_slots -lt 3 ]]; then
echo -n '#[fg=colour254]'
for i in `seq 1 $(echo "3-$charged_slots" | bc)`; do echo -n "$HEART"; done
fi

23
install.sh

@ -0,0 +1,23 @@
#!/usr/bin/env bash
DOTFILES=$HOME/.dotfiles
if [[ ! -d ~/.oh-my-zsh ]]; then
echo -e "\nInstall oh-my-zsh"
echo "============================="
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
ln -s $DOTFILES/zsh/custom.zsh ~/.oh-my-zsh/custom/custom.zsh
fi
echo -e "\nCreating symlinks"
echo "=============================="
linkables=$( find -H "$DOTFILES" -maxdepth 3 -name '*.symlink' )
for file in $linkables ; do
target="$HOME/.$( basename $file '.symlink' )"
if [ -e $target ]; then
echo "~${target#$HOME} already exists... Skipping."
else
echo "Creating symlink for $file"
ln -s $file $target
fi
done

3
tmux/theme.sh

@ -51,10 +51,11 @@ set-window-option -g clock-mode-colour $tm_color_active
#tm_tunes="#[fg=$tm_color_music]#(osascript ~/.dotfiles/applescripts/tunes.scpt)"
#tm_battery="#(~/.dotfiles/bin/battery_indicator.sh)"
tm_battery="#[fg=$tm_color_inactive]#(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | awk '{print $2}')"
tm_date="#[fg=$tm_color_inactive] %R %d %b"
tm_host="#[fg=$tm_color_feature,bold]#h"
tm_session_name="#[fg=$tm_color_feature,bold]$tm_icon #S"
set -g status-left $tm_session_name' '
set -g status-right $tm_tunes' '$tm_date' '$tm_host
set -g status-right $tm_battery' '$tm_date' '$tm_host

7
tmux/tmux.conf → tmux/tmux.conf.symlink

@ -1,4 +1,4 @@
#set -g default-command "login-shell"
set -g default-command "zsh"
# tmux display things in 256 colors
#set -g default-terminal "tmux-256color-italic"
@ -40,10 +40,6 @@ bind = select-layout tiled
# unbind o # this is the default key for cycling panes
# bind ^A select-pane -t:.+
# make window/pane index start with 1
set -g base-index 1
setw -g pane-base-index 1
set-option -g set-titles on
set-option -g set-titles-string "#T - #W"
# set-window-option -g automatic-rename on
@ -118,3 +114,4 @@ bind -t vi-copy 'y' copy-selection
##############################
source ~/.dotfiles/tmux/theme.sh

11
vim/ftplugin/go.vim

@ -0,0 +1,11 @@
let g:syntastic_go_checkers = ['go', 'golint', 'govet']
let g:go_fmt_command = "goimports"
au FileType go nmap <F5> <Plug>(go-run)
au FileType go nmap <leader>gi <Plug>(go-imports)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <leader>c <Plug>(go-coverage)
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>ml <Plug>(go-metalinter)
au FileType go nmap <Leader>r <Plug>(go-rename)

19
vim/neosnippets/go.snip

@ -0,0 +1,19 @@
snippet middleware
options head
func ${1}(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
${2}
next(w, r
}
snippet handler
options head
func ${1}(w http.ResponseWriter, r *http.Request) {
${2}
}
snippet method
abbr meth
options head
func (${1}) ${2}(${3}) ${4}{
${5}
}

57
vimrc → vimrc.symlink

@ -28,15 +28,18 @@ Plug 'scrooloose/nerdcommenter'
"Plug 'myusuf3/numbers.vim'
Plug 'Shougo/neocomplete.vim'
Plug 'Shougo/neosnippet.vim'
Plug 'Shougo/neosnippet-snippets'
Plug 'easymotion/vim-easymotion'
Plug 'bling/vim-airline'
Plug 'tpope/vim-ragtag'
Plug 'surround.vim'
Plug 'tpope/vim-repeat'
Plug 'vim-syntastic/syntastic'
" html / templates
Plug 'mattn/emmet-vim', { 'for': 'html' } " emmet support for vim - easily create markdup wth CSS-like syntax
Plug 'gregsexton/MatchTag', { 'for': 'html' } " match tags in html, similar to paren support
Plug 'othree/html5.vim', { 'for': 'html' } " html5 support
Plug 'mattn/emmet-vim', { 'for': ['html', 'php', 'gohtmltmpl'] } " emmet support for vim - easily create markdup wth CSS-like syntax
Plug 'gregsexton/MatchTag', { 'for': ['html', 'php', 'gohtmltmpl'] } " match tags in html, similar to paren support
Plug 'othree/html5.vim', { 'for': ['html', 'php', 'gohtmltmpl'] } " html5 support
" JavaScript
Plug 'gavocanov/vim-js-indent', { 'for': 'javascript' } " JavaScript indent support
@ -45,7 +48,17 @@ Plug 'othree/yajs.vim', { 'for': 'javascript' } " JavaScript syntax plugin
Plug 'othree/es.next.syntax.vim', { 'for': 'javascript' } " ES6 and beyond syntax
" Go
Plug 'fatih/vim-go', { 'for': 'go' } " go support
Plug 'fatih/vim-go', { 'for': [ 'go', 'html', 'gohtmltmpl' ] } " go support
" LaTeX
Plug 'LaTeX-Box-Team/LaTeX-Box', { 'for': 'tex' }
" Markdown
Plug 'suan/vim-instant-markdown', { 'for': 'markdown' }
Plug 'tpope/vim-markdown', { 'for': 'markdown'}
" Colorschemes
Plug 'altercation/vim-colors-solarized'
" All of your Plugins must be added before the following line
call plug#end() " required
@ -53,7 +66,11 @@ filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
" S E T T I N G S
" T H E M E
colorscheme solarized
set background=dark
" S E T T I N G S
set number
set autoread
@ -101,8 +118,19 @@ let NERDTreeShowHidden=1
let g:airline_powerline_fonts = 1
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_aggregate_errors = 1
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
" M A P P I N G S
let mapleader = ","
" CtrlP for Tags
nnoremap <leader><C-p> :CtrlPTag<cr>
" Toggle NERDTree
nmap <silent> <leader>k :NERDTreeToggle<cr>
@ -184,3 +212,22 @@ endif
" For perlomni.vim setting.
" https://github.com/c9s/perlomni.vim
let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::'
" 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>
" \ pumvisible() ? "\<C-n>" :
" \ neosnippet#expandable_or_jumpable() ?
" \ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
" For conceal markers.
if has('conceal')
set conceallevel=2 concealcursor=niv
endif
let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets'

2
zsh/aliases.zsh

@ -2,6 +2,8 @@
alias la='ls -la'
alias sagu='sudo apt-get upgrade'
alias v='vim '
# GIT related
alias gs='git status'
alias gfr='git fetch && git rebase'

10
zsh/custom.zsh

@ -0,0 +1,10 @@
ZSH_THEME="agnoster"
HIST_STAMPS="dd.mm.yyyy"
COMPLETION_WAITING_DOTS="true"
export EDITOR="vim"
export goschneider="$HOME/go/src/git.webschneider.org"
source $HOME/.dotfiles/zsh/aliases.zsh
Loading…
Cancel
Save