This commit is contained in:
DeveloperDurp 2024-08-13 06:21:36 -05:00
parent 081002382a
commit a1d955fc11
6 changed files with 79 additions and 57 deletions

View file

@ -1,24 +1,24 @@
return { return {
-- the opts function can also be used to change the default opts: -- -- the opts function can also be used to change the default opts:
{ -- {
"nvim-lualine/lualine.nvim", -- "nvim-lualine/lualine.nvim",
event = "VeryLazy", -- event = "VeryLazy",
opts = function(_, opts) -- opts = function(_, opts)
table.insert(opts.sections.lualine_x, "😄") -- table.insert(opts.sections.lualine_x, "😄")
end, -- end,
}, -- },
--
-- or you can return new options to override all the defaults -- -- or you can return new options to override all the defaults
{ -- {
"nvim-lualine/lualine.nvim", -- "nvim-lualine/lualine.nvim",
event = "VeryLazy", -- event = "VeryLazy",
opts = function() -- opts = function()
return { -- return {
--[[add your custom lualine config here]] -- --[[add your custom lualine config here]]
} -- }
end, -- end,
}, -- },
--
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc -- -- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" }, -- { import = "lazyvim.plugins.extras.lang.json" },
} }

View file

@ -21,6 +21,10 @@ set -g base-index 1
set -g pane-base-index 1 set -g pane-base-index 1
set-window-option -g pane-base-index 1 set-window-option -g pane-base-index 1
set-option -g renumber-windows on set-option -g renumber-windows on
set-option -g @ssh-split-h-key "%"
set-option -g @ssh-split-v-key '"'
set-option -g @ssh-split-keep-cwd "true"
set-option -g @ssh-split-keep-remote-cwd "true"
# Use Alt-arrow keys without prefix key to switch panes # Use Alt-arrow keys without prefix key to switch panes
bind -n M-Left select-pane -L bind -n M-Left select-pane -L
@ -41,6 +45,7 @@ set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'christoomey/vim-tmux-navigator' set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'catppuccin/tmux' set -g @plugin 'catppuccin/tmux'
set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'pschmitt/tmux-ssh-split'
set -g @catppuccin_flavour 'mocha' set -g @catppuccin_flavour 'mocha'
# set vi-mode # set vi-mode

View file

