tmux fzf and 1password

This commit is contained in:
Noah Masur 2020-07-30 21:12:17 -04:00
parent 191a29079c
commit 3949f763f4
13 changed files with 105 additions and 20 deletions

View File

@ -366,7 +366,7 @@ shell:
args:
- --login
- --init-command
- tmux a -t noah || tmux new -s noah
- tmux a -t noah || eval (security find-generic-password -s 1Password -w | op signin enterprise_console) && tmux new -s noah
# Startup directory
#

View File

@ -27,13 +27,15 @@ if status --is-interactive
# Colors
theme_gruvbox
# Aliases
aliases
# Individual features
aliases
pyenv
notes
aws
mactools
# Fuzzy finder
fzf_key_bindings
# Use `starship` prompt
starship init fish | source

View File

@ -9,7 +9,9 @@ SETUVAR _fish_abbr_cat:bat
SETUVAR _fish_abbr_d:deactivate
SETUVAR _fish_abbr_db:docker\x20build\x20\x2e\x20\x2dt
SETUVAR _fish_abbr_dc:\x24DOTS/bin/docker_cleanup
SETUVAR _fish_abbr_dr:docker\x20run
SETUVAR _fish_abbr_de:docker\x20exec\x20\x2dit
SETUVAR _fish_abbr_dr:docker\x20run\x20\x2d\x2drm\x20\x2dit
SETUVAR _fish_abbr_ds:docker\x20ps\x20\x2da
SETUVAR _fish_abbr_falias:vim\x20\x24HOME/\x2econfig/fish/functions/aliases\x2efish
SETUVAR _fish_abbr_fishal:vim\x20\x24HOME/\x2econfig/fish/functions/aliases\x2efish
SETUVAR _fish_abbr_fishrc:vim\x20\x24HOME/\x2econfig/fish/config\x2efish
@ -18,6 +20,7 @@ SETUVAR _fish_abbr_g:git
SETUVAR _fish_abbr_ga:git\x20add\x20\x2dA
SETUVAR _fish_abbr_gc:git\x20commit\x20\x2dm
SETUVAR _fish_abbr_gd:git\x20diff
SETUVAR _fish_abbr_get_2D_fingerprint:ssh\x2dkeyscan\x20myhost\x2ecom\x20\x7c\x20ssh\x2dkeygen\x20\x2dlf\x20\x2d
SETUVAR _fish_abbr_gp:git\x20push
SETUVAR _fish_abbr_gs:git\x20status
SETUVAR _fish_abbr_gu:git\x20pull
@ -30,6 +33,7 @@ SETUVAR _fish_abbr_ll:ls\x20\x2dalhF
SETUVAR _fish_abbr_misty:cd\x20\x24PROJ/misty
SETUVAR _fish_abbr_oldcat:cat
SETUVAR _fish_abbr_p:python
SETUVAR _fish_abbr_public_2D_key:ssh\x2dkeygen\x20\x2dy\x20\x2df\x20\x7e/\x2essh/id_rsa\x20\x3e\x20\x7e/\x2essh/id_rsa\x2epub
SETUVAR _fish_abbr_py:python
SETUVAR _fish_abbr_runbootstrap:\x24DOTS/scripts/bootstrap
SETUVAR _fish_abbr_sshc:vim\x20\x7e/\x2essh/config
@ -64,3 +68,4 @@ SETUVAR fish_pager_color_completion:normal
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_user_paths:/usr/local/opt/fzf/bin

View File

@ -49,11 +49,15 @@ function aliases --description 'All aliases'
alias proj='cd $PROJ'
abbr -a ssl 'openssl req -new -newkey rsa:2048 -nodes' \
'-keyout server.key -out server.csr'
abbr -a get-fingerprint 'ssh-keyscan myhost.com | ssh-keygen -lf -'
abbr -a public-key 'ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub'
# Docker
abbr -a dc '$DOTS/bin/docker_cleanup'
abbr -a dr 'docker run'
abbr -a dr 'docker run --rm -it'
abbr -a db 'docker build . -t'
abbr -a ds 'docker ps -a'
abbr -a de 'docker exec -it'
alias connect='docker run --rm -v ~/.aws:/root/.aws -v ~/.ssh:/root/.ssh -it connect-aws'
# Terraform

View File

@ -0,0 +1 @@
/usr/local/opt/fzf/shell/key-bindings.fish

View File

@ -0,0 +1,7 @@
#!/usr/local/bin/fish
function mactools
function copy --description 'Copy file contents into clipboard'
cat $argv | pbcopy
end
end

View File

@ -13,6 +13,16 @@ function 'pyenv' --description 'Features for Pyenv virtualenvs'
source ~/.pyenv/versions/$argv[1]/bin/activate.fish
end
# vers - switch to pyenv virtualenv with fuzzy menu
function 'vers' --description 'Switch to virtualenv'
set pyversion (bash -c "pyenv versions --bare --skip-aliases" | fzf)
if test $status -ne 0
return 1
else
source "$PYENV_VERSIONS_DIR/$pyversion/bin/activate.fish"
end
end
function 'ipy' --description 'Borrow iPython interpreter'
set STORED_VENV $VIRTUAL_ENV
source $PYENV_VERSIONS_DIR/ipython/bin/activate.fish; and \

View File

@ -6,7 +6,8 @@ cask "google-chrome"
# Work Programs
cask "slack"
cask "zoomus"
cask "onepassword"
cask "1password"
cask "1password-cli"
cask "dropbox"
# Fonts

