diff --git a/bin/battery_indicator.sh b/bin/battery_indicator.sh new file mode 100755 index 0000000..202cffe --- /dev/null +++ b/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 diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..f8384bb --- /dev/null +++ b/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 diff --git a/tmux/theme.sh b/tmux/theme.sh index 4eaaee9..707eabc 100644 --- a/tmux/theme.sh +++ b/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 diff --git a/tmux/tmux.conf b/tmux/tmux.conf.symlink similarity index 96% rename from tmux/tmux.conf rename to tmux/tmux.conf.symlink index 8923ac6..367539c 100644 --- a/tmux/tmux.conf +++ b/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 + diff --git a/vim/ftplugin/go.vim b/vim/ftplugin/go.vim new file mode 100644 index 0000000..9df729d --- /dev/null +++ b/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 (go-run) +au FileType go nmap gi (go-imports) +au FileType go nmap b (go-build) +au FileType go nmap t (go-test) +au FileType go nmap c (go-coverage) +au FileType go nmap gd (go-doc) +au FileType go nmap ml (go-metalinter) +au FileType go nmap r (go-rename) diff --git a/vim/neosnippets/go.snip b/vim/neosnippets/go.snip new file mode 100644 index 0000000..32764a3 --- /dev/null +++ b/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} + } diff --git a/vimrc b/vimrc.symlink similarity index 77% rename from vimrc rename to vimrc.symlink index 369e6d6..c01439f 100644 --- a/vimrc +++ b/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 :CtrlPTag " Toggle NERDTree nmap k :NERDTreeToggle @@ -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 (neosnippet_expand_or_jump) +smap (neosnippet_expand_or_jump) +xmap (neosnippet_expand_target) + +" SuperTab like snippets behavior. +"imap +" \ pumvisible() ? "\" : +" \ neosnippet#expandable_or_jumpable() ? +" \ "\(neosnippet_expand_or_jump)" : "\" +smap neosnippet#expandable_or_jumpable() ? +\ "\(neosnippet_expand_or_jump)" : "\" + +" For conceal markers. +if has('conceal') + set conceallevel=2 concealcursor=niv +endif +let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets' diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 8d12575..42c60c5 100644 --- a/zsh/aliases.zsh +++ b/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' diff --git a/zsh/custom.zsh b/zsh/custom.zsh new file mode 100644 index 0000000..ade3369 --- /dev/null +++ b/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 +