@ -53,8 +53,8 @@ __fzf_select() {
local item local item
FZF_DEFAULT_COMMAND=${FZF_CTRL_T_COMMAND:-} \ FZF_DEFAULT_COMMAND=${FZF_CTRL_T_COMMAND:-} \
FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --walker=file,dir,follow,hidden --scheme=path" "${FZF_CTRL_T_OPTS-} -m") \ FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --walker=file,dir,follow,hidden --scheme=path" "${FZF_CTRL_T_OPTS-} -m") \
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd) "$@" < /dev/tty | while read item; do FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd) "$@" < /dev/tty | while read -r item; do
echo -n "${(q)item} " echo -n -E "${(q)item} "
done done
local ret=$? local ret=$?
echo echo
@ -107,16 +107,24 @@ fi
# CTRL-R - Paste the selected command from history into the command line # CTRL-R - Paste the selected command from history into the command line
fzf-history-widget() { fzf-history-widget() {
local selected num local selected
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases noglob nobash_rematch 2> /dev/null
selected="$(fc -rl 1 | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' | # Ensure the associative history array, which maps event numbers to the full
FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m") \ # history lines, is loaded, and that Perl is installed for multi-line output.
if zmodload -F zsh/parameter p:history 2>/dev/null && (( ${#commands[perl]} )); then
selected="$(printf '%s\t%s\000' "${(kv)history[@]}" |
perl -0 -ne 'if (!$seen{(/^\s*[0-9]+\**\t(.*)/s, $1)}++) { s/\n/\n\t/g; print; }' |
FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '\t↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m --read0") \
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))" FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"
else
selected="$(fc -rl 1 | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' |
FZF_DEFAULT_OPTS=$(__fzf_defaults "" "-n2..,.. --scheme=history --bind=ctrl-r:toggle-sort --wrap-sign '\t↳ ' --highlight-line ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m") \
FZF_DEFAULT_OPTS_FILE='' $(__fzfcmd))"
fi
local ret=$? local ret=$?
if [ -n "$selected" ]; then if [ -n "$selected" ]; then
num=$(awk '{print $1}' <<< "$selected") if [[ $(awk '{print $1; exit}' <<< "$selected") =~ ^[1-9][0-9]* ]]; then
if [[ "$num" =~ '^[1-9][0-9]*\*?$' ]]; then zle vi-fetch-history -n $MATCH
zle vi-fetch-history -n ${num%\*}
else # selected is a custom query, not from history else # selected is a custom query, not from history
LBUFFER="$selected" LBUFFER="$selected"
fi fi
@ -295,7 +303,8 @@ __fzf_generic_path_completion() {
[ -z "$dir" ] && dir='.' [ -z "$dir" ] && dir='.'
[ "$dir" != "/" ] && dir="${dir/%\//}" [ "$dir" != "/" ] && dir="${dir/%\//}"
matches=$( matches=$(
export FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --scheme=path" "${FZF_COMPLETION_OPTS-}") export FZF_DEFAULT_OPTS
FZF_DEFAULT_OPTS=$(__fzf_defaults "--reverse --scheme=path" "${FZF_COMPLETION_OPTS-}")
unset FZF_DEFAULT_COMMAND FZF_DEFAULT_OPTS_FILE unset FZF_DEFAULT_COMMAND FZF_DEFAULT_OPTS_FILE
if declare -f "$compgen" > /dev/null; then if declare -f "$compgen" > /dev/null; then
eval "$compgen $(printf %q "$dir")" | __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" eval "$compgen $(printf %q "$dir")" | __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover"
@ -308,9 +317,9 @@ __fzf_generic_path_completion() {
rest=${FZF_COMPLETION_PATH_OPTS-} rest=${FZF_COMPLETION_PATH_OPTS-}
fi fi
__fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" --walker "$walker" --walker-root="$dir" ${(Q)${(Z+n+)rest}} < /dev/tty __fzf_comprun "$cmd" ${(Q)${(Z+n+)fzf_opts}} -q "$leftover" --walker "$walker" --walker-root="$dir" ${(Q)${(Z+n+)rest}} < /dev/tty
fi | while read item; do fi | while read -r item; do
item="${item%$suffix}$suffix" item="${item%$suffix}$suffix"
echo -n "${(q)item} " echo -n -E "${(q)item} "
done done
) )
matches=${matches% } matches=${matches% }
@ -335,11 +344,11 @@ _fzf_dir_completion() {
"" "/" "" "" "/" ""
} }
_fzf_feed_fifo() ( _fzf_feed_fifo() {
command rm -f "$1" command rm -f "$1"
mkfifo "$1" mkfifo "$1"
cat <&0 > "$1" & cat <&0 > "$1" &|
) }
_fzf_complete() { _fzf_complete() {
setopt localoptions ksh_arrays setopt localoptions ksh_arrays
@ -402,13 +411,14 @@ _fzf_complete_telnet() {
# The first and the only argument is the LBUFFER without the current word that contains the trigger. # The first and the only argument is the LBUFFER without the current word that contains the trigger.
# The current word without the trigger is in the $prefix variable passed from the caller. # The current word without the trigger is in the $prefix variable passed from the caller.
_fzf_complete_ssh() { _fzf_complete_ssh() {
local tokens=(${(z)1}) local -a tokens
tokens=(${(z)1})
case ${tokens[-1]} in case ${tokens[-1]} in
-i|-F|-E) -i|-F|-E)
_fzf_path_completion "$prefix" "$1" _fzf_path_completion "$prefix" "$1"
;; ;;
*) *)
local user= local user
[[ $prefix =~ @ ]] && user="${prefix%%@*}@" [[ $prefix =~ @ ]] && user="${prefix%%@*}@"
_fzf_complete +m -- "$@" < <(__fzf_list_hosts | awk -v user="$user" '{print user $0}') _fzf_complete +m -- "$@" < <(__fzf_list_hosts | awk -v user="$user" '{print user $0}')
;; ;;
@ -434,7 +444,7 @@ _fzf_complete_unalias() {
} }
_fzf_complete_kill() { _fzf_complete_kill() {
_fzf_complete -m --header-lines=1 --preview 'echo {}' --preview-window down:3:wrap --min-height 15 -- "$@" < <( _fzf_complete -m --header-lines=1 --no-preview --wrap -- "$@" < <(
command ps -eo user,pid,ppid,start,time,command 2> /dev/null || command ps -eo user,pid,ppid,start,time,command 2> /dev/null ||
command ps -eo user,pid,ppid,time,args # For BusyBox command ps -eo user,pid,ppid,time,args # For BusyBox
) )

27
.zshrc
View file

@ -131,22 +131,23 @@ zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath' zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
# Shell integrations # Generate Completions if not found
#eval "$(fzf --zsh)" if [ ! -f ~/.fzf.completion.zsh ]; then
#eval "$(zoxide init --cmd cd zsh)" fzf --zsh > ~/.fzf.completion.zsh
#eval "$(bw completion --shell zsh); compdef _bw bw;" fi
if [ ! -f ~/.zoxide.completions.zsh ]; then
zoxide init --cmd cd zsh > ~/.zoxide.completions.zsh
fi
if [ ! -f ~/.bw.completions.zsh ]; then
bw completion --shell zsh > ~/.bw.completions.zsh
fi
source ~/.fzf.completion.zsh source ~/.fzf.completion.zsh
source ~/.fzf.key-bindings.zsh source ~/.fzf.key-bindings.zsh
#source ~/.zoxide.completions.zsh source ~/.zoxide.completions.zsh
#source ~/.bw.completions.zsh source ~/.bw.completions.zsh
runinti ()
{
fzf --zsh > ~/.fzf.completion.zsh
zoxide init --cmd cd zsh > ~/.zoxide.completions.zsh
bw completion --shell zsh > ~/.bw.completions.zsh
}
unlockbw () unlockbw ()
{ {

View file

@ -12,7 +12,7 @@ required_packages_brew:
- kubernetes-cli - kubernetes-cli
- zsh-autosuggestions - zsh-autosuggestions
- bitwarden-cli - bitwarden-cli
# - hashicorp/tap/vault - "hashicorp/tap/vault"
- ffmpeg - ffmpeg
- ttyd - ttyd
- bat - bat
@ -70,4 +70,10 @@ required_packages_flatpak:
- me.proton.Pass - me.proton.Pass
- me.proton.Mail - me.proton.Mail
- com.protonvpn.www - com.protonvpn.www
- org.flameshot.Flameshot - org.remmina.Remmina
go_apps:
- github.com/charmbracelet/vhs@latest
- github.com/charmbracelet/glow@latest
- github.com/swaggo/swag/cmd/swag@latest
- github.com/air-verse/air@latest

View file

@ -1,9 +1,9 @@
- name: configure flatpak - name: configure flatpak
become_user: user
community.general.flatpak_remote: community.general.flatpak_remote:
name: "{{ item.name }}" name: "{{ item.name }}"
state: present state: present
flatpakrepo_url: "{{ item.url }}" flatpakrepo_url: "{{ item.url }}"
method: system
with_items: "{{ flatpak_remote }}" with_items: "{{ flatpak_remote }}"
when: flatpak_remote is defined when: flatpak_remote is defined