agregar ripgrep a zsh y vim. cambiar notificacion de mp3
This commit is contained in:
parent
87f9d40b93
commit
0c656f99d2
|
@ -0,0 +1,12 @@
|
|||
[Filechooser Settings]
|
||||
StartupMode=cwd
|
||||
LocationMode=path-bar
|
||||
ShowHidden=true
|
||||
ExpandFolders=false
|
||||
ShowSizeColumn=true
|
||||
GeometryX=209
|
||||
GeometryY=75
|
||||
GeometryWidth=948
|
||||
GeometryHeight=618
|
||||
SortColumn=modified
|
||||
SortOrder=descending
|
|
@ -13,6 +13,12 @@ if empty(glob('~/.config/nvim/autoload/plug.vim'))
|
|||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||
endif
|
||||
|
||||
if executable('rg')
|
||||
set grepprg=rg\ --vimgrep\ --no-heading
|
||||
elseif executable('ag')
|
||||
set grepprg=ag\ --nogroup\ --nocolor
|
||||
endif
|
||||
" }}}
|
||||
|
||||
" Plugins {{{
|
||||
|
@ -467,6 +473,7 @@ nnoremap <silent> <Right> :vertical resize +2<CR>
|
|||
nnoremap <silent> <Up> :resize -1<CR>
|
||||
nnoremap <silent> <Down> :resize +1<CR>
|
||||
inoremap jk <esc>
|
||||
cnoremap jk <C-c>
|
||||
|
||||
nnoremap <silent> <leader>ev :vsplit $MYVIMRC<CR>
|
||||
nnoremap <silent> <leader>sv :source $MYVIMRC<CR>
|
||||
|
|
|
@ -57,9 +57,6 @@ super + {e,r}
|
|||
super + {space,s}
|
||||
rofi -show {drun,window}
|
||||
|
||||
ctrl + alt + e
|
||||
thunar
|
||||
|
||||
ctrl + alt + x
|
||||
xkill
|
||||
|
||||
|
|
|
@ -44,4 +44,5 @@ setopt always_to_end
|
|||
setopt complete_in_word
|
||||
setopt list_types
|
||||
|
||||
HELPDIR=/usr/share/zsh/$ZSH_VERSION/help
|
||||
HELPDIR=/usr/share/zsh/$ZSH_VERSION/help
|
||||
WORDCHARS=${WORDCHARS//\/[&.;]}
|
|
@ -111,56 +111,6 @@ zle -N tmux-clear-screen
|
|||
bindkey "^L" tmux-clear-screen
|
||||
# }}}
|
||||
|
||||
# fkill - kill process using fzf {{{
|
||||
function fkill {
|
||||
local pid
|
||||
pid=$( pstree -T -p -a | fzf -e -m -i +s --reverse --margin=4%,1%,1%,2% --inline-info --header="TAB to (un)select. ENTER to kill selected process(es). ESC or CTRL+C to quit." --prompt='Enter string to filter list of processes > ' | awk -F ',' '{print $NF}' | awk '{print $1}' )
|
||||
|
||||
if [ "x$pid" != "x" ]
|
||||
then
|
||||
echo "$pid" | xargs kill -${1:-9}
|
||||
fi
|
||||
}
|
||||
# }}}
|
||||
|
||||
# git logs, hash, and diff with fzf {{{
|
||||
fshow() {
|
||||
git log --graph --color=always \
|
||||
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
|
||||
fzf --ansi --preview "echo {} | grep -o '[a-f0-9]\{7\}' | head -1 | xargs -I % sh -c 'git show --color=always %'" \
|
||||
--bind "enter:execute:
|
||||
(grep -o '[a-f0-9]\{7\}' | head -1 |
|
||||
xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
|
||||
{}
|
||||
FZF-EOF"
|
||||
}
|
||||
|
||||
# }}}
|
||||
|
||||
g-open() {
|
||||
project=$(git config --local remote.origin.url | sed s/git@github.com\:// | sed s/\.git//)
|
||||
url="http://github.com/$project/commit/$1"
|
||||
xdg-open $url
|
||||
}
|
||||
|
||||
# tm - tmux session control with fzf {{{
|
||||
tm() {
|
||||
[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session"
|
||||
if [ $1 ]; then
|
||||
tmux $change -t "$1" 2>/dev/null || (tmux new-session -d -s $1 && tmux $change -t "$1"); return
|
||||
fi
|
||||
session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found."
|
||||
}
|
||||
# }}}
|
||||
|
||||
# fvim - open any file in vim {{{
|
||||
fvim() {
|
||||
local IFS=$'\n'
|
||||
local files=($(fzf-tmux --query="$1" --multi --select-1 --exit-0))
|
||||
[[ -n "$files" ]] && ${EDITOR:-nvim} "${files[@]}"
|
||||
}
|
||||
# }}}
|
||||
|
||||
# Bunch of one liners {{{
|
||||
# colorized cat
|
||||
function cot() {
|
||||
|
|
|
@ -8,9 +8,11 @@ export FZF_DEFAULT_OPTS='
|
|||
'
|
||||
|
||||
export FZF_COMPLETION_OPTS='+c -x'
|
||||
export FZF_DEFAULT_COMMAND='rg --files --no-ignore-vcs --hidden --follow -g "!{.git,node_modules}/*" 2> /dev/null'
|
||||
|
||||
# ag -l -g ""
|
||||
if type rg &>/dev/null; then
|
||||
export FZF_DEFAULT_COMMAND='rg --follow --hidden --files --ignore-file ~/.agignore 2> /dev/null'
|
||||
elif type ag &>/dev/null; then
|
||||
export FZF_DEFAULT_COMMAND='ag --follow --hidden -g "" 2> /dev/null'
|
||||
fi
|
||||
|
||||
_fzf_compgen_path() {
|
||||
fd --hidden --follow --exclude ".git" . "$1"
|
||||
|
@ -26,4 +28,56 @@ export FZF_CTRL_T_OPTS="--select-1 --exit-0 --preview '(highlight -O ansi -l {}
|
|||
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
|
||||
export FZF_ALT_C_OPTS="--select-1 --exit-0 --preview 'tree -C {} | head -200'"
|
||||
|
||||
command -v tree > /dev/null && export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -$LINES'"
|
||||
command -v tree > /dev/null && export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -$LINES'"
|
||||
|
||||
# fkill - kill process using fzf {{{
|
||||
function fkill {
|
||||
local pid
|
||||
pid=$( pstree -T -p -a | fzf -e -m -i +s --reverse --margin=4%,1%,1%,2% --inline-info --header="TAB to (un)select. ENTER to kill selected process(es). ESC or CTRL+C to quit." --prompt='Enter string to filter list of processes > ' | awk -F ',' '{print $NF}' | awk '{print $1}' )
|
||||
|
||||
if [ "x$pid" != "x" ]
|
||||
then
|
||||
echo "$pid" | xargs kill -${1:-9}
|
||||
fi
|
||||
}
|
||||
# }}}
|
||||
|
||||
# git logs, hash, and diff with fzf {{{
|
||||
fshow() {
|
||||
git log --graph --color=always \
|
||||
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
|
||||
fzf --ansi --preview "echo {} | grep -o '[a-f0-9]\{7\}' | head -1 | xargs -I % sh -c 'git show --color=always %'" \
|
||||
--bind "enter:execute:
|
||||
(grep -o '[a-f0-9]\{7\}' | head -1 |
|
||||
xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF'
|
||||
{}
|
||||
FZF-EOF"
|
||||
}
|
||||
|
||||
g-open() {
|
||||
project=$(git config --local remote.origin.url | sed s/git@github.com\:// | sed s/\.git//)
|
||||
url="http://github.com/$project/commit/$1"
|
||||
xdg-open $url
|
||||
}
|
||||
# }}}
|
||||
|
||||
# tm - tmux session control with fzf {{{
|
||||
tm() {
|
||||
[[ -n "$TMUX" ]] && change="switch-client" || change="attach-session"
|
||||
if [ $1 ]; then
|
||||
tmux $change -t "$1" 2>/dev/null || (tmux new-session -d -s $1 && tmux $change -t "$1"); return
|
||||
fi
|
||||
session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found."
|
||||
}
|
||||
# }}}
|
||||
|
||||
# fvim - open any file in nvim or sublime {{{
|
||||
fv() {
|
||||
IFS=$'\n' out=($(fzf --query="$1" --exit-0 --expect=ctrl-g,ctrl-e))
|
||||
key=$(head -1 <<< "$out")
|
||||
file=$(head -2 <<< "$out" | tail -1)
|
||||
if [ -n "$file" ]; then
|
||||
[ "$key" = ctrl-g ] && subl "$file" || $EDITOR "$file"
|
||||
fi
|
||||
}
|
||||
# }}}
|
|
@ -1,3 +1,12 @@
|
|||
autoload -U history-substring-search-up
|
||||
autoload -U history-substring-search-down
|
||||
autoload -U up-line-or-beginning-search
|
||||
autoload -U down-line-or-beginning-search
|
||||
zle -N history-substring-search-up
|
||||
zle -N history-substring-search-down
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
|
||||
bindkey -v
|
||||
|
||||
# Fix backspace not working after returning from cmd mode
|
||||
|
@ -6,33 +15,15 @@ bindkey '^h' backward-delete-char
|
|||
bindkey '^w' backward-kill-word
|
||||
|
||||
# Even more ways to search
|
||||
autoload -U up-line-or-beginning-search
|
||||
autoload -U down-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
bindkey '^P' up-line-or-beginning-search
|
||||
bindkey '^N' down-line-or-beginning-search
|
||||
bindkey '^U' history-incremental-pattern-search-backward
|
||||
bindkey '^F' fzf-history-widget
|
||||
|
||||
# Ctrl+Y is a standard in some places, and since Ctrl+R is taken...
|
||||
bindkey -a u undo
|
||||
bindkey -a '^y' redo
|
||||
|
||||
# Beginning search with arrow keys
|
||||
if [[ "${terminfo[kcuu1]}" != "" ]]; then
|
||||
autoload -U history-substring-search-up
|
||||
zle -N history-substring-search-up
|
||||
bindkey "${terminfo[kcuu1]}" history-substring-search-up
|
||||
fi
|
||||
# start typing + [Down-Arrow] - fuzzy find history backward
|
||||
if [[ "${terminfo[kcud1]}" != "" ]]; then
|
||||
autoload -U history-substring-search-down
|
||||
zle -N history-substring-search-down
|
||||
bindkey "${terminfo[kcud1]}" history-substring-search-down
|
||||
fi
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
|
||||
# file rename magick
|
||||
bindkey "^[m" copy-prev-shell-word
|
||||
|
||||
|
@ -42,19 +33,44 @@ bindkey -M vicmd '/' history-incremental-search-forward
|
|||
bindkey -M vicmd 'k' history-substring-search-up
|
||||
bindkey -M vicmd 'j' history-substring-search-down
|
||||
|
||||
bindkey '^[[7~' beginning-of-line # Home key
|
||||
bindkey '^[[H' beginning-of-line # Home key
|
||||
if [[ "${terminfo[khome]}" != "" ]]; then
|
||||
bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
|
||||
typeset -g -A key
|
||||
|
||||
key[Home]="$terminfo[khome]"
|
||||
key[End]="$terminfo[kend]"
|
||||
key[Insert]="$terminfo[kich1]"
|
||||
key[Backspace]="$terminfo[kbs]"
|
||||
key[Delete]="$terminfo[kdch1]"
|
||||
key[Up]="$terminfo[kcuu1]"
|
||||
key[Down]="$terminfo[kcud1]"
|
||||
key[Left]="$terminfo[kcub1]"
|
||||
key[Right]="$terminfo[kcuf1]"
|
||||
key[PageUp]="$terminfo[kpp]"
|
||||
key[PageDown]="$terminfo[knp]"
|
||||
|
||||
# setup key accordingly
|
||||
[[ -n "$key[Home]" ]] && bindkey -- "$key[Home]" beginning-of-line
|
||||
[[ -n "$key[End]" ]] && bindkey -- "$key[End]" end-of-line
|
||||
[[ -n "$key[Insert]" ]] && bindkey -- "$key[Insert]" overwrite-mode
|
||||
[[ -n "$key[Backspace]" ]] && bindkey -- "$key[Backspace]" backward-delete-char
|
||||
[[ -n "$key[Delete]" ]] && bindkey -- "$key[Delete]" delete-char
|
||||
[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" history-substring-search-up
|
||||
[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" history-substring-search-down
|
||||
[[ -n "$key[Left]" ]] && bindkey -- "$key[Left]" backward-char
|
||||
[[ -n "$key[Right]" ]] && bindkey -- "$key[Right]" forward-char
|
||||
[[ -n "$key[PageUp]" ]] && bindkey -- "$key[PageUp]" history-beginning-search-backward
|
||||
[[ -n "$key[PageDown]" ]] && bindkey -- "$key[PageDown]" history-beginning-search-forward
|
||||
|
||||
# Finally, make sure the terminal is in application mode, when zle is
|
||||
# active. Only then are the values from $terminfo valid.
|
||||
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
|
||||
function zle-line-init () {
|
||||
echoti smkx
|
||||
}
|
||||
function zle-line-finish () {
|
||||
echoti rmkx
|
||||
}
|
||||
zle -N zle-line-init
|
||||
zle -N zle-line-finish
|
||||
fi
|
||||
bindkey '^[[8~' end-of-line # End key
|
||||
bindkey '^[[F' end-of-line # End key
|
||||
if [[ "${terminfo[kend]}" != "" ]]; then
|
||||
bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
|
||||
fi
|
||||
bindkey '^[[2~' overwrite-mode # Insert key
|
||||
bindkey '^[[3~' delete-char # Delete key
|
||||
bindkey '^[[C' forward-char # Right key
|
||||
bindkey '^[[D' backward-char # Left key
|
||||
bindkey '^[[5~' history-beginning-search-backward # Page up key
|
||||
bindkey '^[[6~' history-beginning-search-forward # Page down key
|
||||
|
||||
export KEYTIMEOUT=1
|
9
.zshrc
9
.zshrc
|
@ -30,7 +30,12 @@ zplugin light tj/git-extras
|
|||
zplugin ice pick"c.zsh" atclone"dircolors -b LS_COLORS > c.zsh" atpull"%atclone"
|
||||
zplugin light trapd00r/LS_COLORS
|
||||
zplugin ice pick"async.zsh" src"pure.zsh"; zplugin light sindresorhus/pure
|
||||
PURE_CMD_MAX_EXEC_TIME=10000000
|
||||
PURE_GIT_PULL=1
|
||||
PURE_PROMPT_SYMBOL='>'
|
||||
PURE_PROMPT_VICMD_SYMBOL='<'
|
||||
PURE_GIT_DOWN_ARROW='↓'
|
||||
PURE_GIT_UP_ARROW='↑'
|
||||
prompt_newline='%666v'
|
||||
PROMPT=" $PROMPT"
|
||||
zplugin ice atinit'local i; for i in *.zsh; do source $i; done'; zpl light ~/.config/zsh
|
||||
|
@ -77,8 +82,8 @@ zstyle ':completion:*:commands' list-colors '=*=32'
|
|||
zstyle ':completion:*:builtins' list-colors '=*=1;38;5;142'
|
||||
zstyle ':completion:*:aliases' list-colors '=*=2;38;5;120'
|
||||
zstyle ':completion:*:options' list-colors '=^(-- *)=34'
|
||||
zstyle ':completion:*' list-separator "XX"
|
||||
zstyle ':completion:*:default' list-colors '=(#b)*(XX *)=36=31' '=*=36'
|
||||
zstyle ':completion:*' list-separator "--"
|
||||
zstyle ':completion:*:default' list-colors '=(#b)*(-- *)=36=31' '=*=36'
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*( *[a-z])*=34=31=33'
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
|
||||
zstyle ':completion::complete:*' use-cache on
|
||||
|
|
8
bin/tapa
8
bin/tapa
|
@ -14,9 +14,8 @@ album_color="##ad7fa8"
|
|||
song_color="##34e2e2"
|
||||
|
||||
# What do we want the notification to look like?
|
||||
form="\\n<b>Artist:</b>\\t<span
|
||||
color='$artist_color'>%artist%</span>\\n<b>Track:</b>\\t<span
|
||||
color='$song_color'>%title%</span>\\n<b>Album:</b>\\t<span color='$album_color'>%album%</span>"
|
||||
title="<span color='$artist_color' weight='bold'>%artist%</span>"
|
||||
form="<span color='$song_color'>%title%</span> - <span color='$album_color'>%album%</span>"
|
||||
# END CONFIG ----------------------------------------------------
|
||||
|
||||
# These are some variables we need for things to work
|
||||
|
@ -26,6 +25,7 @@ artist="$(mpc --format %artist% current)"
|
|||
albart="$(mpc --format %albumartist% current)"
|
||||
dir="$music_dir/$artist/$album/"
|
||||
temp_path="/tmp/current_cover.png"
|
||||
heading="$(mpc current -f "$title" | sed "s:&:&:g")"
|
||||
message="$(mpc current -f "$form" | sed "s:&:&:g" )"
|
||||
|
||||
# Is there music on
|
||||
|
@ -53,4 +53,4 @@ if [[ -n $cover ]]; then
|
|||
fi
|
||||
|
||||
# Send the notification
|
||||
dunstify -a MPD -r 1337 -u low -t 8000 -i "$cover" " ♫ Now Playing ♫ " "$message"
|
||||
dunstify -a MPD -r 1337 -u low -t 8000 -i "$cover" "$heading" "$message"
|
||||
|
|
Reference in New Issue