Compare commits

...

2 Commits

Author SHA1 Message Date
bretello fbc6934f8f
functions: add vimscratch
use `vimscratch` to open a scratch vim buffer.

If run in a pipe, it uses `stdin` as input:

```bash
<command> | vimscratch
```
2023-08-23 13:52:35 +02:00
bretello 4b73ed209f
zsh: theme: do not increase shell level when using tmux 2023-07-27 12:01:26 +02:00
2 changed files with 13 additions and 1 deletions

12
functions/vim.zsh 100644
View File

@ -0,0 +1,12 @@
# open vim with a scratch window that can be discarded on exit.
vimscratch() {
local args
# if running in a pipe, use stdin (-) as arg.
# -t checks if the given FD is a terminal
if [ -t 0 ] ; then
args="$@"
else
args="-"
fi
vim -c "set buftype=nofile" "$args"
}

View File

@ -41,7 +41,7 @@ function job_prompt() {
function shlvl_prompt() {
local SHLVL_PROMPT
if [[ -n "$BYOBU_PREFIX" ]]; then
if [[ -n "$TMUX" ]]; then
SHLVL_PROMPT="%(3L.%K{161}%F{255}%B $((SHLVL-1)) %f%b%k.)" # Shows SHLVL on a magenta background if SHLVL > 1
else
SHLVL_PROMPT="%(2L.%K{161}%F{255}%B %L %f%b%k.)" # Shows SHLVL on a magenta background if SHLVL > 1