From a97757fa99197c52bc3afe900c8ba3ac685dfc36 Mon Sep 17 00:00:00 2001 From: Luca Bilke Date: Thu, 7 Jul 2022 16:23:55 +0200 Subject: [PATCH] lvim and kitty changes --- .config/lf/lfrc | 54 ++++++++++++++++++++++++++++++++++++++--- .config/lvim/config.lua | 30 +++++++++-------------- 2 files changed, 62 insertions(+), 22 deletions(-) diff --git a/.config/lf/lfrc b/.config/lf/lfrc index 783aee40c..a1381f1ef 100644 --- a/.config/lf/lfrc +++ b/.config/lf/lfrc @@ -28,8 +28,18 @@ cmd open ${{ video/*) setsid -f mpv $f -quiet >/dev/null 2>&1 ;; application/pdf|application/vnd*|application/epub*) setsid -f zathura $fx >/dev/null 2>&1 ;; application/pgp-encrypted) $EDITOR $fx ;; - *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; - esac + *.tar.bz|*.tar.bz2|*.tbz|*.tbz2|*.tar.gz|*.tgz|*.tar.xz|*.txz|*.zip|*.rar|*.iso) + mntdir="$f-archivemount" + [ ! -d "$mntdir" ] && { + mkdir "$mntdir" + archivemount "$f" "$mntdir" + echo "$mntdir" >> "/tmp/__lf_archivemount_$id" + } + lf -remote "send $id cd \"$mntdir\"" + lf -remote "send $id reload" + ;; + *) for f in $fx; do setsid -f $OPENER $f >/dev/null 2>&1; done;; + esac }} cmd mkdir $mkdir -p "$(echo $* | tr ' ' '\ ')" @@ -52,6 +62,16 @@ cmd delete ${{ [ $ans = "y" ] && rm -rf -- $fx }} +cmd trash ${{ + clear; tput cup $(($(tput lines)/3)); tput bold + set -f + printf "%s\n\t" "$fx" + printf "trash?[y/N]" + read ans + [ $ans = "y" ] && trash-put $fx +}} + + cmd moveto ${{ clear; tput cup $(($(tput lines)/3)); tput bold set -f @@ -108,10 +128,33 @@ cmd link %{{ cmd setbg "$1" cmd bulkrename $vidir +cmd git_branch ${{ + git branch | fzf | xargs git checkout + pwd_shell=$(pwd) + lf -remote "send $id updir" + lf -remote "send $id cd \"$pwd_shell\"" +}} + +cmd on-cd &{{ + # display git repository status in your prompt + source /usr/share/git/completion/git-prompt.sh + GIT_PS1_SHOWDIRTYSTATE=auto + GIT_PS1_SHOWSTASHSTATE=auto + GIT_PS1_SHOWUNTRACKEDFILES=auto + GIT_PS1_SHOWUPSTREAM=auto + GIT_PS1_COMPRESSSPARSESTATE=auto + git=$(__git_ps1 " [GIT BRANCH:> %s]") || true + fmt="\033[32;1m%u@%h\033[0m:\033[34;1m%w\033[0m\033[33;1m$git\033[0m" + lf -remote "send $id set promptfmt \"$fmt\"" +}} + +cmd paste $cp-p --lf-paste $id + # Bindings map $lf -remote "send $id select '$(fzf)'" map J $lf -remote "send $id cd $(sed -e 's/\s*#.*//' -e '/^$/d' -e 's/^\S*\s*//' ${XDG_CONFIG_HOME:-$HOME/.config}/shell/bm-dirs | fzf)" -map D delete +map D trash +# map D delete map E extract map C copyto map R rsyncto @@ -138,4 +181,7 @@ map down map up map V push :!$EDITOR -map W $setsid -f $TERMINAL >/dev/null 2>&1 +map gb :git_branch +map gp ${{clear; git pull --rebase || true; echo "press ENTER"; read ENTER}} +map gs ${{clear; git status; echo "press ENTER"; read ENTER}} +map gl ${{clear; git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit}} diff --git a/.config/lvim/config.lua b/.config/lvim/config.lua index b8737f2d8..e7f7c73c5 100644 --- a/.config/lvim/config.lua +++ b/.config/lvim/config.lua @@ -1,10 +1,16 @@ -- general -lvim.log.level = "warn" -lvim.colorscheme = "tokyonight" -lvim.transparent_window = true -vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo" -vim.opt.undofile = true -vim.opt.titlestring = "%t - nvim" +lvim.log.level = "warn" +lvim.colorscheme = "tokyonight" +vim.g.tokyonight_style = "night" +vim.opt.undodir = vim.fn.stdpath "cache" .. "/undo" +vim.opt.undofile = true +vim.opt.titlestring = "%t - nvim" + +-- opts for LF +vim.g.NERDTreeHijackNetrw = 0 +vim.g.lf_replace_netrw = 1 +vim.g.lf_command_override = 'lf -command "set nopreview" -command "set hidden"' + -- Lualine lvim.builtin.lualine.style = "none" @@ -296,20 +302,8 @@ lvim.plugins = { { "felipec/vim-sanegx", event = "BufRead", }, - -- { "tpope/vim-surround", - -- keys = { "c", "d", "y" }, - -- -- make sure to change the value of `timeoutlen` if it's not triggering correctly, see https://github.com/tpope/vim-surround/issues/117 - -- setup = function() - -- vim.opt.timeoutlen = 500 - -- end - -- }, { "ptzz/lf.vim", requires = "voldikss/vim-floaterm", - config = function() - vim.g.NERDTreeHijackNetrw = 0 - vim.g.lf_replace_netrw = 1 - vim.g.lf_command_override = 'lf -command "set nopreview" -command "set hidden"' - end, }, { "vimwiki/vimwiki" } }