Skip to content

Commit

Permalink
Merge pull request #69 from TechDufus/fzf_tmux_fixes
Browse files Browse the repository at this point in the history
Adding support for latest fzf with tmux.
  • Loading branch information
TechDufus authored Dec 12, 2023
2 parents b71ec16 + 354da06 commit 6be6e10
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 20 deletions.
6 changes: 2 additions & 4 deletions roles/bash/files/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,8 @@ for file in $HOME/.config/bash/*.sh; do
source "$file"
done

if [[ -f "$HOME/.bash_lumen" ]]; then
source "$HOME/.bash_lumen"
fi

[ -f ~/.bash_lumen] && source ~/.bash_lumen
[ -f ~/.fzf.bash ] && source ~/.fzf.bash

toilet "TechDufus" -F border:gay -f emboss2

15 changes: 15 additions & 0 deletions roles/bash/files/bash/k8s_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ function k.node.debug() {
kubectl debug node/$1 -qit --image=mcr.microsoft.com/dotnet/runtime-deps:6.0 --target $1 -- chroot /host bash
}

function k.togglePromptInfo() {
# create export if not exists
if [ -z "$SHOW_K8S_PROMPT_INFO" ]; then
export SHOW_K8S_PROMPT_INFO="false"
return
elif [ "$SHOW_K8S_PROMPT_INFO" == "true" ]; then
export SHOW_K8S_PROMPT_INFO="false"
return
elif [ "$SHOW_K8S_PROMPT_INFO" == "false" ]; then
export SHOW_K8S_PROMPT_INFO="true"
return
fi
}


complete -o nospace -F __kc_complete kc
complete -o nospace -F __kgnonly_complete k.node.debug k.node.exec

2 changes: 0 additions & 2 deletions roles/bash/files/bash/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ BOOK="${RED}\xF0\x9F\x93\x8B${NC}"
HOT="${ORANGE}\xF0\x9F\x94\xA5${NC}"
WARNING="${RED}\xF0\x9F\x9A\xA8${NC}"
RIGHT_ANGLE="${GREEN}\xE2\x88\x9F${NC}"


16 changes: 16 additions & 0 deletions roles/bash/files/themes/axin/axin.theme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,23 @@ else
RESET="\033[m"
fi

function k.togglePromptInfo() {
if [ "$SHOW_K8S_PROMPT_INFO" == "true" ]; then
echo -e "${ARROW} ${YELLOW}SHOW_K8S_PROMPT_INFO is set to true, setting to false${NC}"
export SHOW_K8S_PROMPT_INFO="false"
return
elif [ "$SHOW_K8S_PROMPT_INFO" == "false" ]; then
echo -e "${ARROW} ${YELLOW}SHOW_K8S_PROMPT_INFO is set to false, setting to true${NC}"
export SHOW_K8S_PROMPT_INFO="true"
return
fi
}

function k8s_info() {
# Only show k8s info in prompt if it is enabled
if [[ "$SHOW_K8S_PROMPT_INFO" == "false" ]]; then
return
fi
local k8s_data="$(kubectl config view --minify --output 'jsonpath={..namespace}@{.current-context}' 2> /dev/null)"
if [[ "$k8s_data" != "" ]]; then
echo "[$k8s_data]"
Expand Down
9 changes: 0 additions & 9 deletions roles/bash/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,3 @@
create: true
mode: "0600"
state: present

- name: Bash | Install profile dependencies
ansible.builtin.apt:
name: "{{ item }}"
state: present
update_cache: true
become: true
loop:
- fzf
12 changes: 12 additions & 0 deletions roles/fzf/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Cleanup fzf downloaded tar
ansible.builtin.file:
path: "/tmp/{{ fzf_file }}.tar.gz"
state: absent
become: true

- name: Remove extracted fzf directory
ansible.builtin.file:
path: /tmp/fzf
state: absent
become: true
4 changes: 4 additions & 0 deletions roles/fzf/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- name: Run Ubuntu Tasks
ansible.builtin.import_tasks: ubuntu.yml
when: ansible_os_family == 'Debian'
109 changes: 109 additions & 0 deletions roles/fzf/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
# - name: "FZF | Download Latest Version JSON"
# ansible.builtin.uri:
# url: https://api.github.com/repos/junegunn/fzf/releases/latest
# register: fzf_latest_version_json
# changed_when: false
#
# - name: "FZF | Registering fzf Latest Release"
# ansible.builtin.set_fact:
# fzf_latest_release: "{{ fzf_latest_version_json.json.tag_name }}"
#
# - name: "FZF | Registering fzf Latest Version"
# ansible.builtin.set_fact:
# fzf_latest_version: "{{ fzf_latest_release.stdout | default('') }}"
#
# - name: "FZF | Getting version information"
# ansible.builtin.shell:
# cmd: |
# /usr/local/bin/fzf version -s | grep -o 'v[0-9]*\.[0-9]*\.[0-9]*'
# register: current_fzf_version
# changed_when: false
# failed_when: false
#
# - name: "FZF | Show current_fzf_version debug"
# ansible.builtin.debug:
# var: current_fzf_version.stdout
#
# - name: "FZF | Show fzf_latest_release debug"
# ansible.builtin.debug:
# var: fzf_latest_release
#
# - name: "FZF | Install"
# when: fzf_latest_release not in current_fzf_version.stdout|default('')
# block:
# - name: "FZF | Define fzfarch"
# ansible.builtin.set_fact:
# fzfarch: "{{ ansible_machine | replace('x86_64', 'amd64') | replace('aarch64', 'arm64') }}"
#
# - name: "FZF | Define fzfos"
# ansible.builtin.set_fact:
# fzfos: "{{ ansible_system | lower }}"
#
# - name: "FZF | Debug fzfarch"
# ansible.builtin.debug:
# var: fzfarch
#
# - name: "FZF | Debug fzfos"
# ansible.builtin.debug:
# var: fzfos
#
# - name: "FZF | Define fzf_file"
# ansible.builtin.set_fact:
# fzf_file: "fzf-{{ fzf_latest_release }}-{{ fzfos }}_{{ fzfarch }}"
#
# - name: "FZF | Ensure clean download destination"
# ansible.builtin.file:
# path: "/tmp/{{ fzf_file }}.tar.gz"
# state: absent
# become: true
#
# - name: "FZF | Downloading fzf Release"
# ansible.builtin.get_url:
# url: "https://github.com/junegunn/fzf/releases/download/{{ fzf_latest_release }}/{{ fzf_file }}.tar.gz"
# dest: /tmp/
# mode: "0644"
# force: true
# notify:
# - Cleanup fzf downloaded tar
#
# - name: "FZF | Ensure clean extraction destination"
# ansible.builtin.file:
# path: "/tmp/fzf"
# state: absent
# become: true
#
# - name: "FZF | Extract fzf tar file"
# ansible.builtin.unarchive:
# src: "/tmp/{{ fzf_file }}.tar.gz"
# dest: /tmp
#
# - name: "FZF | Remove any current fzf installations"
# ansible.builtin.file:
# path: /usr/local/bin/fzf
# state: absent
# become: true
#
# - name: "FZF | Install fzf"
# ansible.builtin.copy:
# remote_src: true
# src: /tmp/fzf
# dest: /usr/local/bin/
# owner: "{{ host_user }}"
# group: "{{ host_user }}"
# force: true
# mode: "0755"
# become: true
# notify:
# - Remove extracted fzf directory

- name: "FZF | Clone Latest Version"
ansible.builtin.git:
repo: https://github.com/junegunn/fzf.git
depth: 1
dest: "{{ ansible_user_dir }}/.fzf"
register: fzf_git_clone

- name: "FZF | Install"
when: fzf_git_clone.changed
shell: "{{ ansible_user_dir }}/.fzf/install --all --no-update-rc --no-zsh --no-fish"
1 change: 1 addition & 0 deletions roles/system/tasks/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
ansible.builtin.apt:
update_cache: true
upgrade: "yes"
state: latest
autoremove: true
autoclean: true
become: true
Expand Down
7 changes: 2 additions & 5 deletions roles/tmux/files/tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set-option -sa terminal-overrides ",xterm*:Tc"
set -g default-terminal "screen-256color"
set -g terminal-overrides ',xterm-256color:RGB'
set -g mouse on
set -sg escape-time 50
set -sg escape-time 0
set -g base-index 1 # Start indexing windows at 1 instead of 0
set -g pane-base-index 1 # Same for panes
setw -g pane-base-index 1 # Same for panes
Expand Down Expand Up @@ -39,9 +39,7 @@ set -g @plugin 'wfxr/tmux-fzf-url'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'catppuccin/tmux'
set -g @plugin 'omerxx/tmux-sessionx'
# set -g @catppuccin_date_time "%Y-%m-%d %H:%M:%S CST"
# set -g @catppuccin_prepend 'TESTING'
# set -g @plugin 'olimorris/tmux-pomodoro-plus'
set -g @catppuccin_date_time "%H:%M:%S CST %m-%d-%Y"

set -g @sessionx-bind 'o'
set -g @continuum-restore 'on'
Expand All @@ -62,7 +60,6 @@ set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no"
set -g @catppuccin_directory_text "#{pane_current_path}"
set -g @catppuccin_meetings_text "#($HOME/.config/tmux/scripts/cal.sh)"
set -g @catppuccin_date_time_text "%H:%M"

run -b '~/.tmux/plugins/tpm/tpm'

0 comments on commit 6be6e10

Please sign in to comment.