View File

@ -66,6 +66,31 @@ install_brews() {
echo "brews installed ✓"
}
use_fish_shell() {
if ! (which fish > /dev/null)
then
echo "Install fish before continuing"
echo "You can do: brew install fish"
echo "Or add fish to homebrew/Brewfile and rerun"
exit 1
fi
FISH_SHELL=$(which fish)
if ! (cat /etc/shells | grep $FISH_SHELL > /dev/null)
then
echo "Modifying /etc/shells"
echo "Requires sudo password"
sudo echo $FISH_SHELL >> /etc/shells
fi
if ! (echo "$SHELL" | grep fish > /dev/null)
then
echo "Changing default shell to fish"
echo "Requires sudo password"
sudo chsh -s $FISH_SHELL
fi
echo "fish ✓"
}
setup_tmux() {
if [[ ! -d ~/.tmux/plugins/tpm ]]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
@ -74,6 +99,22 @@ setup_tmux() {
echo "tmux ✓"
}
install_gitmux() {
if ! (which gitmux > /dev/null)
then
printf "gitmux ✕\n\n"
printf "\ninstalling gitmux..."
/bin/bash -c "$(curl -L -o gitmux.tar.gz https://github.com/arl/gitmux/releases/download/v0.6.0/gitmux_0.6.0_macOS_amd64.tar.gz)"
tar -xzf gitmux.tar.gz gitmux
mkdir -p ~/.local/bin
mv gitmux ~/.local/bin/
rm gitmux.tar.gz
echo ""
fi
echo "gitmux ✓"
}
install_spacemacs() {
emacsdir=~/.emacs.d
if ! (git -C "$emacsdir" pull > /dev/null 2>&1)
@ -85,13 +126,15 @@ install_spacemacs() {
}
printf "\nbootstrapping...\n\n"
check_for_zsh
check_for_ohmyzsh
#check_for_zsh
#check_for_ohmyzsh
install_xcode
install_homebrew
install_brews
setup_tmux
install_gitmux
install_spacemacs
use_fish_shell
("$DOTS/scripts/setup_symlinks")
echo ""

View File

@ -1,3 +1,5 @@
#!/bin/sh
install_casks() {
brewfile=$DOTS/homebrew/Caskfile
if ! (/usr/local/bin/brew bundle check --file "$brewfile" > /dev/null)

View File

@ -1,6 +1,6 @@
# Don't print a new line at the start of the prompt
add_newline = false
prompt_order = ["directory", "git_branch", "python", "git_status", "character"]
prompt_order = ["directory", "custom.virtualenv", "character"]
# Replace the "" symbol in the prompt with "➜"
[character] # The name of the module we are configuring is "character"
@ -21,3 +21,9 @@ suffix = ""
[python]
symbol = ""
[custom.virtualenv]
command = "echo (basename $VIRTUAL_ENV)" # shows output of command
prefix = "("
suffix = ") "
when = "true"

View File

@ -9,7 +9,7 @@ tmux:
modified: '~'
untracked: '✚'
stashed: '⚑ '
clean: ''
clean: ''
styles:
state: '#[fg=red,bold]'
branch: '#[fg=red,bold]'
@ -19,5 +19,5 @@ tmux:
modified: '#[fg=colour239,bold]'
untracked: '#[fg=colour239,bold]'
stashed: '#[fg=colour239,bold]'
clean: '#[fg=green,bold]'
layout: [remote, ' ', flags, ' ']
clean: '#[fg=colour241,bold]'
layout: [' ', remote, ' ', flags, ' |']

View File

@ -1,8 +1,3 @@
# Remap prefix to Control + space
#unbind C-b
#set -g prefix C-space
#bind C-space send-prefix
# Keep plenty of history for scrollback
set -g history-limit 100000
@ -37,7 +32,7 @@ bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
set -g mouse on
# Status bar
set -g status-interval 10 # Seconds between refreshes
set -g status-interval 60 # Seconds between refreshes
set -g renumber-windows on
set-option -g base-index 1 # Set 1 for first window (easier to type)
set-window-option -g pane-base-index 1 # Set 1 for first pane (easier to type)
@ -88,8 +83,17 @@ set-option -g status-right-style none
set-option -g status-right-length "80"
set-window-option -g window-status-separator ""
WEATHER='#(curl -s wttr.in/\?format\="%%c%%t")'
set-option -g status-left "#[fg=colour248, bg=colour241] #S #[fg=colour241, bg=colour237, nobold, noitalics, nounderscore]"
set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246,bg=colour239] %Y-%m-%d  %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour237, bg=colour248] #(gitmux -cfg .gitmux.conf '#{pane_current_path}')"
set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246,bg=colour239] %Y-%m-%d  %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour237, bg=colour248]#(gitmux -cfg .gitmux.conf '#{pane_current_path}') #[fg=colour237, nobold, bg=colour248]$WEATHER #[fg=colour237] "
set-window-option -g window-status-current-format "#[fg=colour237, bg=colour214, nobold, noitalics, nounderscore]#[fg=colour239, bg=colour214] #I #[fg=colour239, bg=colour214, bold] #W #[fg=colour214, bg=colour237, nobold, noitalics, nounderscore]"
set-window-option -g window-status-format "#[fg=colour237,bg=colour239,noitalics]#[fg=colour223,bg=colour239] #I #[fg=colour223, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'yardnsm/tmux-1password'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'