Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make implicitly global parameter declarations local #173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions zsh-vi-mode.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ function zvm_find_bindkey_widget() {
local keymap=$1
local keys=$2
local prefix_mode=${3:-false}
retval=()
local retval=()

if $prefix_mode; then
local pos=0
Expand All @@ -422,6 +422,7 @@ function zvm_find_bindkey_widget() {

local result=$(bindkey -M ${keymap} -p "$prefix_keys")$'\n'

local i=
# Split string to array by newline
for ((i=$spos;i<$#result;i++)); do

Expand Down Expand Up @@ -529,6 +530,7 @@ function zvm_readkeys() {
if [[ "${keys}" == $'\e' ]]; then
timeout=$ZVM_ESCAPE_KEYTIMEOUT
# Check if there is any one custom escape sequence
local i=
for ((i=1; i<=${#result[@]}; i=i+2)); do
if [[ "${result[$i]}" =~ '^\^\[\[?[A-Z0-9]*~?\^\[' ]]; then
timeout=$ZVM_KEYTIMEOUT
Expand Down Expand Up @@ -557,6 +559,7 @@ function zvm_readkeys() {
zvm_exit_oppend_mode
fi

local retval=()
if [[ -z "$key" ]]; then
retval=(${keys} $widget)
else
Expand Down Expand Up @@ -619,7 +622,7 @@ function zvm_string_to_hex() {

# Escape non-printed characters
function zvm_escape_non_printed_characters() {
local str=
local i= str=
for ((i=0;i<$#1;i++)); do
local c=${1:$i:1}
if [[ "$c" < ' ' ]]; then
Expand Down Expand Up @@ -2729,6 +2732,7 @@ function zvm_highlight() {
local raw=true
local spl=(${(@s/ /)region_highlight[i]})
local pat="${spl[1]} ${spl[2]}"
local j=
for ((j=1; j<=${#ZVM_REGION_HIGHLIGHT[@]}; j++)); do
if [[ "$pat" == "${ZVM_REGION_HIGHLIGHT[j]:0:$#pat}" ]]; then
raw=false
Expand Down Expand Up @@ -2937,6 +2941,7 @@ function zvm_select_vi_mode() {
local list=("${ZVM_LAZY_KEYBINDINGS_LIST[@]}")
unset ZVM_LAZY_KEYBINDINGS_LIST

local r=
for r in "${list[@]}"; do
eval "zvm_bindkey ${r}"
done
Expand Down Expand Up @@ -3360,6 +3365,7 @@ function zvm_init() {
esac

# Bind and overwrite original y/d/c of vicmd
local c=
for c in {y,d,c}; do
zvm_bindkey vicmd "$c" $default_handler_widget
done
Expand All @@ -3369,6 +3375,7 @@ function zvm_init() {
local surrounds=()

# Append brackets
local s=
for s in ${(s..)^:-'()[]{}<>'}; do
surrounds+=($s)
done
Expand Down