Skip to content

Commit

Permalink
squash!
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Oct 18, 2023
1 parent a7004f0 commit 408f8e8
Show file tree
Hide file tree
Showing 8 changed files with 471 additions and 461 deletions.
2 changes: 1 addition & 1 deletion completions/chezmoi.completion.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#! bash oh-my-bash.module

if _omb_util_command_exists chezmoi; then
eval -- "$(chezmoi completion bash)"
eval -- "$(chezmoi completion bash)"
fi
72 changes: 36 additions & 36 deletions lib/omb-completion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,52 @@
## in COMP_WORDS.
## @arr[out] COMPREPLY This functions empties the array COMPREPLY.
function _omb_completion_reassemble_breaks {
local exclude=$1
local line=$COMP_LINE point=$COMP_POINT
local breaks=${COMP_WORDBREAKS//[\"\'$exclude]}
local exclude=$1
local line=$COMP_LINE point=$COMP_POINT
local breaks=${COMP_WORDBREAKS//[\"\'$exclude]/}

COMPREPLY=()
cur=("${COMP_WORDS[COMP_CWORD]}" '')
COMPREPLY=()
cur=("${COMP_WORDS[COMP_CWORD]}" '')

local word rprefix= rword=
for word in "${COMP_WORDS[@]::COMP_CWORD+1}"; do
local space=${line%%"$word"*}
if [[ $space == "$line" ]]; then
# error: COMP_LINE does not contain enough words
return 1
fi
local word rprefix= rword=
for word in "${COMP_WORDS[@]::COMP_CWORD+1}"; do
local space=${line%%"$word"*}
if [[ $space == "$line" ]]; then
# error: COMP_LINE does not contain enough words
return 1
fi

word=${word::point - ${#space}}
if [[ $space || $rword == *["$breaks"] || $word == ["$breaks"]* ]]; then
rprefix=
rword=$word
else
rprefix=$rword
rword+=$word
fi
word=${word::point-${#space}}
if [[ $space || $rword == *["$breaks"] || $word == ["$breaks"]* ]]; then
rprefix=
rword=$word
else
rprefix=$rword
rword+=$word
fi

line=${line:${#space}+${#word}}
((point -= ${#space} + ${#word}))
((point >= 0)) || break
done
line=${line:${#space}+${#word}}
((point -= ${#space} + ${#word}))
((point >= 0)) || break
done

cur=("$rword" "$rprefix")
cur=("$rword" "$rprefix")
}

## @fn _omb_completion_resolve_breaks
## Adjust completions generated for the reassembled word
## @var[out] cur[1] Prefix to remove set by _omb_completion_reassemble_breaks
## @arr[out] COMPREPLY This functions empties the array COMPREPLY.
function _omb_completion_resolve_breaks {
if [[ ${cur[1]} ]]; then
local i
for i in "${!COMPREPLY[@]}"; do
if [[ ${COMPREPLY[i]} == "$cur_prefix"* ]]; then
COMPREPLY[i]=${COMPREPLY[i]#"$cur_prefix"}
else
unset -v 'COMPREPLY[i]'
fi
done
COMPREPLY=("${COMPREPLY[@]}")
fi
if [[ ${cur[1]} ]]; then
local i
for i in "${!COMPREPLY[@]}"; do
if [[ ${COMPREPLY[i]} == "$cur_prefix"* ]]; then
COMPREPLY[i]=${COMPREPLY[i]#"$cur_prefix"}
else
unset -v 'COMPREPLY[i]'
fi
done
COMPREPLY=("${COMPREPLY[@]}")
fi
}
24 changes: 12 additions & 12 deletions plugins/bashmarks/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Bashmarks plugin

The Bashmarks plugin allows you to create and use bookmarks for directories on
your filesystems. This plugin is derived from the project
https://github.com/huing/bashmarks but contains improvements. This plugin is
your filesystems. This plugin is derived from the project
https://github.com/huing/bashmarks but contains improvements. This plugin is
licensed under the 3-Clause BSD license.

## Quickstart
Expand All @@ -14,7 +14,7 @@ $ bm -a mydir
```

The command above creates a bookmark for the current directory with the name
*mydir*.
_mydir_.

You can navigate to the location of a bookmark using the _bm -g_ command:

Expand All @@ -28,26 +28,26 @@ You can also supply just any bookmark name and the _-g_ option will be assumed:
$ bm mydir
```

Tab completion is available when you need to enter a bookmark name in a
command, such as when using *bm -g*
Tab completion is available when you need to enter a bookmark name in a command,
such as when using _bm -g_

Easily list all bookmarks you have set up using the *bm -l* command:
Easily list all bookmarks you have set up using the _bm -l_ command:

```bash
$ bm -l
```

## Configuration

- **`BASHMARKS_SDIR`**: This variable contains the path to the file that stores
the information of bookmarks of directory names. The default path is
`~/.sdirs`. The old interface `SDIRS` is now deprecated.
- **`BASHMARKS_SDIR`**: This variable contains the path to the file that
stores the information of bookmarks of directory names. The default path is
`~/.sdirs`. The old interface `SDIRS` is now deprecated.

## Configuration

- `BASHMARKS_SDIR`: This variable contains the path to the file that stores the
information of bookmarks of directory names. The default path is `~/.sdirs`.
The old interface `SDIRS` is now deprecated.
- `BASHMARKS_SDIR`: This variable contains the path to the file that stores
the information of bookmarks of directory names. The default path is
`~/.sdirs`. The old interface `SDIRS` is now deprecated.

## Commands

Expand Down
Loading

0 comments on commit 408f8e8

Please sign in to comment.