Merge pull request #57 from jirutka/patch-2

Fix and unify formatting and code-style
This commit is contained in:
Michael Robinson 2015-05-19 08:57:14 +12:00
commit 2d5ac282a9
6 changed files with 51 additions and 45 deletions

7
.editorconfig Normal file
View file

@ -0,0 +1,7 @@
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

View file

@ -28,22 +28,22 @@ function {
}
ZLE_AUTOSUGGEST_SUSPEND_WIDGETS=(
vi-cmd-mode vi-backward-char backward-char backward-word beginning-of-line
history-search-forward history-search-backward up-line-or-history
history-beginning-search-forward history-beginning-search-backward
down-line-or-history history-substring-search-up history-substring-search-down
backward-kill-word
vi-cmd-mode vi-backward-char backward-char backward-word beginning-of-line
history-search-forward history-search-backward up-line-or-history
history-beginning-search-forward history-beginning-search-backward
down-line-or-history history-substring-search-up history-substring-search-down
backward-kill-word
)
ZLE_AUTOSUGGEST_COMPLETION_WIDGETS=(
complete-word expand-or-complete expand-or-complete-prefix list-choices
menu-complete reverse-menu-complete menu-expand-or-complete menu-select
accept-and-menu-complete
complete-word expand-or-complete expand-or-complete-prefix list-choices
menu-complete reverse-menu-complete menu-expand-or-complete menu-select
accept-and-menu-complete
)
ZLE_AUTOSUGGEST_ACCEPT_WIDGETS=(
vi-forward-char forward-char vi-forward-word forward-word vi-add-eol
vi-add-next vi-forward-blank-word end-of-line
vi-forward-char forward-char vi-forward-word forward-word vi-add-eol
vi-add-next vi-forward-blank-word end-of-line
)
autosuggest-pause() {
@ -100,7 +100,7 @@ autosuggest-resume() {
autosuggest-start() {
if [[ -z $ZLE_DISABLE_AUTOSUGGEST && -n $functions[_zsh_highlight] ]]; then
if [[ ${ZSH_HIGHLIGHT_HIGHLIGHTERS[(i)autosuggest]} -gt ${#ZSH_HIGHLIGHT_HIGHLIGHTERS} ]];then
if [[ ${ZSH_HIGHLIGHT_HIGHLIGHTERS[(i)autosuggest]} -gt ${#ZSH_HIGHLIGHT_HIGHLIGHTERS} ]]; then
ZSH_HIGHLIGHT_HIGHLIGHTERS+=(autosuggest)
fi
fi

View file

@ -48,7 +48,7 @@ zstyle -d ':completion:*' list-colors
zmodload zsh/zutil
# override compadd (this our hook)
compadd () {
compadd() {
# check if any of -O, -A or -D are given
if [[ ${@[1,(i)(-|--)]} == *-(O|A|D)\ * ]]; then

23
install
View file

@ -3,8 +3,7 @@
# Install script for zsh-autocomplete
config="$HOME/.zshrc"
for config in "$HOME/.zshrc" "$ZDOTDIR/.zshrc" "$1"
do
for config in "$HOME/.zshrc" "$ZDOTDIR/.zshrc" "$1"; do
echo $config
#first checks if ~/.zshrc file exists and is readable
if [ -r "$config" ]; then
@ -24,21 +23,21 @@ done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
# appends the string to $config (usually ~/.zshrc) file
cat >> "$config" << EOF
cat >> "$config" <<-EOF
# Setup zsh-autosuggestions
source $DIR/autosuggestions.zsh
# Setup zsh-autosuggestions
source $DIR/autosuggestions.zsh
# Enable autosuggestions automatically
zle-line-init() {
# Enable autosuggestions automatically
zle-line-init() {
zle autosuggest-start
}
}
zle -N zle-line-init
zle -N zle-line-init
# use ctrl+t to toggle autosuggestions(hopefully this wont be needed as
# zsh-autosuggestions is designed to be unobtrusive)
bindkey '^T' autosuggest-toggle
# use ctrl+t to toggle autosuggestions(hopefully this wont be needed as
# zsh-autosuggestions is designed to be unobtrusive)
bindkey '^T' autosuggest-toggle
EOF
echo "\nSetup completed successfully!\n"