diff --git a/.bashrc b/.bashrc index c6d1d4b..a2d635b 100644 --- a/.bashrc +++ b/.bashrc @@ -1,11 +1,56 @@ #!/bin/bash -#set -o vi -#bind -m vi-insert "\C-l":clear-screen +export PATH=~/go/bin:/snap/bin:/usr/sandbox/:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/usr/share/games:/usr/local/sbin:/usr/sbin:/sbin:$PATH + +set -o vi +bind -m vi-insert "\C-l":clear-screen + +shopt -s extglob HISTSIZE= HISTFILESIZE= +export EDITOR='nvim' + +export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers" +export GIT_AUTHOR_EMAIL="tovi@tovijaeschke.xyz" +export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers" +export GIT_COMMITTER_EMAIL="tovi@tovijaeschke.xyz" + +export LESS='-R' +export LESSOPEN='|~/.lessfilter %s' + +alias ls="ls --color=auto" \ + vb='nvim ~/.bashrc && source ~/.bashrc' \ + va='nvim ~/.config/aliasrc && source ~/.bashrc' + +if [[ $(uname) != "Linux" ]]; then + + test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" || true + + export HOMEBREW_NO_INSTALL_CLEANUP=1 + + export GIT_AUTHOR_EMAIL="tovi.jaeschke-rogers@thirty4.com" + export GIT_COMMITTER_EMAIL="tovi.jaeschke-rogers@thirty4.com" + + alias ls="ls -G" \ + vb='nvim ~/.bash_profile && source ~/.bash_profile' \ + va='nvim ~/.config/aliasrc && source ~/.bash_profile' + + mount-hdd() { + if [ -z $1 ]; then + sudo umount /dev/disk2s1 && sudo /usr/local/bin/ntfs-3g /dev/disk2s1 /Volumes/NTFS -olocal -oallow_other + else + sudo umount /dev/$1 && sudo /usr/local/bin/ntfs-3g /dev/$1 /Volumes/NTFS -olocal -oallow_other + fi + } +else + + aupdate() { + sudo "apt update && apt upgrade" + } + +fi # set PATH so it includes user's private bin if it exists if [ -d "$HOME/.local/bin" ] ; then @@ -14,12 +59,11 @@ fi source ~/.config/aliasrc - parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' } -export PS1="\[\033[0;35m\]\u\[\033[0;32m\]@\[\033[0;34m\]\h \[\033[32m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[31m\] \n$\[\033[00m\] " +export PS1=" \[\033[0;36m\]\t \[\033[0;35m\]\u\[\033[0;32m\]@\[\033[0;34m\]\h \[\033[32m\]\W\[\033[33m\]\$(parse_git_branch)\[\033[31m\] \n$\[\033[00m\] " mkcd() { if [ ! -d "$1" ]; then @@ -44,10 +88,12 @@ git() { fi } +# git branch -vv | grep 'gone\]' | awk ' { print $1 }' | xargs -p git branch -d git-prune() { - if [[ $@ == "prune" ]]; then + if [[ $@ == "--apply" ]]; then command git branch --merged develop | grep -vEw "develop$|master$" | xargs git branch -d else + echo "Run \"git prune --apply\" to delete the following branches:" command git branch --merged develop | grep -vEw "develop$|master$" fi } @@ -60,28 +106,11 @@ color-diff() { diff -bur $1 $2 | colordiff | less } -export EDITOR='nvim' - -shopt -s extglob - -export GIT_AUTHOR_NAME="Tovi Jaeschke-Rogers" -export GIT_AUTHOR_EMAIL="tovi.jaeschke-rogers@thirty4.com" -export GIT_COMMITTER_NAME="Tovi Jaeschke-Rogers" -export GIT_COMMITTER_EMAIL="tovi.jaeschke-rogers@thirty4.com" - - export NVM_DIR="$HOME/.nvm" +export NVM_DIR="$HOME/.nvm" [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" -eval $(thefuck --alias) - -test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash" || true [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" - -export LESS='-R' -export LESSOPEN='|~/.lessfilter %s' - -export TMPDIR=/tmp diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 7452ba3..7cba456 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -25,6 +25,8 @@ Plug 'tpope/vim-fugitive' Plug 'rbong/vim-flog' Plug 'ap/vim-css-color' Plug 'justinmk/vim-sneak' +Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } +Plug 'darrikonn/vim-gofmt', { 'do': ':GoUpdateBinaries' } call plug#end() " Some basics: @@ -35,6 +37,7 @@ call plug#end() set incsearch set ignorecase set smartcase + set linebreak set noswapfile set nobackup @@ -93,6 +96,8 @@ call plug#end() nnoremap :GFiles nnoremap :Files + let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.5, 'highlight': 'Comment' } } + " php-doc-modded nnoremap :call PhpDocSingle()i "nnoremap :call PhpDocSingle() @@ -122,10 +127,10 @@ call plug#end() set splitbelow splitright " Shortcutting split navigation, saving a keypress: - " nnoremap h - " nnoremap j - " nnoremap k - " nnoremap l + nnoremap h + nnoremap j + nnoremap k + nnoremap l " Check file in shellcheck: map s :!clear && shellcheck % diff --git a/.local/bin/remap-keys b/.local/bin/remap-keys new file mode 100755 index 0000000..e8cdc5f --- /dev/null +++ b/.local/bin/remap-keys @@ -0,0 +1,7 @@ +#!/bin/sh +xmodmap -e 'clear Lock' & +xmodmap -e 'keycode 135 = Super_R' & +xmodmap -e 'keycode 66 = Escape' & +xmodmap -e 'keycode 9 = Caps_Lock' & + +