From a08caede372289fa79dfca3291b184a87e74882b Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Wed, 21 Dec 2016 12:19:26 +0100 Subject: [PATCH 01/11] Start pane counting with 0 --- tmux/tmux.conf | 5 +---- vimrc | 9 ++++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 8923ac6..518f8cf 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -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/vimrc b/vimrc index 369e6d6..b7c50be 100644 --- a/vimrc +++ b/vimrc @@ -28,10 +28,12 @@ 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' " html / templates Plug 'mattn/emmet-vim', { 'for': 'html' } " emmet support for vim - easily create markdup wth CSS-like syntax @@ -47,13 +49,16 @@ Plug 'othree/es.next.syntax.vim', { 'for': 'javascript' } " ES6 and beyond synta " Go Plug 'fatih/vim-go', { 'for': 'go' } " go support +" Colorschemes +Plug 'altercation/vim-colors-solarized' + " All of your Plugins must be added before the following line call plug#end() " required filetype plugin indent on " required " To ignore plugin indent changes, instead use: "filetype plugin on -" S E T T I N G S +" S E T T I N G S set number set autoread @@ -103,6 +108,8 @@ let g:airline_powerline_fonts = 1 " M A P P I N G S let mapleader = "," +" CtrlP for Tags +nnoremap :CtrlPTag " Toggle NERDTree nmap k :NERDTreeToggle From 1820c357e9ee53aa8d184ebb1352e159f89f6cbc Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Fri, 23 Dec 2016 14:50:08 +0100 Subject: [PATCH 02/11] Switch to solarized --- vimrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vimrc b/vimrc index b7c50be..eea3def 100644 --- a/vimrc +++ b/vimrc @@ -58,6 +58,10 @@ filetype plugin indent on " required " To ignore plugin indent changes, instead use: "filetype plugin on +" T H E M E +colorscheme solarized +set background=dark + " S E T T I N G S set number set autoread From a0d2b063b9d0008396eeac876e290c7b4386c093 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Fri, 23 Dec 2016 15:35:59 +0100 Subject: [PATCH 03/11] Add install script --- install.sh | 23 +++++++++++++++++++++++ tmux/{tmux.conf => tmux.conf.symlink} | 0 vimrc => vimrc.symlink | 0 zsh/aliases.zsh | 2 ++ zsh/zshrc.symlink | 3 +++ 5 files changed, 28 insertions(+) create mode 100755 install.sh rename tmux/{tmux.conf => tmux.conf.symlink} (100%) rename vimrc => vimrc.symlink (100%) create mode 100644 zsh/zshrc.symlink diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..6087f9c --- /dev/null +++ b/install.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +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)" + mv $HOME/.zshrc $HOME/.oh-my-zsh/zshrc.sh +fi + +DOTFILES=$HOME/.dotfiles + +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/tmux.conf b/tmux/tmux.conf.symlink similarity index 100% rename from tmux/tmux.conf rename to tmux/tmux.conf.symlink diff --git a/vimrc b/vimrc.symlink similarity index 100% rename from vimrc rename to vimrc.symlink diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index a6e3c42..ea8dc7b 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,6 +1,8 @@ # in case its not already thera alias la='ls -la' +alias v='vim ' + # GIT related alias gs='git status' alias gfr='git fetch && git rebase' diff --git a/zsh/zshrc.symlink b/zsh/zshrc.symlink new file mode 100644 index 0000000..d64d389 --- /dev/null +++ b/zsh/zshrc.symlink @@ -0,0 +1,3 @@ +source $HOME/.oh-my-zsh/zshrc.sh +source $HOME/.dotfiles/zsh/aliases.zsh + From bbac3731d23fb49c524b6f4de1119d5f89d4bfc8 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Tue, 3 Jan 2017 19:06:58 +0100 Subject: [PATCH 04/11] Use oh-my-zshs dir for custom settings --- zsh/zshrc.symlink => custom.zsh | 3 ++- install.sh | 6 +++--- tmux/tmux.conf.symlink | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) rename zsh/zshrc.symlink => custom.zsh (54%) diff --git a/zsh/zshrc.symlink b/custom.zsh similarity index 54% rename from zsh/zshrc.symlink rename to custom.zsh index d64d389..b5568dd 100644 --- a/zsh/zshrc.symlink +++ b/custom.zsh @@ -1,3 +1,4 @@ -source $HOME/.oh-my-zsh/zshrc.sh +ZSH_THEME="agnoster" + source $HOME/.dotfiles/zsh/aliases.zsh diff --git a/install.sh b/install.sh index 6087f9c..f8384bb 100755 --- a/install.sh +++ b/install.sh @@ -1,14 +1,14 @@ #!/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)" - mv $HOME/.zshrc $HOME/.oh-my-zsh/zshrc.sh + ln -s $DOTFILES/zsh/custom.zsh ~/.oh-my-zsh/custom/custom.zsh fi -DOTFILES=$HOME/.dotfiles - echo -e "\nCreating symlinks" echo "==============================" linkables=$( find -H "$DOTFILES" -maxdepth 3 -name '*.symlink' ) diff --git a/tmux/tmux.conf.symlink b/tmux/tmux.conf.symlink index 518f8cf..367539c 100644 --- a/tmux/tmux.conf.symlink +++ 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" From 1cee8476184651c820e69eaed45c2e5425b40c55 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Tue, 3 Jan 2017 19:10:02 +0100 Subject: [PATCH 05/11] Move custom.zsh to proper folder --- custom.zsh => zsh/custom.zsh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename custom.zsh => zsh/custom.zsh (100%) diff --git a/custom.zsh b/zsh/custom.zsh similarity index 100% rename from custom.zsh rename to zsh/custom.zsh From ce437b44324afc2b90b4211371d77a4611ee272e Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Wed, 4 Jan 2017 22:59:05 +0100 Subject: [PATCH 06/11] Add neocomplete snippets --- vimrc.symlink | 18 ++++++++++++++++++ zsh/custom.zsh | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/vimrc.symlink b/vimrc.symlink index eea3def..c313403 100644 --- a/vimrc.symlink +++ b/vimrc.symlink @@ -195,3 +195,21 @@ 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 diff --git a/zsh/custom.zsh b/zsh/custom.zsh index b5568dd..5c54e76 100644 --- a/zsh/custom.zsh +++ b/zsh/custom.zsh @@ -1,4 +1,8 @@ ZSH_THEME="agnoster" +HIST_STAMPS="dd.mm.yyyy" +COMPLETION_WAITING_DOTS="true" + +export EDITOR="vim" source $HOME/.dotfiles/zsh/aliases.zsh From 6767281490b0c7c3b5404ad9a9ceca1ef8be371e Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Thu, 5 Jan 2017 00:45:39 +0100 Subject: [PATCH 07/11] Add go specific mappings and settings --- vim/ftplugin/go.vim | 10 ++++++++++ vimrc.symlink | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 vim/ftplugin/go.vim diff --git a/vim/ftplugin/go.vim b/vim/ftplugin/go.vim new file mode 100644 index 0000000..4b6d30e --- /dev/null +++ b/vim/ftplugin/go.vim @@ -0,0 +1,10 @@ +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) diff --git a/vimrc.symlink b/vimrc.symlink index c313403..8e46584 100644 --- a/vimrc.symlink +++ b/vimrc.symlink @@ -34,6 +34,7 @@ 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 @@ -110,6 +111,15 @@ 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 From 5fb44831c0de4c2e095046ba7246c24c30423192 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Tue, 17 Jan 2017 23:20:33 +0100 Subject: [PATCH 08/11] Major Update --- bin/battery_indicator.sh | 26 ++++++++++++++++++++++++++ tmux/theme.sh | 3 ++- vim/ftplugin/go.vim | 1 + vim/neosnippets/go.snip | 12 ++++++++++++ vimrc.symlink | 1 + 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100755 bin/battery_indicator.sh create mode 100644 vim/neosnippets/go.snip 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/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/vim/ftplugin/go.vim b/vim/ftplugin/go.vim index 4b6d30e..9df729d 100644 --- a/vim/ftplugin/go.vim +++ b/vim/ftplugin/go.vim @@ -8,3 +8,4 @@ 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..fe3e96c --- /dev/null +++ b/vim/neosnippets/go.snip @@ -0,0 +1,12 @@ +snippet middleware +options head + func ${1}(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { + ${2} + next(r, rw) + } + +snippet handler +options head + func ${1}(w http.ResponseWriter, r *http.Request) { + ${2} + } diff --git a/vimrc.symlink b/vimrc.symlink index 8e46584..5b16c05 100644 --- a/vimrc.symlink +++ b/vimrc.symlink @@ -223,3 +223,4 @@ smap neosnippet#expandable_or_jumpable() ? if has('conceal') set conceallevel=2 concealcursor=niv endif +let g:neosnippet#snippets_directory = '~/.dotfiles/vim/neosnippets' From 181db1ad897dd388691d4137b4914eadd5667ae8 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Tue, 17 Jan 2017 23:47:34 +0100 Subject: [PATCH 09/11] Fix wrong occurence of variables --- vim/neosnippets/go.snip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/neosnippets/go.snip b/vim/neosnippets/go.snip index fe3e96c..58280a0 100644 --- a/vim/neosnippets/go.snip +++ b/vim/neosnippets/go.snip @@ -2,7 +2,7 @@ snippet middleware options head func ${1}(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { ${2} - next(r, rw) + next(rw, r } snippet handler From 8614525afa50ebab1cf1793d6eb9e7eaeea96d24 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Tue, 17 Jan 2017 23:50:23 +0100 Subject: [PATCH 10/11] Fix weird naming of variable --- vim/neosnippets/go.snip | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vim/neosnippets/go.snip b/vim/neosnippets/go.snip index 58280a0..0405b70 100644 --- a/vim/neosnippets/go.snip +++ b/vim/neosnippets/go.snip @@ -1,8 +1,8 @@ snippet middleware options head - func ${1}(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { + func ${1}(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { ${2} - next(rw, r + next(w, r } snippet handler From 7fc019310ba179788193adbc76bf19b97804ae55 Mon Sep 17 00:00:00 2001 From: Marcel Schneider Date: Fri, 27 Jan 2017 08:46:00 +0100 Subject: [PATCH 11/11] Add proper handling of go template files --- vim/neosnippets/go.snip | 7 +++++++ vimrc.symlink | 15 +++++++++++---- zsh/custom.zsh | 2 ++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/vim/neosnippets/go.snip b/vim/neosnippets/go.snip index 0405b70..32764a3 100644 --- a/vim/neosnippets/go.snip +++ b/vim/neosnippets/go.snip @@ -10,3 +10,10 @@ 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.symlink b/vimrc.symlink index 5b16c05..c01439f 100644 --- a/vimrc.symlink +++ b/vimrc.symlink @@ -37,9 +37,9 @@ 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 @@ -48,7 +48,14 @@ 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' diff --git a/zsh/custom.zsh b/zsh/custom.zsh index 5c54e76..ade3369 100644 --- a/zsh/custom.zsh +++ b/zsh/custom.zsh @@ -4,5 +4,7 @@ COMPLETION_WAITING_DOTS="true" export EDITOR="vim" +export goschneider="$HOME/go/src/git.webschneider.org" + source $HOME/.dotfiles/zsh/aliases.zsh