Compare commits
2 Commits
b36c918621
...
10cbc455d0
Author | SHA1 | Date | |
---|---|---|---|
|
10cbc455d0 | ||
|
79b37243c3 |
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,5 @@
|
|||
vim/bundle/
|
||||
tags
|
||||
tags*
|
||||
vim/view
|
||||
.netrwhist
|
||||
chromedriver
|
||||
|
|
65
bash_aliases
65
bash_aliases
|
@ -1,65 +0,0 @@
|
|||
#!/usr/local/bin/zsh
|
||||
export EDITOR=nvim
|
||||
export VISUAL=nvim
|
||||
export PYENV_ROOT=/Users/tyrel/.pyenv
|
||||
# Aliases
|
||||
alias ag='\ag --pager="less"'
|
||||
alias c='\cat'
|
||||
alias cat='bat'
|
||||
alias cg='cd "$(git rev-parse --show-toplevel)"'
|
||||
alias ctags="`brew --prefix`/bin/ctags"
|
||||
alias dots="cd $(dirname `readlink ~/.vim`)"
|
||||
alias g='git'
|
||||
alias gp='git push -u'
|
||||
alias ppjson="python -m json.tool"
|
||||
alias shrug="echo -n '¯\_(ツ)_/¯' | pbcopy"
|
||||
alias httpie="http"
|
||||
alias fuckingip="curl https://wtfismyip.com/json"
|
||||
alias ls="exa -lhBgUm --git --time-style long-iso --icons"
|
||||
|
||||
# Functions
|
||||
function cpbr () {
|
||||
if branch=$(git symbolic-ref --short -q HEAD)
|
||||
then
|
||||
printf "$branch" | pbcopy
|
||||
osascript -e "display notification \"$branch copied to clipboard\" with title \"cpbr\""
|
||||
else
|
||||
echo "no branch, can't copy"
|
||||
fi
|
||||
}
|
||||
function hidden() { ls -a "$@" | grep '^\.'; }
|
||||
function h () {
|
||||
if [ -z "$*" ]
|
||||
then
|
||||
history
|
||||
else
|
||||
history | egrep "$@"
|
||||
fi
|
||||
}
|
||||
function pulldep() { git pull; bundle; bundle exec rake db:migrate; }
|
||||
|
||||
settitle () {
|
||||
echo -ne "\033]0;"$*"\007"
|
||||
}
|
||||
|
||||
|
||||
tide() {
|
||||
for var in "$@"
|
||||
do
|
||||
open -a iTerm ~/code/tidelift/$var
|
||||
settitle $var
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# options
|
||||
#export LESS=-RFX
|
||||
#export PAGER="less"
|
||||
|
||||
pullall (){
|
||||
for d in ./*/ ; do (cd "$d" && pwd && git pull); done
|
||||
}
|
||||
|
||||
new_dock_space (){
|
||||
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock
|
||||
}
|
14
bin/SC
14
bin/SC
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
FILENAME="/Users/tyrel/tmp/screenshot.png"
|
||||
screencapture -io $FILENAME
|
||||
|
||||
sleep 1
|
||||
|
||||
MD5=($(md5 -q "$FILENAME"))
|
||||
fname=$MD5.png
|
||||
scp -rp "$FILENAME" vps:/www/tyrelsouza.com/screenshots/$fname;
|
||||
osascript -e "display notification \"Uploaded $FILENAME to https://tyrelsouza.com/screenshots/$fname\" with title \"Tyrel Upload\""
|
||||
echo -ne https://tyrelsouza.com/screenshots/$fname | pbcopy
|
||||
rm "$FILENAME"
|
6
bin/emax
6
bin/emax
|
@ -1,2 +1,6 @@
|
|||
#!/bin/bash
|
||||
$(/Applications/Emacs.app/Contents/MacOS/Emacs "$@") &
|
||||
|
||||
APPS=/Applications
|
||||
if [ -d "$APPS" ]; then
|
||||
$(/Applications/Emacs.app/Contents/MacOS/Emacs "$@") &
|
||||
fi
|
||||
|
|
3
bin/goland.sh
Executable file
3
bin/goland.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
/bin/bash -l '/home/tyrel/src/GoLand-2019.3/bin/goland.sh' %f
|
BIN
bin/golangci-lint
Executable file
BIN
bin/golangci-lint
Executable file
Binary file not shown.
3
bin/killtransmission.sh
Executable file
3
bin/killtransmission.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
killall transmission-gtk
|
|
@ -1 +0,0 @@
|
|||
/Users/tyrel/.pre-commit-venv/bin/pre-commit
|
3
bin/pycharm.sh
Executable file
3
bin/pycharm.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
/bin/bash -l '/home/tyrel/src/pycharm-2017.3.7/bin/pycharm.sh' %f
|
3
bin/rubymine.sh
Executable file
3
bin/rubymine.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
/bin/bash -l '/home/tyrel/src/RubyMine-2019.3/bin/rubymine.sh' %f
|
103
bin/sc
Executable file
103
bin/sc
Executable file
|
@ -0,0 +1,103 @@
|
|||
#!/usr/bin/env bash
|
||||
# Take a screenshot of a selected area and upload it somewhere.
|
||||
#
|
||||
# Requires:
|
||||
# * scrot
|
||||
# * xclip
|
||||
|
||||
### CHANGE THESE FUNCTIONS:
|
||||
|
||||
upload() {
|
||||
# Given a filepath and a target name, upload the screenshot
|
||||
chmod +r "$1"
|
||||
scp "$1" "tyrelsouza.com:/www/tyrel.pw/s/$2"
|
||||
}
|
||||
|
||||
url() {
|
||||
# Given a target name, echo the expected URL of the uploaded screenshot
|
||||
echo "https://tyrel.pw/s/$1"
|
||||
}
|
||||
|
||||
### (End)
|
||||
|
||||
screenshot() {
|
||||
if $(which maim &> /dev/null); then
|
||||
maim -s $1 || return -1
|
||||
elif $(which scrot &> /dev/null); then
|
||||
scrot -s $1 || return -1
|
||||
elif $(which screencapture &> /dev/null); then
|
||||
screencapture -i $1 || return -1
|
||||
else
|
||||
echo "No screenshot utility found. Install scrot."
|
||||
return -1
|
||||
fi
|
||||
}
|
||||
|
||||
clipboard() {
|
||||
if $(which xclip &> /dev/null); then
|
||||
echo $1 | xclip -r -selection clipboard
|
||||
elif $(which pbcopy &> /dev/null); then
|
||||
echo $1 | pbcopy
|
||||
else
|
||||
echo "No clipboard utility found. Install xclip."
|
||||
return -1
|
||||
fi
|
||||
}
|
||||
|
||||
notify() {
|
||||
if $(which osascript &> /dev/null); then
|
||||
osascript -e "display notification \"$2\" with title \"$1\""
|
||||
elif $(which notify-send &> /dev/null); then
|
||||
notify-send "$1" "$2"
|
||||
else
|
||||
echo "Notification not supported, skipped: $1: $2"
|
||||
return -1
|
||||
fi
|
||||
}
|
||||
|
||||
fail() {
|
||||
echo "$2"
|
||||
exit $1
|
||||
}
|
||||
|
||||
# Fail early
|
||||
set -e
|
||||
|
||||
# If a path is given, use that instead of taking a screenshot
|
||||
target="$1"
|
||||
|
||||
name="$(date '+%d')"
|
||||
tmppath="$(mktemp -t ss.XXXX.png)" || fail 1 "failed to allocate a temporary file"
|
||||
|
||||
# Make it hard to guess
|
||||
random_string=$(head -c512 /dev/urandom | shasum | head -c4)
|
||||
|
||||
# Compose full filename
|
||||
filename="${name}_${random_string}.png"
|
||||
|
||||
if [[ "${target}" ]]; then
|
||||
cp -p "${target}" "${tmppath}"
|
||||
else
|
||||
# Take the screenshot
|
||||
screenshot "${tmppath}" || fail 2 "failed to take screenshot"
|
||||
fi
|
||||
|
||||
# Clear clipboard
|
||||
clipboard " "
|
||||
|
||||
# Upload it
|
||||
url=$(url "${filename}")
|
||||
echo "Uploading: $url"
|
||||
upload "${tmppath}" "${filename}" && rm "${tmppath}" || fail 3 "failed to upload ${tmppath}"
|
||||
|
||||
# Copy to clipboard
|
||||
clipboard "${url}"
|
||||
echo "Copied to clipboard."
|
||||
|
||||
# Clean up
|
||||
if [[ -f "${tmppath}" ]]; then
|
||||
rm "${tmppath}"
|
||||
fi
|
||||
|
||||
notify "Uploaded Screenshot" "${url}"
|
||||
|
103
bin/scf
Executable file
103
bin/scf
Executable file
|
@ -0,0 +1,103 @@
|
|||
#!/usr/bin/env bash
|
||||
# Take a screenshot of a selected area and upload it somewhere.
|
||||
#
|
||||
# Requires:
|
||||
# * scrot
|
||||
# * xclip
|
||||
|
||||
### CHANGE THESE FUNCTIONS:
|
||||
|
||||
upload() {
|
||||
# Given a filepath and a target name, upload the screenshot
|
||||
chmod +r "$1"
|
||||
scp "$1" "tyrelsouza.com:/www/tyrel.pw/s/$2"
|
||||
}
|
||||
|
||||
url() {
|
||||
# Given a target name, echo the expected URL of the uploaded screenshot
|
||||
echo "https://tyrel.pw/s/$1"
|
||||
}
|
||||
|
||||
### (End)
|
||||
|
||||
screenshot() {
|
||||
if $(which maim &> /dev/null); then
|
||||
maim $1 || return -1
|
||||
elif $(which scrot &> /dev/null); then
|
||||
scrot -s $1 || return -1
|
||||
elif $(which screencapture &> /dev/null); then
|
||||
screencapture -i $1 || return -1
|
||||
else
|
||||
echo "No screenshot utility found. Install scrot."
|
||||
return -1
|
||||
fi
|
||||
}
|
||||
|
||||
clipboard() {
|
||||
if $(which xclip &> /dev/null); then
|
||||
echo $1 | xclip -r -selection clipboard
|
||||
elif $(which pbcopy &> /dev/null); then
|
||||
echo $1 | pbcopy
|
||||
else
|
||||
echo "No clipboard utility found. Install xclip."
|
||||
return -1
|
||||
fi
|
||||
}
|
||||
|
||||
notify() {
|
||||
if $(which osascript &> /dev/null); then
|
||||
osascript -e "display notification \"$2\" with title \"$1\""
|
||||
elif $(which notify-send &> /dev/null); then
|
||||
notify-send "$1" "$2"
|
||||
else
|
||||
echo "Notification not supported, skipped: $1: $2"
|
||||
return -1
|
||||
fi
|
||||
}
|
||||
|
||||
fail() {
|
||||
echo "$2"
|
||||
exit $1
|
||||
}
|
||||
|
||||
# Fail early
|
||||
set -e
|
||||
|
||||
# If a path is given, use that instead of taking a screenshot
|
||||
target="$1"
|
||||
|
||||
name="$(date '+%d')"
|
||||
tmppath="$(mktemp -t ss.XXXX.png)" || fail 1 "failed to allocate a temporary file"
|
||||
|
||||
# Make it hard to guess
|
||||
random_string=$(head -c512 /dev/urandom | shasum | head -c4)
|
||||
|
||||
# Compose full filename
|
||||
filename="${name}_${random_string}.png"
|
||||
|
||||
if [[ "${target}" ]]; then
|
||||
cp -p "${target}" "${tmppath}"
|
||||
else
|
||||
# Take the screenshot
|
||||
screenshot "${tmppath}" || fail 2 "failed to take screenshot"
|
||||
fi
|
||||
|
||||
# Clear clipboard
|
||||
clipboard " "
|
||||
|
||||
# Upload it
|
||||
url=$(url "${filename}")
|
||||
echo "Uploading: $url"
|
||||
upload "${tmppath}" "${filename}" && rm "${tmppath}" || fail 3 "failed to upload ${tmppath}"
|
||||
|
||||
# Copy to clipboard
|
||||
clipboard "${url}"
|
||||
echo "Copied to clipboard."
|
||||
|
||||
# Clean up
|
||||
if [[ -f "${tmppath}" ]]; then
|
||||
rm "${tmppath}"
|
||||
fi
|
||||
|
||||
notify "Uploaded Screenshot" "${url}"
|
||||
|
4
bin/startup_i3.sh
Executable file
4
bin/startup_i3.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
xrandr --output DP-4 --right-of DP-2
|
||||
xrandr --output DP-4 --rotate left
|
||||
|
8
bin/update-neovim.sh
Executable file
8
bin/update-neovim.sh
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
sudo rm -rf /opt/nightlies/neovim
|
||||
git clone https://github.com/neovim/neovim /opt/nightlies/neovim
|
||||
cd /opt/nightlies/neovim
|
||||
git checkout stable
|
||||
make -j4
|
||||
sudo make install
|
13
bin/vimv
13
bin/vimv
|
@ -1,18 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
#!/bin/bash
|
||||
|
||||
# Lists the current directory's files in Vim, so you can edit it and save to rename them
|
||||
# USAGE: vimv [file1 file2]
|
||||
# https://github.com/thameera/vimv
|
||||
|
||||
declare -r FILENAMES_FILE=$(mktemp "${TMPDIR:-/tmp}/vimv.XXX")
|
||||
declare -r FILENAMES_FILE="$(mktemp --tmpdir vimv.XXX)"
|
||||
|
||||
trap '{ rm -f "${FILENAMES_FILE}" ; }' EXIT
|
||||
|
||||
if [ $# -ne 0 ]; then
|
||||
src=( "$@" )
|
||||
else
|
||||
IFS=$'\r\n' GLOBIGNORE='*' command eval 'src=($(ls))'
|
||||
IFS=$'\r\n' GLOBIGNORE='*' command eval 'src=($(ls))'
|
||||
fi
|
||||
|
||||
for ((i=0;i<${#src[@]};++i)); do
|
||||
|
@ -21,9 +20,9 @@ done
|
|||
|
||||
${EDITOR:-vi} "${FILENAMES_FILE}"
|
||||
|
||||
IFS=$'\r\n' GLOBIGNORE='*' command eval 'dest=($(cat "${FILENAMES_FILE}"))'
|
||||
IFS=$'\r\n' GLOBIGNORE='*' command eval 'dest=($(cat "${FILENAMES_FILE}"))'
|
||||
|
||||
declare -i count=0
|
||||
count=0
|
||||
for ((i=0;i<${#src[@]};++i)); do
|
||||
if [ "${src[i]}" != "${dest[i]}" ]; then
|
||||
mkdir -p "`dirname "${dest[i]}"`"
|
||||
|
@ -32,7 +31,7 @@ for ((i=0;i<${#src[@]};++i)); do
|
|||
else
|
||||
mv "${src[i]}" "${dest[i]}"
|
||||
fi
|
||||
((++count))
|
||||
((count++))
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fish
|
|||
SETUVAR _fisher_jorgebucaran_2F_hydro_files:\x7e/\x2econfig/fish/functions/fish_mode_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_prompt\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/hydro\x2efish
|
||||
SETUVAR _fisher_plugins:jorgebucaran/fisher\x1ejorgebucaran/hydro
|
||||
SETUVAR _fisher_upgraded_to_4_4:\x1d
|
||||
SETUVAR _hydro_git_42718:main\u2022\x20
|
||||
SETUVAR _hydro_git_69626:main\u2022\x20\u21911\x20
|
||||
SETUVAR _hydro_git_72501:main\u2022\x20\u21911\x20
|
||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
||||
SETUVAR fish_color_cancel:\x2dr
|
||||
SETUVAR fish_color_command:005fd7
|
||||
|
|
|
@ -56,6 +56,7 @@ set background=dark
|
|||
set autoindent
|
||||
set preserveindent
|
||||
set copyindent
|
||||
set mouse=
|
||||
|
||||
" Set Colors
|
||||
if (has("termguicolors"))
|
||||
|
|
116
emacs
116
emacs
|
@ -1,116 +0,0 @@
|
|||
(require 'package)
|
||||
|
||||
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
|
||||
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
|
||||
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
|
||||
|
||||
(setq package-enable-at-startup nil)
|
||||
(setq sml/theme 'light)
|
||||
(package-initialize)
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(custom-enabled-themes (quote (smart-mode-line-respectful)))
|
||||
'(custom-safe-themes
|
||||
(quote
|
||||
("8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "c74e83f8aa4c78a121b52146eadb792c9facc5b1f02c917e3dbb454fca931223" "a27c00821ccfd5a78b01e4f35dc056706dd9ede09a8b90c6955ae6a390eb1c1e" default)))
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(color-theme-solarized neotree smart-mode-line powerline use-package helm evil-visual-mark-mode))))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
)
|
||||
|
||||
;; Git interface
|
||||
(use-package magit)
|
||||
|
||||
;; VIM IN EMACS
|
||||
(use-package evil
|
||||
:ensure t
|
||||
:config
|
||||
(evil-mode 1)
|
||||
;; More configuration goes here
|
||||
)
|
||||
|
||||
; Solariazed Configurations
|
||||
(load-theme 'solarized t)
|
||||
(set-terminal-parameter nil 'background-mode 'dark)
|
||||
(add-hook 'after-make-frame-functions
|
||||
(lambda (frame)
|
||||
(let ((mode (if (display-graphic-p frame) 'light 'dark)))
|
||||
(set-frame-parameter frame 'background-mode mode)
|
||||
(set-terminal-parameter frame 'background-mode mode))
|
||||
(enable-theme 'solarized)))
|
||||
|
||||
; Mode Line configurations to make powerliner better
|
||||
(use-package smart-mode-line
|
||||
:ensure t
|
||||
:config
|
||||
(sml/setup)
|
||||
|
||||
;; Powerline
|
||||
(use-package powerline
|
||||
:ensure t
|
||||
:config
|
||||
(powerline-center-evil-theme)
|
||||
)
|
||||
;; Set Powerline Configuration
|
||||
(setq powerline-arrow-shape 'curve)
|
||||
(setq powerline-default-separator-dir '(right . left))
|
||||
)
|
||||
|
||||
; https://www.emacswiki.org/emacs/NeoTree
|
||||
(use-package neotree
|
||||
:ensure t
|
||||
:config
|
||||
(global-set-key [f8] 'neotree-toggle)
|
||||
(setq neo-smart-open t)
|
||||
)
|
||||
<<<<<<< HEAD
|
||||
;; Set Powerline Configuration
|
||||
(setq powerline-arrow-shape 'curve)
|
||||
(setq powerline-default-separator-dir '(right . left))
|
||||
|
||||
;; Projectile
|
||||
(add-hook 'python-mode-hook 'projectile-mode)
|
||||
|
||||
;; rebind neotree in evil-mode
|
||||
=======
|
||||
>>>>>>> 0c4d4a216c50c05346f138e4c5e8e73ac8f4c81a
|
||||
(evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter)
|
||||
(evil-define-key 'normal neotree-mode-map (kbd "SPC") 'neotree-enter)
|
||||
(evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide)
|
||||
(evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)
|
||||
|
||||
;; Jedi - Python autocomplete
|
||||
(add-hook 'python-mode-hook 'jedi:setup)
|
||||
(setq jedi:complete-on-dot t)
|
||||
(add-hook 'python-mode-hook 'jedi:setup)
|
||||
|
||||
;; Virtualenv stuff
|
||||
;; https://github.com/porterjamesj/virtualenvwrapper.el
|
||||
(require 'virtualenvwrapper)
|
||||
(venv-initialize-interactive-shells) ;; if you want interactive shell support
|
||||
(venv-initialize-eshell) ;; if you want eshell support
|
||||
|
||||
;; Projectile and Virtualenv
|
||||
(setq projectile-switch-project-action 'venv-projectile-auto-workon)
|
||||
(setq venv-dirlookup-names '(".venv" "pyenv" ".virtual"))
|
||||
|
||||
;; keybindings
|
||||
;; Magit!
|
||||
(global-set-key (kbd "C-x g") 'magit-status)
|
||||
;; buffer list
|
||||
(global-set-key (kbd "C-x C-l") 'list-buffers)
|
||||
(set-terminal-parameter nil 'background-mode 'dark)
|
||||
(add-hook 'after-make-frame-functions
|
||||
(lambda (frame)
|
||||
(let ((mode (if (display-graphic-p frame) 'light 'dark)))
|
||||
(set-frame-parameter frame 'background-mode mode)
|
||||
(set-terminal-parameter frame 'background-mode mode))
|
||||
(enable-theme 'solarized-dark)))
|
|
@ -5,3 +5,12 @@ function pulldep() {
|
|||
bundle
|
||||
bundle exec rake db:migrate
|
||||
}
|
||||
|
||||
function tide() {
|
||||
for var in "$@"
|
||||
do
|
||||
open -a iTerm ~/code/tidelift/$var
|
||||
settitle $var
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
@ -3,19 +3,13 @@ set -x EDITOR nvim
|
|||
set -x VISUAL nvim
|
||||
|
||||
# Aliases
|
||||
alias ag='\ag --pager="less -r"'
|
||||
alias c='\cat'
|
||||
#alias ag='ag --pager="less -r"'
|
||||
alias cat='bat'
|
||||
alias cg='cd "(git rev-parse --show-toplevel)"'
|
||||
alias dots='cd ~/code/dotfiles/'
|
||||
alias fuckingip="curl https://wtfismyip.com/json"
|
||||
alias g='git'
|
||||
alias gp='git push -u'
|
||||
alias httpie="http"
|
||||
alias ls="exa -lhFgxUm --git --time-style long-iso --group-directories-first"
|
||||
alias pg='pushd "(git rev-parse --show-toplevel)"'
|
||||
alias ppjson="python -m json.tool"
|
||||
alias shrug="echo -n '¯\_(ツ)_/¯' | pbcopy"
|
||||
alias vimini="vim ~/.config/nvim/init.vim"
|
||||
alias vim=nvim
|
||||
|
||||
|
@ -24,6 +18,11 @@ function httpdiff
|
|||
diff --color -r -c <(curl -s "$1" 2>&1) <(curl -s "$2" 2>&1)
|
||||
end
|
||||
|
||||
function cg
|
||||
set _dir_ (git rev-parse --show-toplevel)
|
||||
cd $_dir_
|
||||
end
|
||||
|
||||
function cpbr
|
||||
set branch (git symbolic-ref --short -q HEAD)
|
||||
if test branch
|
||||
|
|
156
tyrel.zsh-theme
156
tyrel.zsh-theme
|
@ -1,156 +0,0 @@
|
|||
# ported from https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/jonathan.zsh-theme
|
||||
function virtualenv_info {
|
||||
[ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`')'
|
||||
}
|
||||
|
||||
function theme_precmd {
|
||||
local TERMWIDTH
|
||||
(( TERMWIDTH = ${COLUMNS} - 1 ))
|
||||
|
||||
|
||||
###
|
||||
# Truncate the path if it's too long.
|
||||
|
||||
PR_FILLBAR=""
|
||||
PR_PWDLEN=""
|
||||
|
||||
local promptsize=${#${(%):---(%n@%m:%l)---()--}}
|
||||
local pythonprompt=`virtualenv_info`
|
||||
local pythonpromptsize=${#${pythonprompt}}
|
||||
local pwdsize=${#${(%):-%~}}
|
||||
|
||||
if [[ "$promptsize + $pythonpromptsize + $pwdsize" -gt $TERMWIDTH ]]; then
|
||||
((PR_PWDLEN=$TERMWIDTH - $promptsize))
|
||||
else
|
||||
PR_FILLBAR="\${(l.(($TERMWIDTH - ($promptsize + $pythonpromptsize + $pwdsize)))..${PR_HBAR}.)}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
setopt extended_glob
|
||||
theme_preexec () {
|
||||
if [[ "$TERM" == "screen" ]]; then
|
||||
local CMD=${1[(wr)^(*=*|sudo|-*)]}
|
||||
echo -n "\ek$CMD\e\\"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
setprompt () {
|
||||
###
|
||||
# Need this so the prompt will work.
|
||||
|
||||
setopt prompt_subst
|
||||
|
||||
|
||||
###
|
||||
# See if we can use colors.
|
||||
|
||||
autoload zsh/terminfo
|
||||
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
|
||||
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
|
||||
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
|
||||
(( count = $count + 1 ))
|
||||
done
|
||||
PR_NO_COLOUR="%{$terminfo[sgr0]%}"
|
||||
|
||||
###
|
||||
# Modify Git prompt
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[green]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
|
||||
|
||||
###
|
||||
# See if we can use extended characters to look nicer.
|
||||
# UTF-8 Fixed
|
||||
|
||||
if [[ $(locale charmap) == "UTF-8" ]]; then
|
||||
PR_SET_CHARSET=""
|
||||
PR_SHIFT_IN=""
|
||||
PR_SHIFT_OUT=""
|
||||
PR_HBAR="─"
|
||||
PR_ULCORNER="┌"
|
||||
PR_LLCORNER="└"
|
||||
PR_LRCORNER="┘"
|
||||
PR_URCORNER="┐"
|
||||
else
|
||||
typeset -A altchar
|
||||
set -A altchar ${(s..)terminfo[acsc]}
|
||||
# Some stuff to help us draw nice lines
|
||||
PR_SET_CHARSET="%{$terminfo[enacs]%}"
|
||||
PR_SHIFT_IN="%{$terminfo[smacs]%}"
|
||||
PR_SHIFT_OUT="%{$terminfo[rmacs]%}"
|
||||
PR_HBAR='$PR_SHIFT_IN${altchar[q]:--}$PR_SHIFT_OUT'
|
||||
PR_ULCORNER='$PR_SHIFT_IN${altchar[l]:--}$PR_SHIFT_OUT'
|
||||
PR_LLCORNER='$PR_SHIFT_IN${altchar[m]:--}$PR_SHIFT_OUT'
|
||||
PR_LRCORNER='$PR_SHIFT_IN${altchar[j]:--}$PR_SHIFT_OUT'
|
||||
PR_URCORNER='$PR_SHIFT_IN${altchar[k]:--}$PR_SHIFT_OUT'
|
||||
fi
|
||||
|
||||
|
||||
###
|
||||
# Decide if we need to set titlebar text.
|
||||
|
||||
case $TERM in
|
||||
xterm*)
|
||||
PR_TITLEBAR=$'%{\e]0;%(!.-=*[ROOT]*=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\a%}'
|
||||
;;
|
||||
screen)
|
||||
PR_TITLEBAR=$'%{\e_screen \005 (\005t) | %(!.-=[ROOT]=- | .)%n@%m:%~ | ${COLUMNS}x${LINES} | %y\e\\%}'
|
||||
;;
|
||||
*)
|
||||
PR_TITLEBAR=''
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
###
|
||||
# Decide whether to set a screen title
|
||||
if [[ "$TERM" == "screen" ]]; then
|
||||
PR_STITLE=$'%{\ekzsh\e\\%}'
|
||||
else
|
||||
PR_STITLE=''
|
||||
fi
|
||||
|
||||
|
||||
###
|
||||
# Finally, the prompt.
|
||||
|
||||
PROMPT='$PR_SET_CHARSET$PR_STITLE${(e)PR_TITLEBAR}\
|
||||
$PR_CYAN$PR_ULCORNER$PR_HBAR$PR_GREY(\
|
||||
$PR_GREEN%$PR_PWDLEN<...<%~%<<\
|
||||
$PR_GREY)`virtualenv_info`$PR_CYAN$PR_HBAR$PR_HBAR${(e)PR_FILLBAR}$PR_HBAR$PR_GREY(\
|
||||
$PR_CYAN%(!.%SROOT%s.%n)$PR_GREY@$PR_GREEN%m:%l\
|
||||
$PR_GREY)$PR_CYAN$PR_HBAR$PR_URCORNER\
|
||||
|
||||
$PR_CYAN$PR_LLCORNER$PR_BLUE$PR_HBAR(\
|
||||
$PR_YELLOW%D{%H:%M:%S}\
|
||||
$PR_LIGHT_BLUE%{$reset_color%}`git_prompt_info``git_prompt_status`$PR_BLUE)$PR_CYAN$PR_HBAR\
|
||||
$PR_HBAR\
|
||||
>$PR_NO_COLOUR '
|
||||
|
||||
# display exitcode on the right when >0
|
||||
return_code="%(?..%{$fg[red]%}%? ↵ %{$reset_color%})"
|
||||
RPROMPT=' $return_code$PR_CYAN$PR_HBAR$PR_BLUE$PR_HBAR\
|
||||
($PR_YELLOW%D{%a,%b%d}$PR_BLUE)$PR_HBAR$PR_CYAN$PR_LRCORNER$PR_NO_COLOUR'
|
||||
|
||||
PS2='$PR_CYAN$PR_HBAR\
|
||||
$PR_BLUE$PR_HBAR(\
|
||||
$PR_LIGHT_GREEN%_$PR_BLUE)$PR_HBAR\
|
||||
$PR_CYAN$PR_HBAR$PR_NO_COLOUR '
|
||||
}
|
||||
|
||||
setprompt
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook precmd theme_precmd
|
||||
add-zsh-hook preexec theme_preexec
|
Loading…
Reference in New Issue
Block a user