⚡ (bash) crossSession, m; (git) interactive (+vim)
This commit is contained in:
parent
fff74676d9
commit
46e9b50a13
@ -15,8 +15,6 @@ if [ -x /usr/bin/dircolors ]; then
|
||||
alias diff='diff --color=auto'
|
||||
fi
|
||||
|
||||
~sezení(){ ~/Dokumenty/Projekty/Sezení; }
|
||||
|
||||
alias §rm='rm -vi'
|
||||
alias §cp='cp -vi'
|
||||
alias §mv='mv -vi'
|
||||
@ -29,9 +27,42 @@ alias §df='df -Th'
|
||||
alias §xclip-copy='xclip -selection clipboard'
|
||||
alias §xclip-paste='xclip -o -selection clipboard'
|
||||
|
||||
LAST_PWD_PATH="$BASH_DOTFILES/.bash_last_pwd"
|
||||
[ -f "$LAST_PWD_PATH" ] && OLDPWD=`cat $LAST_PWD_PATH`
|
||||
cd(){ builtin cd "$@" && echo `pwd` > "$LAST_PWD_PATH"; }
|
||||
CROSS_SESSION="$BASH_DOTFILES/.bash_cross_session"
|
||||
[ -f "$CROSS_SESSION" ] && . "$CROSS_SESSION"
|
||||
crossSession() {
|
||||
if [[ '--help' == "${1:---help}" ]]; then
|
||||
echo 'crossSession [--help]'
|
||||
echo ' Print this help.'
|
||||
echo 'crossSession [--list]'
|
||||
echo ' Lists all cross session variables or print this help.'
|
||||
echo 'crossSession <name> [<value>]'
|
||||
echo ' Sets cross session variable <name> to <value> (or empty for unset).'
|
||||
return 0
|
||||
fi
|
||||
if [[ '--list' == "$1" ]]; then
|
||||
cat "$CROSS_SESSION"
|
||||
return 0
|
||||
fi
|
||||
local name="$1"
|
||||
local value="$2"
|
||||
|
||||
# Check if the variable already exists in the file
|
||||
if grep -q "^export $name=" "$CROSS_SESSION"; then
|
||||
if [ -z "$value" ]; then
|
||||
# If new value is empty, remove the variable from the file
|
||||
sed -i "/^export $name=/d" "$CROSS_SESSION"
|
||||
else
|
||||
# If it exists, replace the old value with the new value
|
||||
sed -i "s|^export $name=.*|export $name=\"$value\"|" "$CROSS_SESSION"
|
||||
fi
|
||||
else
|
||||
if [ -n "$value" ]; then
|
||||
# If it doesn't exist and new value is not empty, append the new variable to the file
|
||||
echo "export $name=\"$value\"" >> "$CROSS_SESSION"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
cd(){ builtin cd "$@" && crossSession 'OLDPWD' "$(pwd)"; }
|
||||
|
||||
history_clean(){ awk '!seen[$0]++ {print $0}' $HOME/.bash_history; }
|
||||
history_edit(){ vim $HOME/.bash_history; }
|
||||
@ -49,6 +80,11 @@ history_most_used(){ LC_ALL=C cat ~/.bash_history | cut -d ';' -f 2- | §awk 1 |
|
||||
alias §less='less -R -S'
|
||||
|
||||
m(){
|
||||
if [[ '-d' == "$1" ]]; then
|
||||
unset "m$2"
|
||||
crossSession "m$2"
|
||||
return 0
|
||||
fi
|
||||
if [[ -z "$1" ]]; then
|
||||
printenv | grep -e '^m'
|
||||
return 0
|
||||
@ -56,6 +92,8 @@ m(){
|
||||
if [[ "--help" == "$1" ]]; then
|
||||
echo 'm [--help]'
|
||||
echo ' Lists all marks or print this help.'
|
||||
echo 'm -d <name>'
|
||||
echo ' Deletes mark <name>. Unsets variable and cross session variable.'
|
||||
echo 'm <name> [path]'
|
||||
echo ' Sets mark <name> to current directory or [path].'
|
||||
echo ' The mark is just a bash variable, use `$m<name>`.'
|
||||
@ -64,6 +102,7 @@ m(){
|
||||
local n="m$1"
|
||||
[[ -z "${!n}" ]] || return 1
|
||||
[[ -z "$2" ]] && local p="$(pwd)" || local p="$(readlink -f $2)"
|
||||
crossSession "$n" "$p"
|
||||
export $n="$p"
|
||||
}
|
||||
alias cd-vifm='cd `vifm --choose-dir -`'
|
||||
|
@ -43,7 +43,7 @@ Dockerfile=Dockerfile;dockerfile;*.dockerfile;*.Dockerfile;
|
||||
#Haxe=*.hx;
|
||||
#HTML=*.htm;*.html;*.shtml;*.hta;*.htd;*.htt;*.cfm;*.tpl;
|
||||
#Java=*.java;*.jsp;
|
||||
JavaScript=*.js;*.mjs;
|
||||
JavaScript=*.js;*.mjs;*.jsx;
|
||||
#JSON=*.json;
|
||||
#Julia=*.jl;
|
||||
#Kotlin=*.kt;*.kts;
|
||||
|
@ -21,8 +21,8 @@
|
||||
"exec": "yes",
|
||||
"description": "AI Browser",
|
||||
"glare": "AppImage",
|
||||
"last_update": "2025-01-01T14:34:08Z",
|
||||
"version": "3.2.0",
|
||||
"last_update": "2025-02-01T14:42:48Z",
|
||||
"version": "3.6.0",
|
||||
"downloads": "/home/jaandrle/bin/pinokio"
|
||||
},
|
||||
{
|
||||
@ -136,9 +136,9 @@
|
||||
"group": "nondev",
|
||||
"file_name": "fedistar.appimage",
|
||||
"exec": "yes",
|
||||
"last_update": "2025-01-04T02:33:29Z",
|
||||
"last_update": "2025-01-09T12:37:14Z",
|
||||
"downloads": "/home/jaandrle/bin/fedistar.appimage",
|
||||
"version": "v1.10.1",
|
||||
"version": "v1.11.0",
|
||||
"glare": ".*amd64.*.AppImage"
|
||||
},
|
||||
{
|
||||
@ -148,9 +148,9 @@
|
||||
"group": "ai",
|
||||
"file_name": "ollama",
|
||||
"exec": "yes",
|
||||
"last_update": "2024-12-17T21:54:59Z",
|
||||
"last_update": "2025-02-14T08:25:18Z",
|
||||
"downloads": "/home/jaandrle/bin/ollama",
|
||||
"version": "v0.5.4",
|
||||
"version": "v0.5.11",
|
||||
"glare": "linux-amd64"
|
||||
},
|
||||
{
|
||||
@ -173,8 +173,8 @@
|
||||
"file_name": "vim",
|
||||
"exec": "yes",
|
||||
"downloads": "/home/jaandrle/bin/vim",
|
||||
"version": "v9.1.0990",
|
||||
"last_update": "2025-01-06T01:20:31Z",
|
||||
"version": "v9.1.1106",
|
||||
"last_update": "2025-02-12T01:15:34Z",
|
||||
"glare": "GVim.*x86_64.*.AppImage"
|
||||
},
|
||||
{
|
||||
@ -184,9 +184,9 @@
|
||||
"group": "dev",
|
||||
"file_name": "escrcpy.appimage",
|
||||
"exec": "yes",
|
||||
"last_update": "2024-12-28T11:05:28Z",
|
||||
"last_update": "2025-02-17T13:16:44Z",
|
||||
"downloads": "/home/jaandrle/bin/escrcpy.appimage",
|
||||
"version": "v1.28.3",
|
||||
"version": "v1.28.7",
|
||||
"glare": ".*x86_64.*.AppImage"
|
||||
},
|
||||
{
|
||||
@ -208,9 +208,9 @@
|
||||
"group": "ai",
|
||||
"file_name": "jan",
|
||||
"exec": "yes",
|
||||
"last_update": "2025-01-06T08:15:48Z",
|
||||
"last_update": "2025-02-11T07:09:50Z",
|
||||
"downloads": "/home/jaandrle/bin/jan",
|
||||
"version": "v0.5.13",
|
||||
"version": "v0.5.15-rc9-beta",
|
||||
"glare": ".*x86_64.*.AppImage"
|
||||
},
|
||||
{
|
||||
@ -220,9 +220,9 @@
|
||||
"group": "ai",
|
||||
"file_name": "Chatbox",
|
||||
"exec": "yes",
|
||||
"last_update": "2024-12-16T12:18:19Z",
|
||||
"last_update": "2025-01-14T13:29:06Z",
|
||||
"downloads": "/home/jaandrle/bin/Chatbox",
|
||||
"version": "v0.10.3",
|
||||
"version": "v0.10.4",
|
||||
"glare": ".*x86_64.*.AppImage"
|
||||
},
|
||||
{
|
||||
@ -234,8 +234,8 @@
|
||||
"exec": "yes",
|
||||
"downloads": "/home/jaandrle/bin/r-quick-share",
|
||||
"glare": ".*main.*amd64.AppImage",
|
||||
"last_update": "2024-08-21T21:17:54Z",
|
||||
"version": "v0.11.2"
|
||||
"last_update": "2025-01-14T08:36:53Z",
|
||||
"version": "v0.11.4"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
{
|
||||
"draw_white_space": "all"
|
||||
"draw_white_space": "all",
|
||||
"word_wrap": true,
|
||||
}
|
||||
|
@ -14,3 +14,6 @@ Parent=FALLBACK/
|
||||
[Scrolling]
|
||||
HistoryMode=2
|
||||
ScrollBarPosition=2
|
||||
|
||||
[Terminal Features]
|
||||
BellMode=1
|
||||
|
@ -26,5 +26,6 @@
|
||||
"complexity": ["error", 15]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"snippets.ultisnips.pythonPrompt": false
|
||||
}
|
||||
|
6
.vimrc
6
.vimrc
@ -1,7 +1,7 @@
|
||||
""" VIM config file | Jan Andrle | 2025-01-07 (VIM >=9.1 AppImage)
|
||||
""" VIM config file | Jan Andrle | 2025-01-08 (VIM >=9.1 AppImage)
|
||||
"" #region B – Base
|
||||
scriptencoding utf-8 | set encoding=utf-8
|
||||
set pythonthreedll=/lib/x86_64-linux-gnu/libpython3.10.so.1.0
|
||||
set pythonthreedll=/lib/x86_64-linux-gnu/libpython3.12.so.1.0
|
||||
let $BASH_ENV = "~/.bashrc"
|
||||
set runtimepath^=~/.vim/bundle/*
|
||||
packadd! matchit
|
||||
@ -291,7 +291,7 @@
|
||||
command! -nargs=* -complete=customlist,<sid>gitCompletion
|
||||
\ GITstatus !git status-- <args>
|
||||
command! -nargs=* -complete=customlist,<sid>gitCompletion
|
||||
\ GITcommit !git commit-- <args>
|
||||
\ GITcommit !git commit--interactive-v <args>
|
||||
command! -nargs=* -complete=customlist,<sid>gitCompletion
|
||||
\ GITpush !git push <args>
|
||||
command! -nargs=* -complete=customlist,<sid>gitCompletion
|
||||
|
Loading…
x
Reference in New Issue
Block a user