diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-22 16:23:07 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-06-22 16:23:07 +0200 |
commit | d466dcc80e77463fa035fc85ced0c253e38cbac2 (patch) | |
tree | df8e20418fc6529e9639b0f38a205adfded16072 /config/essentials | |
parent | 10e12bbe481af7974739060f51210f7948fc1df9 (diff) | |
parent | fcc378109f2c9d3f80a6213646d7c170dd93100d (diff) |
Merge branch 'main' of debuc.com:dotfiles
Diffstat (limited to 'config/essentials')
-rw-r--r-- | config/essentials/git/config | 2 | ||||
-rw-r--r-- | config/essentials/shell/aliases.sh | 4 | ||||
-rw-r--r-- | config/essentials/shell/functions.sh | 14 | ||||
-rw-r--r-- | config/essentials/vis/visrc.lua | 29 |
4 files changed, 28 insertions, 21 deletions
diff --git a/config/essentials/git/config b/config/essentials/git/config index 99cf21e..2b2b202 100644 --- a/config/essentials/git/config +++ b/config/essentials/git/config @@ -9,7 +9,7 @@ [pull] rebase = false [merge] - ff = false + ff = true [alias] change-commits = "!f() { VAR1=$1; VAR='$'$1; OLD=$2; NEW=$3; echo \"Are you sure for replace $VAR $OLD => $NEW ?(Y/N)\";read OK;if [ \"$OK\" = 'Y' ] ; then shift 3; git filter-branch --env-filter \"if [ \\\"${VAR}\\\" = '$OLD' ]; then export $VAR1='$NEW';echo 'to $NEW'; fi\" $@; fi;}; f " [commit] diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh index ddc605a..7ddd2f2 100644 --- a/config/essentials/shell/aliases.sh +++ b/config/essentials/shell/aliases.sh @@ -147,7 +147,6 @@ alias mdb='mariadb -u admin -ppass admindb' alias mdbw='mariadb -h 0.0.0.0 -u padmin -pbulbizarre padmindb' alias mdbwa='mariadb -h 10.3.50.5 -u padmin -pbulbizarre padmindb' alias tmux='pgrep tmux && tmux attach || tmux new-session' -alias wd='dict' # ssh alias sha='ssh-add' @@ -184,7 +183,7 @@ alias kll='killall' alias pi='ping 9.9.9.9 -c4' alias sba='source env/bin/activate || source bin/activate' -alias zsr='source ${ZDOTDIR:-~}/.zshrc && rehash' +alias zsr='exec zsh' alias rh='rehash' alias wf='doas wipefs -a' alias dmci="doas make clean install" @@ -250,6 +249,7 @@ alias ehyb='vi ~/.config/hypr/binds.conf' alias ewbj='vi ~/.config/waybar/config.jsonc' alias ewbs='vi ~/.config/waybar/style.css' alias cfd='vi config.def.h' +alias dump='vi ~/notes/dump.md' # /# quick cd
jV}k:!sort -t "'" -k 2
alias cdl='cd ~/dl' alias cdoc='cd ~/docs' diff --git a/config/essentials/shell/functions.sh b/config/essentials/shell/functions.sh index 1b69fbd..27eb33e 100644 --- a/config/essentials/shell/functions.sh +++ b/config/essentials/shell/functions.sh @@ -364,17 +364,3 @@ ffconcat () { ffmpeg -y -f concat -safe 0 -i $tmp -c copy "$1" rm $tmp } - -# wrap ssh and add key if exists -ssh() { - if [ "$#" -gt 1 ] - then - /usr/bin/ssh $@ - return - fi - - grep -E "Host\s+$1" $HOME/.ssh/config > /dev/null 2>&1 && - keyadd "$1" > /dev/null 2>&1 - /usr/bin/ssh "$1" -} - diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua index 7847784..a763edc 100644 --- a/config/essentials/vis/visrc.lua +++ b/config/essentials/vis/visrc.lua @@ -26,7 +26,6 @@ local format = require("format") local fzfmru = require("fzf-mru") fzfmru.fzfmru_path = 'grep "^' .. os.getenv("PWD") .. '" | fzf' - -- todo: -- c-scope -- c-tags @@ -83,8 +82,12 @@ end, "Remove trailing whitespace") --- MAPPINGS ------------------------------------- -vis:map(m.NORMAL, "<C-p>", function() vis:command("fzf") end, "Open file with fzf") - +vis:map(m.NORMAL, " pf", function() + vis:command("fzf") +end, "Open file with fzf") +vis:map(m.NORMAL, " pr", function() + vis:command("fzfmru") +end, "Open file with fzf") vis:map(m.NORMAL, " r", function() wrap_restore(vis.command, vis, "e $vis_filepath") @@ -120,14 +123,32 @@ vis.events.subscribe(vis.events.INIT, function() end) vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args + -- automatically cd in parent dir of file + if win.file and win.file.path then + local dir = win.file.path:match(".*/") + vis:command("cd " .. dir) + end + win.options.relativenumbers = true if win.syntax == "bash" then map_keys( m.NORMAL, - " v", + ";p", "V:x/^(\\s*)(.+)$/ c/\\1>\\&2 printf '\\2: %s\\\\n' \"$\\2\"/<Enter><Escape>", "Print variable" ) + map_keys(m.NORMAL, ";v", 'V:x/^(\\s*)(.+)$/ c/\\1"$(\\2)"/<Enter><Escape>', "Surround in variable") + map_keys(m.NORMAL, ";|", "V:x/\\| / c/|\n\t/<Enter><Escape>", "Wrap one-line multi pipe command") + map_keys( + m.NORMAL, + ";e", + 'V:x/^(\\s*)(.+)$/ c/\\1[ "\\2" ] || exit 1/<Enter><Escape>', + "Condition exit if empty" + ) + map_keys(m.NORMAL, ";sc", ":-/\\<case\\>/,/\\<esac\\>/<Enter>", "Expand to case") + map_keys(m.NORMAL, ";sw", ":-/\\<while/,/\\<done\\>/<Enter>", "Expand to while") + map_keys(m.NORMAL, ";sf", ":-/\\<for\\>/,/\\<done\\>/<Enter>", "Expand to for") + map_keys(m.NORMAL, ";si", ":-/\\<if\\>/,/\\<fi\\>/<Enter>", "Expand to if") end end) |