Skip to content

Commit

Permalink
feat: move modified symbol (+) to prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Delapouite committed Apr 3, 2019
1 parent 57c69d1 commit 3b35b23
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Run the `info-buffers` command. It will display an info box with a numbered list

- The current buffer is prefixed by a `>`.
- The alt buffer is prefixed by a `#` (use `ga` to reach it).
- Modified buffers are suffixed by a `[+]`.
- Modified buffers are prefixed by a `+`.

If this list gets too big, decrease the `max_list_buffers` option (42 entries by default).

Expand Down
24 changes: 16 additions & 8 deletions buffers.kak
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,26 @@ define-command info-buffers -docstring 'populate an info box with a numbered buf
name=${1%_*}
if [ "$name" = "$kak_bufname" ]; then
printf "> %s" "$index - $name"
printf ">"
elif [ "$name" = "$kak_opt_alt_bufname" ]; then
printf "# %s" "$index - $name"
printf "#"
else
printf " %s" "$index - $name"
printf " "
fi
modified=${1##*_}
if [ "$modified" = true ]; then
printf " [+]"
printf "+ "
else
printf " "
fi
echo
if [ "$index" -lt 10 ]; then
echo "0$index - $name"
else
echo "$index - $name"
fi
shift
done
printf ^\\n
Expand All @@ -87,11 +95,11 @@ define-command pick-buffers -docstring 'enter buffer pick mode' %{
name=${1%_*}
modified=${1##*_}
if [ "$name" = "$kak_bufname" ]; then
echo "map global pick-buffers ${keys:$index:1} :buffer-by-index<space>$index<ret> -docstring \"> $name $(if [ "$modified" = true ]; then echo "[+]"; fi)\""
echo "map global pick-buffers ${keys:$index:1} :buffer-by-index<space>$index<ret> -docstring \">$(if [ "$modified" = true ]; then echo "+"; else echo " "; fi) $name\""
elif [ "$name" = "$kak_opt_alt_bufname" ]; then
echo "map global pick-buffers ${keys:$index:1} :buffer-by-index<space>$index<ret> -docstring \"# $name $(if [ "$modified" = true ]; then echo "[+]"; fi)\""
echo "map global pick-buffers ${keys:$index:1} :buffer-by-index<space>$index<ret> -docstring \"#$(if [ "$modified" = true ]; then echo "+"; else echo " "; fi) $name\""
else
echo "map global pick-buffers ${keys:$index:1} :buffer-by-index<space>$index<ret> -docstring \" $name $(if [ "$modified" = true ]; then echo "[+]"; fi)\""
echo "map global pick-buffers ${keys:$index:1} :buffer-by-index<space>$index<ret> -docstring \" $(if [ "$modified" = true ]; then echo "+"; else echo " "; fi) $name\""
fi
shift
Expand Down

0 comments on commit 3b35b23

Please sign in to comment.