commit 262cd6abb27808803e1410fc3e89fcbaeff7888a Author: Gerrit Pannek Date: Fri Nov 3 08:09:33 2017 +0100 Initital Commit diff --git a/bashrc b/bashrc new file mode 100644 index 0000000..9caad76 --- /dev/null +++ b/bashrc @@ -0,0 +1,39 @@ +test -s ~/.alias && . ~/.alias || true +PS1='\[\033[1;31m\]I@\h\[\033[0m\] [\[\033[31m\]\w\[\033[0m\]] $> \[\033[0m\]' +export PATH=$PATH:~/bin:~/local/bin + +function tmux_title { + printf '\033]2;%s\033\\' $@ +} +tmux_title $(hostname -s) + +# Git prompt +GIT_PROMPT_ONLY_IN_REPO=1 +GIT_PROMPT_FETCH_REMOTE_STATUS=0 +GIT_PROMPT_IGNORE_STASH=1 +GIT_PROMPT_THEME=Single_line +GIT_PROMPT_THEME=Noldorized +source ~/.bash-git-prompt/gitprompt.sh + +function prompt_callback { + REPO=$(git remote -v | sed -r 's/^origin.*\/(.*)\.git.*/\1/' | head -1) + gp_set_window_title "$REPO($GIT_BRANCH)" +} + +# LS_COLORS +eval $(dircolors -b $HOME/.dircolors) + +# Global Options +export LS_OPTIONS="" +export LESS='-R' +export TERM=screen-16color + +# Aliases +alias ls="ls --color=always --time-style=long-iso -F" +alias gs="git status" +alias gc="git commit -m" +alias gco="git checkout" +alias gl="git l" +alias ga="git add" +alias gpush="git push" +alias gpull="git pull" diff --git a/gitconfig b/gitconfig new file mode 100644 index 0000000..33fb261 --- /dev/null +++ b/gitconfig @@ -0,0 +1,47 @@ + [user] + email = nold@gnu.one + name = Gerrit Pannek + + [status] + showUntrackedFiles = all + +[alias] + f = fetch -v + l = log --all --graph --decorate=full --pretty=fuller --date-order --full-history + r = rebase origin/master master + c = commit -m + s = status + logv = log --graph --decorate=full --date-order --full-history --date=local master HEAD + logvr = log --graph --decorate=full --date-order --full-history --date=local master HEAD origin/master + logva = log --graph --decorate=full --date-order --full-history --date=local --all + logpf = log --patch --follow + dt = difftool + mt = mergetool + +[push] + #default = current + default = simple + +[core] + autocrlf = input + +[color] + ui = auto + +#[color "diff"] +# whitespace = red reverse +[pull] + rebase = true +[clean] + requireForce = true +[merge] + tool = vimdiff3 + conflictstyle = diff3 + ff = only +#[diff] +# tool = vimdiff +[mergetool] + prompt = false +[difftool] + prompt = false + diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..7402573 --- /dev/null +++ b/setup.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +LINK_FILES=(bashrc vimrc tmux.conf gitconfig) +mkdir ~/.home-git-back +for file in ${LINK_FILES[@]}; do + [ -f ~/.${file} ] && mv -v ~/.${file} ~/.home-git-back + ln -s $(PWD)/${file} ~/.${file} +done + +# git clones +git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt + +mkdir ~./vim +git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle + +vim -c ":PluginInstall" -c ":q" -c ":q" diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 0000000..c0b65e5 --- /dev/null +++ b/tmux.conf @@ -0,0 +1,134 @@ +## Options +# Set Prefix to Ctrl+a (screen like) +unbind C-b +set -g prefix C-a +bind C-a send-prefix + +## Default is 'screen' +set -sg default-terminal 'screen-16color' +set -sg escape-time 1 +set -sg set-clipboard on +set -g history-limit 100000 + +setw -g alternate-screen on + +set -g renumber-windows on +set -g base-index 1 +setw -g pane-base-index 1 + +set -g status on +set -g status-position bottom +set -g status-justify left +set -g status-interval 1 +set -g status-left-length 20 +set -g status-right-length 30 +set -g status-right ' ⡇ #h ⣿' +#set -g status-right '#(eval ~/bin/tmux-airline `tmux display -p "#{client_width}"`)' +set -g status-left '⣿ ' + +set -g set-titles on +set -g set-titles-string '#T' +setw -g allow-rename off +setw -g automatic-rename on +setw -g automatic-rename-format '#T' +setw -g window-status-format '⡇[#I]#{=120:window_name} ⡇' +setw -g window-status-current-format ' *#{=120:window_name}* ' +set-window-option -g window-status-current-attr bold +#setw -g window-status-format '/ #I:#P #{=120:window_name} |#F \' +#setw -g window-status-current-format '/ #I:#P #{=120:window_name} |#F \' +setw -g window-status-separator '' + +set -g bell-action current +set -g bell-on-alert off +setw -g monitor-activity on +set -g visual-activity off +set -g visual-bell off + +set -g mouse on + +#set -g status-keys vi +#setw -g mode-keys vi + +#setw -g xterm-keys on + +## Mouse Keybindings +# Faster Scrolling +bind -t vi-copy WheelUpPane page-up +bind -t vi-copy WheelDownPane page-down +bind -t emacs-copy WheelUpPane page-up +bind -t emacs-copy WheelDownPane page-down + +## Keyboard keybindings +bind -n 'S-Down' resize-pane -D 1 +bind -n 'S-Up' resize-pane -U 1 +bind -n 'S-Left' resize-pane -L 1 +bind -n 'S-Right' resize-pane -R 1 + +# copypaste +bind-key -n -t emacs-copy C-x copy-pipe "xclip -i -sel p -f | xclip -i -sel c " +bind-key -n C-y run "xclip -o | tmux load-buffer - ; tmux paste-buffer" + +# Splitscreen mit Alt+Arrow wechseln +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +bind 'c' new-window +bind 'n' next +bind 'p' prev +bind 'b' swap-window -t -1 + +#urxvt tab like window switching (-n: no prior escape seq) +bind -n S-down new-window +bind -n S-left prev +bind -n S-right next +bind -n C-left swap-window -t -1 +bind -n C-right swap-window -t +1 + +## Splitting panes +bind 'v' split-window -v +bind 'h' split-window -h + +## Mouse toggling +bind m \ + set -g mouse on \;\ + display 'Mouse: ON' + +bind k \ + set -g mouse off \;\ + display 'Mouse: OFF' + +#### COLOUR (Solarized dark) +# default statusbar colors +set-option -g status-bg black #base02 +set-option -g status-fg yellow +set-option -g status-attr default + +# default window title colors +set-window-option -g window-status-fg white +set-window-option -g window-status-bg default +#set-window-option -g window-status-attr dim + +# active window title colors +set-window-option -g window-status-current-fg white +set-window-option -g window-status-current-bg '#00AA0E' +#set-window-option -g window-status-current-attr bright + +# pane border +set-option -g pane-border-fg green #base02 +set-option -g pane-active-border-fg brightgreen #base01 + +# message text +set-option -g message-bg black #base02 +set-option -g message-fg brightred #orange + +# pane number display +set-option -g display-panes-active-colour green #blue +set-option -g display-panes-colour brightred #orange + +# clock +set-window-option -g clock-mode-colour green #green + +# bell +set-window-option -g window-status-bell-style fg=black,bg=red #base02, red diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..73d795f --- /dev/null +++ b/update.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +GIT_DIRS=(. ~/.bash-git-prompt ~/.vim/bundle) +for dir in ${GIT_DIRS[@]} ; do + cd $dir + git pull + cd - +done + +vim -c ":PluginUpdate" -c ":q" -c ":q" diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..3b7e06c --- /dev/null +++ b/vimrc @@ -0,0 +1,211 @@ +"Installation: +" $ mkdir -p ~/.vim/bundle +" $ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim +" Insert the contant of this file into ~/.vimrc +" $ vim +" Type: :PluginInstall +" Restart vim & be happy :) + +set nocompatible " be iMproved, required +filetype off " required +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin() +Plugin 'VundleVim/Vundle.vim' +Plugin 'https://github.com/airblade/vim-gitgutter' +Plugin 'https://github.com/vim-airline/vim-airline' +Plugin 'https://github.com/vim-airline/vim-airline-themes' +Plugin 'https://github.com/altercation/vim-colors-solarized' +Plugin 'https://github.com/scrooloose/nerdtree' +Plugin 'https://github.com/vim-syntastic/syntastic' +call vundle#end() " required +filetype plugin indent on " required +" +" 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 + +syntax enable +set background=dark +"" Default Tab Setup +set tabstop=4 +set softtabstop=0 +set shiftwidth=4 +set expandtab +set smarttab +"set cindent " Interferes with filetype based intentation, automatic for +set cinoptions=(0,u0,U0 +"set smartindent " No effect with cindent enabled +set autoindent " Retains intentation from previous line +set copyindent +set preserveindent " Might interfere with smarttab ? +set paste +set wildmenu " Tab Completion Menu +set smartindent " Puppet Manifests Tab Setup +"" Status Bar Setup +set laststatus=2 +set noshowmode +set showcmd +"" Needed for proper tabline display of anonymous buffers +set hidden +set mouse=r +" Search options +set ignorecase "ignore case when searching +set smartcase "first search casesensivtive, then +set incsearch "Just to searchresult while typing +set hlsearch " Highlight search results +hi Search guibg=lightRed + +" Press Space to turn off highlighting and clear any message already displayed. +:nnoremap :nohlsearch:echo +" ------------------------------------ Colors / Theme ------------------------------------------- +let g:solarized_visibility = "high" +let g:solarized_contrast = "high" +let g:solarized_termcolors = 256 +colorscheme solarized + +augroup CursorLine + au! + au VimEnter,WinEnter,BufWinEnter * setlocal cursorline + au WinLeave * setlocal nocursorline +augroup END + + +" ------------------------------------ Keybindings ------------------------------------------- +" toggle numbers +noremap :set invnumber +inoremap :set invnumber +map :NERDTreeToggle +" splits +nnoremap + + +" ------------------------------------ AirLine ------------------------------------------- +let g:airline_theme='badwolf' +let g:airline#extensions#tabline#enabled = 0 +let g:airline#extensions#tabline#left_sep = ' ' +let g:airline#extensions#tabline#left_alt_sep = '|' + +" ------------------------------------ SynTastic------------------------------------------- +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + +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 + +" ------------------------------------ NERDTree ------------------------------------------- +"" NERDTree Setup +let g:NERDTreeDirArrowExpandable = '>' +let g:NERDTreeDirArrowCollapsible = 'v' +" close vim if only in nerdtree +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif + +" ------------------------------------ GitGutter ------------------------------------------- +"" GitGutter Setup +set updatetime=250 +let g:gitgutter_enabled = 1 +let g:gitgutter_signs = 1 +let g:gitgutter_highlight_lines = 0 +if executable('/usr/bin/git') == 0 + let g:gitgutter_git_executable = "/bin/true" + let g:gitgutter_enabled = 1 +endif +let g:gitgutter_max_signs = 500 " default value +let g:gitgutter_realtime = 1 +let g:gitgutter_eager = 1 + +" ------------------------------------ Whitespace Highlighting ------------------------------------------- +autocmd ColorScheme * highlight ExtraWhitespaces ctermbg=red guibg=red +"" Extra Whitespace Highlighting +highlight ExtraWhitespaces ctermbg=red guibg=red +"Show tabs and spaces after the inital (tabs and) spaces +"Show trailing whitespace only after some text (ignores blank lines) +"Show tabs that are not at the start of a line (and all spaces after too) +function! MatchExtraWhitespacesNow() + if exists("b:sew") + if b:sew == 1 + match ExtraWhitespaces /^\t* \+\zs\(\t\+ *\)\+\|\S\zs\(\s\+$\| *\zs\(\t\+ *\)\+\)/ + else + if exists("b:sewb") + if b:sewb == 1 + match ExtraWhitespaces /\S\zs\s\+$/ + else + :call clearmatches() + endif + endif + endif + endif +endfunction +function! MatchExtraWhitespacesNowInsert() + if exists("b:sew") + if b:sew == 1 + match ExtraWhitespaces /^\t* \+\zs\(\t\+ *\)\+\|\S\zs\(\s\+\%#\@StripExtraWhitespaces() + if exists("b:sewb") + if b:sewb == 1 + let l = line(".") + let c = col(".") + "Remove trailing whitespace only after some text (ignores blank lines) + %s/\S\zs\s\+$//ge + if exists("b:sew") + if b:sew == 1 + "Remove tabs and spaces after the inital (tabs and) spaces + %s/^\t* \+\zs\(\t\+ *\)\+//ge + "Replace tabs that are not at the start of a line + "(and all spaces after too) with a single space to keep + "tokens apart + %s/\S *\zs\(\t\+ *\)\+/ /ge + endif + endif + call cursor(l, c) + endif + endif +endfunction +autocmd BufWinEnter * :call MatchExtraWhitespacesNow() +autocmd InsertEnter * :call MatchExtraWhitespacesNowInsert() +autocmd InsertLeave * :call MatchExtraWhitespacesNow() +autocmd BufWinLeave * :call clearmatches() +autocmd FileType c,changelog,conf,config,cpp,csh,diff,dosini,eruby,fstab,git,gitcommit,gitconfig,gitrebase,haskell,make,pamconf,puppet,ruby,sh,spec,sshconfig,sudoers,tex,vim,yaml,zsh let b:sewb=1 | let b:sew=0 | :call MatchExtraWhitespacesNow() +autocmd BufWritePre :call StripExtraWhitespaces() +command Sewb let b:sewb=1 | let b:sew=0 | :call MatchExtraWhitespacesNow() +command Sew let b:sewb=1 | let b:sew=1 | :call MatchExtraWhitespacesNow() +command Sewbnow let b:sewb=1 | let b:sew=0 | :call StripExtraWhitespaces() | :call MatchExtraWhitespacesNow() +command Sewnow let b:sewb=1 | let b:sew=1 | :call StripExtraWhitespaces() | :call MatchExtraWhitespacesNow() +command Nosewb let b:sewb=0 | let b:sew=0 | :call MatchExtraWhitespacesNow() +command Nosew let b:sew=0 | :call MatchExtraWhitespacesNow() +""------------------------------------ Vimdiff Setup ---------------------------------------------------- +highlight DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red +highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red +highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red +highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red +"" Disable syntax highlighting in diff mode only +if &diff + syntax off +endif +" ------------------------------------ More Cool Stuff ------------------------------------------- +"" UTF-8 Setup +if has("multi_byte") + if &termencoding == "" + let &termencoding = &encoding + endif + set encoding=utf-8 + setglobal fileencoding=utf-8 + "setglobal bomb + set fileencodings=ucs-bom,utf-8,latin1 +endif