aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-12-19 11:11:42 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-12-19 11:11:42 +1300
commit84f9ddc9214401bdb7e5f6f3e5133d24b29e4917 (patch)
tree88dc8ad4a3df161792718e7718c79d17ee6d5254
parente0ff7ac01d6439d826ff9ef6f134a7638ade714f (diff)
parent2488fcfddb4e58c9b6fe83bb960283126388695b (diff)
downloaddotfiles-84f9ddc9214401bdb7e5f6f3e5133d24b29e4917.tar.gz
Merge branch 'release/v3.3.0'v3.3.0
* release/v3.3.0: Bump VERSION Add sh.vim mapping to insert '\'' quickly Remove now-unneeded shellcheck disable rules Follow ShellCheck's recommendation of -z over !-n Adjust PS1-PS4 reset Use exec for clearer subshell semantics Use `command` consistently, silence ShellCheck Add /j flag to :vimgrep shortcut
-rw-r--r--VERSION4
-rw-r--r--bash/bash_completion.d/make.bash1
-rw-r--r--bash/bash_completion.d/path.bash1
-rw-r--r--sh/profile.d/options.sh4
-rw-r--r--sh/profile.d/welcome.sh2
-rw-r--r--sh/shrc.d/bd.sh3
-rw-r--r--sh/shrc.d/gd.sh3
-rw-r--r--sh/shrc.d/grep.sh2
-rw-r--r--sh/shrc.d/gt.sh3
-rw-r--r--sh/shrc.d/mkcd.sh5
-rw-r--r--sh/shrc.d/pd.sh3
-rw-r--r--sh/shrc.d/prompt.sh17
-rw-r--r--sh/shrc.d/rd.sh3
-rw-r--r--sh/shrc.d/scr.sh3
-rw-r--r--sh/shrc.d/sd.sh3
-rw-r--r--sh/shrc.d/ud.sh3
-rw-r--r--sh/shrc.d/vr.sh3
-rw-r--r--sh/shrc.d/xd.sh2
-rw-r--r--vim/after/ftplugin/sh.vim9
-rw-r--r--vim/vimrc2
20 files changed, 50 insertions, 26 deletions
diff --git a/VERSION b/VERSION
index 2a431fea..2addfdb6 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1,2 @@
-tejr dotfiles v3.2.0
-Fri Dec 14 00:14:00 UTC 2018
+tejr dotfiles v3.3.0
+Tue Dec 18 22:11:42 UTC 2018
diff --git a/bash/bash_completion.d/make.bash b/bash/bash_completion.d/make.bash
index 909c52fb..b3148ff1 100644
--- a/bash/bash_completion.d/make.bash
+++ b/bash/bash_completion.d/make.bash
@@ -38,7 +38,6 @@ _make() {
< <(printf '%s\n' "${line%%:*}")
# Short-circuit if there are no targets
- # shellcheck disable=SC2154
((${#targets[@]})) || exit
# Make matches behave correctly
diff --git a/bash/bash_completion.d/path.bash b/bash/bash_completion.d/path.bash
index c3bb7b80..9224506a 100644
--- a/bash/bash_completion.d/path.bash
+++ b/bash/bash_completion.d/path.bash
@@ -66,7 +66,6 @@ _path() {
< <(printf '%s\0' "$PATH")
# Print shell-quoted matching parts, null-terminated
- # shellcheck disable=SC2154
for path in "${paths[@]}" ; do
case $path in
("$2"*) printf '%q\0' "$path" ;;
diff --git a/sh/profile.d/options.sh b/sh/profile.d/options.sh
index 58376fb3..c60dd140 100644
--- a/sh/profile.d/options.sh
+++ b/sh/profile.d/options.sh
@@ -13,7 +13,7 @@ options() {
[ -d "$dir" ] && return
# Create the directory and step into it
- command -p mkdir -p -- "$dir" || return
+ mkdir -p -- "$dir" || return
cd -- "$dir" || return
# Write the program's --help output to a file, even if it's empty
@@ -23,7 +23,7 @@ options() {
# Iterate through remaining arguments (desired options), creating files to
# show they're available if found in the help output
for opt do
- command -p grep -q -- \
+ command grep -q -- \
'[^[:alnum:]]--'"$opt"'[^[:alnum:]]' help || continue
touch -- "$opt"
done
diff --git a/sh/profile.d/welcome.sh b/sh/profile.d/welcome.sh
index cdd41edb..22cdde93 100644
--- a/sh/profile.d/welcome.sh
+++ b/sh/profile.d/welcome.sh
@@ -20,7 +20,7 @@ esac
# Show a fortune
if welcome fortune ; then
- if ! [ -n "$FORTUNE_PATH"] &&
+ if [ -z "$FORTUNE_PATH" ] &&
[ -d "$HOME"/.local/share/games/fortunes ] ; then
FORTUNE_PATH=$HOME/.local/share/games/fortunes
fi
diff --git a/sh/shrc.d/bd.sh b/sh/shrc.d/bd.sh
index 29bde513..a942af6b 100644
--- a/sh/shrc.d/bd.sh
+++ b/sh/shrc.d/bd.sh
@@ -43,5 +43,6 @@ bd() {
fi
# We have a match; try and change into it
- command cd -- "$1"
+ # shellcheck disable=SC2164
+ cd -- "$1"
}
diff --git a/sh/shrc.d/gd.sh b/sh/shrc.d/gd.sh
index 9f6a43e7..b9af480e 100644
--- a/sh/shrc.d/gd.sh
+++ b/sh/shrc.d/gd.sh
@@ -14,5 +14,6 @@ gd() {
fi
# Go to the marked directory
- cd -- "$PMD" || return
+ # shellcheck disable=SC2164
+ cd -- "$PMD"
}
diff --git a/sh/shrc.d/grep.sh b/sh/shrc.d/grep.sh
index 997babc9..c448c81d 100644
--- a/sh/shrc.d/grep.sh
+++ b/sh/shrc.d/grep.sh
@@ -15,7 +15,7 @@ grep() {
# Add --color=auto if the terminal has at least 8 colors
if [ -e "$HOME"/.cache/sh/opt/grep/color ] &&
- [ "$({ tput colors||tput Co||echo 0; } 2>/dev/null)" -ge 8 ] ; then
+ [ "$(exec 2>/dev/null;tput colors||tput Co||echo 0)" -ge 8 ] ; then
set -- --color=auto "$@"
fi
diff --git a/sh/shrc.d/gt.sh b/sh/shrc.d/gt.sh
index 7a52571d..193a2996 100644
--- a/sh/shrc.d/gt.sh
+++ b/sh/shrc.d/gt.sh
@@ -24,5 +24,6 @@ gt() {
fi
# Try to change into the determined directory, or root if empty
- command cd -- "${1:-/}"
+ # shellcheck disable=SC2164
+ cd -- "${1:-/}"
}
diff --git a/sh/shrc.d/mkcd.sh b/sh/shrc.d/mkcd.sh
index cd882b51..bfe8a142 100644
--- a/sh/shrc.d/mkcd.sh
+++ b/sh/shrc.d/mkcd.sh
@@ -1,5 +1,6 @@
# Create a directory and change into it
mkcd() {
- command -p mkdir -p -- "$1" || return
- command cd -- "$1"
+ mkdir -p -- "$1" || return
+ # shellcheck disable=SC2164
+ cd -- "$1"
}
diff --git a/sh/shrc.d/pd.sh b/sh/shrc.d/pd.sh
index e3a6daaa..d5257ba5 100644
--- a/sh/shrc.d/pd.sh
+++ b/sh/shrc.d/pd.sh
@@ -27,5 +27,6 @@ pd() {
set -- "${1%/*}"
# Try to change into the determined directory, or root if empty
- command cd -- "${1:-/}"
+ # shellcheck disable=SC2164
+ cd -- "${1:-/}"
}
diff --git a/sh/shrc.d/prompt.sh b/sh/shrc.d/prompt.sh
index 30e4e9d8..cb32c113 100644
--- a/sh/shrc.d/prompt.sh
+++ b/sh/shrc.d/prompt.sh
@@ -1,8 +1,15 @@
-# Some systems' /etc/profile setups export PS1, which really fouls things up
-# when switching between non-login shells; let's put things right by unsetting
-# it to break the export and then just setting them as simple variables
-unset PS1 PS2 PS3 PS4
-PS1='$ ' PS2='> ' PS3='? ' PS4='+ '
+# Some systems' /etc/profile setups export their prompt strings (PS1, PS2...),
+# which really fouls things up when switching between non-login shells; let's
+# put things right by unsetting each of them to break the export, and then just
+# setting them as simple variables
+unset PS1
+PS1='$ '
+unset PS2
+PS2='> '
+unset PS3
+PS3='? '
+unset PS4
+PS4='+ '
# If we have an SSH_CLIENT or SSH_CONNECTION environment variable, put the
# hostname in PS1 too.
diff --git a/sh/shrc.d/rd.sh b/sh/shrc.d/rd.sh
index 9633713a..5fbd5ac5 100644
--- a/sh/shrc.d/rd.sh
+++ b/sh/shrc.d/rd.sh
@@ -35,5 +35,6 @@ rd() {
esac
# Try to change into the determined directory
- command cd -- "$1"
+ # shellcheck disable=SC2164
+ cd -- "$1"
}
diff --git a/sh/shrc.d/scr.sh b/sh/shrc.d/scr.sh
index 9af8dd74..14a58ad1 100644
--- a/sh/shrc.d/scr.sh
+++ b/sh/shrc.d/scr.sh
@@ -2,5 +2,6 @@
# files into $HOME, and making the system do cleanup for me. Single optional
# argument is the string to use for naming the directory; defaults to "scr".
scr() {
- cd -- "$(mktd "${1:-scr}")" || return
+ # shellcheck disable=SC2164
+ cd -- "$(mktd "${1:-scr}")"
}
diff --git a/sh/shrc.d/sd.sh b/sh/shrc.d/sd.sh
index 8b12c170..58d1a375 100644
--- a/sh/shrc.d/sd.sh
+++ b/sh/shrc.d/sd.sh
@@ -113,5 +113,6 @@ sd() {
esac
# Try and change into the first parameter
- command cd -- "$1"
+ # shellcheck disable=SC2164
+ cd -- "$1"
}
diff --git a/sh/shrc.d/ud.sh b/sh/shrc.d/ud.sh
index 06234569..f7f33caf 100644
--- a/sh/shrc.d/ud.sh
+++ b/sh/shrc.d/ud.sh
@@ -42,5 +42,6 @@ ud() {
shift
# Try to change into the determined directory, or the root if blank
- command cd -- "${1:-/}"
+ # shellcheck disable=SC2164
+ cd -- "${1:-/}"
}
diff --git a/sh/shrc.d/vr.sh b/sh/shrc.d/vr.sh
index c7057ec2..d9cfda62 100644
--- a/sh/shrc.d/vr.sh
+++ b/sh/shrc.d/vr.sh
@@ -59,5 +59,6 @@ vr() {
[ -n "$1" ] || return
# Try to change into the determined directory
- command cd -- "$@"
+ # shellcheck disable=SC2164
+ cd -- "$@"
}
diff --git a/sh/shrc.d/xd.sh b/sh/shrc.d/xd.sh
index 7c17adea..b26d88b3 100644
--- a/sh/shrc.d/xd.sh
+++ b/sh/shrc.d/xd.sh
@@ -8,7 +8,7 @@ xd() {
fi
# Complain if mark not actually set yet
- if ! [ -n "$PMD" ] ; then
+ if [ -z "$PMD" ] ; then
printf >&2 'gd(): Mark not set\n'
return 1
fi
diff --git a/vim/after/ftplugin/sh.vim b/vim/after/ftplugin/sh.vim
index 6ee016a5..d6716a3d 100644
--- a/vim/after/ftplugin/sh.vim
+++ b/vim/after/ftplugin/sh.vim
@@ -45,3 +45,12 @@ nnoremap <buffer> <LocalLeader>l
\ :<C-U>compiler shellcheck<CR>
let b:undo_ftplugin .= '|nunmap <buffer> <LocalLeader>c'
\ . '|nunmap <buffer> <LocalLeader>l'
+
+" Mapping to insert '\'' with Alt+'; not sure I'll keep this just yet
+if has('gui_running')
+ inoremap <buffer> <M-'> '\''
+ let b:undo_ftplugin .= '|nunmap <buffer> <M-''>'
+else
+ inoremap <buffer> <Esc>' '\''
+ let b:undo_ftplugin .= '|nunmap <buffer> <Esc>'''
+endif
diff --git a/vim/vimrc b/vim/vimrc
index f5ffec73..69f63083 100644
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -404,7 +404,7 @@ xmap <Leader>{ <Plug>(VerticalRegionUpVisual)
xmap <Leader>} <Plug>(VerticalRegionDownVisual)
" \/ types :vimgrep for me ready to enter a search pattern
-nnoremap <Leader>/ :<C-U>vimgrep /\c/ **<S-Left><S-Left><Right>
+nnoremap <Leader>/ :<C-U>vimgrep /\c/j **<S-Left><S-Left><Right>
" \? types :helpgrep for me ready to enter a search pattern
nnoremap <Leader>? :<C-U>helpgrep \c<S-Left>